Create Support for a new Platform
Write the extractor
Guidelines for a extractor
It is best to make your extractor as light as possible. For this reason I would
recommend a rss-feed if the platform has one. Please additionally make only one
GET-request per subscription.
Writing the extractor
You will need two structs you define in your new platform, one for the video and one for the subscription.
Your video struct will just hold some basic information about the video that
can be queried, e.g. a playable url, the video title. It will have to implement
Video-trait defined in
Subscription-type will be the subscription you define next.
The subscription structure will hold information about the channel, e.g. the
name, and information that will be used to query the uploaded videos from the
channel. You will have to implement the
Subscription-trait defined in
Video-type is the struct you
The extraction process
To extract videos from the subscription, you will need to implement the
GeneratorWithClient-trait defined in
Item-type will be your video, the
Iterator-type will depend on your
If you took the easy route of a rss-based extraction, you can use the tools
tf_utils/src/rss/rss_extractor.rs. You will basically just need to
RssExtractor for your subscription to get the url of the rss feed
and overwrite the
WithName as you will most likly not have the subscription
name when initializing the subscription.
Your video will need to implement
FromItemAndSub, the generic variable
will be your defined subscription.
If your rss feed requires some tags not already defined in the rss structure,
tf_utils/src/rss/structure.rs to your liking.
If the tag has
:, please replace it with
/ and also do so in
tf_utils/src/rss/rss_extractor.rs similar to
Please see the
Peertube-platform for a example.
If your platform does not have a rss-feed or using one is not practical, you
will have to do most of the work manually, see the
Youtube-platform as a
Please implement the REST-Client in a different crate if this is too complex or use a already defined crate if available.
You will most likly have thumbnails for your video. If these thumbnails are
png or any other in
supported platforms, you will just have to overwrite
thumbnail_url for your
webp currently is only supported grayscale-only you will have to
convert_image in your video, that will convert the image bytes to a
DynamicImage. For a example, see the
YTVideo defined in
Note: Currently you will have to add your new platform to almost any file in
t_join crate. I currently do not know how this could be made easier, but
it is currently mostly copy-and-paste.
tf_join crate is split into a feature for every platform. Please add your
new platform with a new feature into the
tf_join crate you will find many comments starting with
// -- Add new value here.. At these comments you will need to copy-and-paste
the previous code-block, match-case or similar and edit it for your new
platform. Most of the edits are very minor (e.g. a new field in a struct) and
some require more thinking (e.g. (de)serializing to csv).
Please do not forget
#[feature = "platform"] before your code, and also update
join example for testing.
Tubefeeder you will have to change two files.
subscription_adder.rs you will need to change what entry boxes are
visible when selecting your new platform (in the
view!-macro, see the
Peertube platform for a example), and how your subscription will be
generated from the input values in the
subscription_item.rs you will need to change whether the name of the
subscription should be updated when displayed (instead of displaying the id).
You will need to change that in the
Copyright: 2021 Julian Schmidhuber email@example.com
Unless otherwise noted content on this wiki may be used under the terms of the GNU FDL, either version 1.3 (https://www.gnu.org/licenses/fdl-1.3.html) or (at your opinion) any later version of the license, or (at your opinion) the CC-BY-SA-4.0-license (https://creativecommons.org/licenses/by-sa/4.0/legalcode).