README.md (2893B)
1 # yt2rss
2
3 Please send patches or remarks to
4 [jayvii[AT]posteo[DOT]de](mailto:jayvii[AT]posteo[DOT]de)
5
6 Transforms a youtube channel into a podcast RSS feed to insert into a
7 podcatcher.
8
9 ## Usage
10
11 Currently, there are two endpoints for the yt2rss script/service:
12
13 * index.php?channel=UCt_Y3j8CpXx366et1RaHACA
14 * index.php?video=TV8tEq56vHI
15
16 Assuming you host this service under the URL "https://yt2rss.example.com",
17 insert following RSS link into your podcatcher:
18
19 https://yt2rss.example.com/?channel=UCt_Y3j8CpXx366et1RaHACA
20
21 Individual video entries can be fetched via:
22
23 https://yt2rss.example.com/?video=TV8tEq56vHI
24
25 If the video has not been fetched before, this will take a few seconds, as the
26 server needs to download and convert the video to an .opus audio file before it
27 can serve it.
28
29 Videos within a feed can be included or excluded based on title-matches:
30
31 Include only videos whose title contain "example":
32
33 https://yt2rss.example.com/?channel=UCt_Y3j8CpXx366et1RaHACA&include=example
34
35 Exclude all videos whose title contain "example":
36
37 https://yt2rss.example.com/?channel=UCt_Y3j8CpXx366et1RaHACA&exclude=example
38
39 ## Advanced Usage
40
41 It is advised to only allow trusted parties to use your service. yt2rss uses a
42 simple authentication key for this, which is included in the URL:
43
44 https://yt2rss.example.com/?auth=MY_KEY&channel=UCt_Y3j8CpXx366et1RaHACA
45 https://yt2rss.example.com/?auth=MY_KEY&video=TV8tEq56vHI
46
47 You can set an auth-key in the "env.php" file. If the value is set to something
48 other than null (the default), authentication is enabled.
49
50 ## Further notes
51
52 ### Episode durations are not shown correctly on first load
53
54 Duration times of entries are unknown until they have been downloaded. The
55 podcast feed (?channel=...) will show episode durations as "00:00:00" unless the
56 according episode is already present in the webroot (has been accessed by the
57 podcatcher or any other client, like a webbrowser).
58
59 ### The webroot grows bigger / old episodes are never removed from the server
60
61 The script will never "cleanup" audio files from the webdir root directory,
62 after they have been downloaded by the client. Depending on your usecase
63 scenario, it might be a good idea to setup a cronjob for that. The example
64 below will look every night at 00:00 for .opus files in the web-directory (in
65 this example "/var/www/yt2rss", adjust accordingly) that have been created
66 (downloaded) over 7 days ago.
67
68 Crontab Entry:
69 ```cron
70 # |----------- minutes
71 # |
72 # | |--------- hours
73 # | |
74 # | | |------- day of month
75 # | | |
76 # | | | |----- month
77 # | | | |
78 # | | | | |--- day of week
79 # | | | | |
80 # | | | | | |- command
81 # | | | | | |
82 0 0 * * * find /var/www/yt2rss/ -type f -name "*.opus" ! -newermt $(date +%Y-%m-%d --date "-7 days") -exec rm {} \;
83 ```
84
85 ## Requirements
86
87 - [getID3](https://github.com/JamesHeinrich/getID3)
88 - [yt-dlp](https://github.com/yt-dlp/yt-dlp)
89 - PHP-7.2 or higher