![](/style/images/good.png)
![](/style/images/bad.png)
GitHub - frou/yt2pod: Daemon that monitors YouTube channels and publishes audio...
source link: https://github.com/frou/yt2pod
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
README.md
yt2pod is a daemon that monitors YouTube channels and publishes audio podcasts of them.
A podcast episode needn't be created for every video uploaded to a channel. They can be filtered based on title and upload date.
A single instance of yt2pod can monitor multiple YouTube channels simultaneously and publish a separate audio podcast based on each (and even multiple podcasts based on the same channel).
A built-in webserver serves the following for each podcast:
- RSS Feed:
http://YOURDOMAIN.COM/meta/SHORT_NAME.xml
- Artwork:
http://YOURDOMAIN.COM/meta/SHORT_NAME.jpg
- Audio Episodes:
http://YOURDOMAIN.COM/ep/id_of_source_youtube_video.EXT
- ...
- ...
The capitalised parts are specified in your config file.
Configuration
Configuration is specified in a JSON file. Here is an example config file.
Each podcast is configured as an element of the "podcasts"
array. In each:
-
yt_channel
is either the YouTube channel's Username or its ID (a 24-character string starting "UC"). Note that on modern YouTube, not every channel has a Username. Go to the channel's page using your web browser and look at the URL and you will find either one or the other. -
epoch
is a date ("YYYY-MM-DD"
or an empty string to mean the beginning of time). Videos uploaded before the epoch are ignored. -
title_filter
is a regular expression. Videos with a title matching it have a podcast episode created for them. Use an empty string if you want them all. -
name
is the name of the podcast to be shown to the user in their podcast client. -
description
is the description of the podcast to be shown to the user in their podcast client. If this is omitted or is the empty string, a matter-of-fact description will be generated. -
custom_image
is a filesystem path (relative to the data directory - see the -data flag) for a custom image to use for the podcast's artwork. If this is omitted or is the empty string, the avatar image of the YouTube user this podcast is based on will be used. -
short_name
is a unique name that will be used for things like the podcast feed's file name and logging. For example, for podcast with aname
of"This Week In Bikeshedding"
, use ashort_name
like"twib"
.
Command-line Flags
In addition to the config file, there are a handful of command-line flags:
usage:
yt2pod [flags]
flags:
-config string
path to config file (default "config.json")
-data string
path to directory to change into and write data (created if needed) (default "data")
-dataclean
during initialisation, remove files in the data directory that are irrelevant given the current config
-syslog
send log statements to syslog rather than writing them to stderr
-version
show version information then exit
YouTube Data API
YouTube's Data API is used to query information. The example config file contains an API key that you can use, or you can get your own API key and use it instead.
Building, and an external dependency
With the Go toolchain installed, the following shell command will download the source code and build it:
go get github.com/frou/yt2pod
The yt2pod
binary should now be built and located in $GOPATH/bin
? The yt2pod
binary calls out to the youtube-dl command at runtime. You should make sure you have youtube-dl
installed (it is available in all good package managers).
Autostart with systemd daemon
If you have a distro that uses systemd (like Ubuntu), you can make yt2pod work as a daemon.
First, create a systemd service file by running:
sudo nano /etc/systemd/system/yt2pod.service
Use the following template:
Description=Podcast Daemon
After=network.target
[Service]
User=yt2pod
Group=yt2pod
Type=simple
ExecStart=/opt/yt2pod/yt2pod -syslog -config /home/yt2pod/config.json -data /home/yt2pod/data
TimeoutStopSec=20
[Install]
WantedBy=multi-user.target
Make sure to change the location of the yt2pod binary, the location of the config.json and the data folder to were yours are, they must be set manually in the file otherwise the service will fail to start!
Start the service:
sudo systemctl start yt2pod.service
Check for errors:
sudo systemctl status yt2pod.service
In case you get any errors, make sure to see your systemlog for more info about it.
If no errors, enable the service to autostart with your computer:
sudo systemctl enable yt2pod.service
License
The MIT License
Copyright (c) 2015 Duncan Holm
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK