2019-07-25 18:02:25 -07:00
# Podsync
![Podsync ](docs/img/logo.png )
2019-11-16 00:36:38 -08:00
[![ ](https://github.com/mxpv/podsync/workflows/CI/badge.svg )](https://github.com/mxpv/podsync/actions?query=workflow%3ACI)
[![GitHub release (latest SemVer) ](https://img.shields.io/github/v/release/mxpv/podsync )](https://github.com/mxpv/podsync/releases)
2019-07-25 18:02:25 -07:00
[![Go Report Card ](https://goreportcard.com/badge/github.com/mxpv/podsync )](https://goreportcard.com/report/github.com/mxpv/podsync)
2019-01-07 21:09:04 -08:00
[![Patreon ](https://img.shields.io/badge/support-patreon-E6461A.svg )](https://www.patreon.com/podsync)
2019-11-16 00:36:38 -08:00
[![Twitter Follow ](https://img.shields.io/twitter/follow/pod_sync?style=social )](https://twitter.com/pod_sync)
2017-08-21 23:52:02 -07:00
2019-11-13 21:14:52 -08:00
Podsync - is a simple, free service that lets you listen to any YouTube / Vimeo channels, playlists or user videos in
podcast format.
2017-08-21 23:52:02 -07:00
2019-11-13 21:14:52 -08:00
Podcast applications have a rich functionality for content delivery - automatic download of new episodes,
remembering last played position, sync between devices and offline listening. This functionality is not available
on YouTube and Vimeo. So the aim of Podsync is to make your life easier and enable you to view/listen to content on
any device in podcast client.
2017-08-21 23:52:02 -07:00
2020-03-07 18:19:46 -08:00
## Features
- Works with YouTube and Vimeo.
- Supports feeds configuration: video/audio, high/low quality, max video height, etc.
- mp3 encoding
- Update scheduler supports cron expressions
- Episodes filtering (match by title).
2020-03-07 22:32:51 -08:00
- Feeds customizations (custom artwork, category, language, etc).
2020-04-15 14:16:52 -07:00
- OPML export.
2020-03-07 18:19:46 -08:00
- Supports episodes cleanup (keep last X episodes).
- One-click deployment for AWS.
- Runs on Windows, Mac OS, Linux, and Docker.
- Supports ARM.
2020-04-19 13:19:31 -07:00
- Automatic youtube-dl self update.
2020-04-20 21:06:51 -07:00
- Supports API keys rotation.
2020-03-07 18:19:46 -08:00
2019-11-13 21:14:52 -08:00
## Dependencies
If you're running the CLI as binary (e.g. not via Docker), you need to make sure that dependencies are available on
2020-04-19 13:19:31 -07:00
your system. Currently, Podsync depends on `youtube-dl` and `ffmpeg` .
2019-11-13 21:14:52 -08:00
On Mac you can install those with `brew` :
```
brew install youtube-dl ffmpeg
```
## Access tokens
In order to query YouTube or Vimeo API you have to obtain an API token first.
2020-01-27 10:03:38 -08:00
- [How to get YouTube API key ](https://elfsight.com/blog/2016/12/how-to-get-youtube-api-key-tutorial/ )
2019-11-13 21:14:52 -08:00
- [Generate an access token for Vimeo ](https://developer.vimeo.com/api/guides/start#generate-access-token )
## Configuration example
2019-12-12 11:42:00 -08:00
You need to create a configuration file (for instance `config.toml` ) and specify the list of feeds that you're going to host.
Here is an example how configuration might look like:
2019-11-13 21:14:52 -08:00
```toml
[server]
port = 8080
2020-02-09 02:51:30 +03:00
data_dir = "/app/data" # Don't change if you run podsync via docker
2019-11-13 21:14:52 -08:00
2020-04-20 21:06:51 -07:00
# Tokens from `Access tokens` section
2019-11-13 21:14:52 -08:00
[tokens]
2020-04-20 21:06:51 -07:00
youtube = "YOUTUBE_API_TOKEN" # YouTube API Key. See https://developers.google.com/youtube/registering_an_application
vimeo = [ # Multiple keys will be rotated.
"VIMEO_API_KEY_1", # Vimeo developer keys. See https://developer.vimeo.com/api/guides/start#generate -access-token
"VIMEO_API_KEY_2"
]
2019-11-13 21:14:52 -08:00
[feeds]
[feeds.ID1]
url = "{FEED_URL}" # URL address of a channel, group, user, or playlist.
page_size = 50 # The number of episodes to query each update (keep in mind, that this might drain API token)
update_period = "12h" # How often query for updates, examples: "60m", "4h", "2h45m"
quality = "high" # or "low"
2019-11-13 23:12:41 -08:00
format = "video" # or "audio"
2020-04-17 22:31:05 -07:00
# custom = { cover_art = "{IMAGE_URL}}", category = "TV", explicit = true, lang = "en" } # Optional feed customizations
2020-02-09 02:51:30 +03:00
# max_height = "720" # Optional maximal height of video, example: 720, 1080, 1440, 2160, ...
# cron_schedule = "@every 12h" # Optional cron expression format. If set then overwrite 'update_period'. See details below
2020-05-15 11:33:51 +01:00
# filters = { title = "regex for title here", not_title = "regex for negative title match", description = "...", not_description = "..." } # Optional Golang regexp format. If set, then only download matching episodes.
2020-04-15 22:26:08 +02:00
# opml = true|false # Optional inclusion of the feed in the OPML file (default value: false)
2020-03-07 18:01:00 -08:00
# clean = { keep_last = 10 } # Keep last 10 episodes (order desc by PubDate)
2020-04-15 14:13:48 -07:00
[database]
badger = { truncate = true, file_io = true } # See https://github.com/dgraph-io/badger#memory -usage
2020-04-17 15:47:02 +01:00
2020-04-19 13:19:31 -07:00
[downloader]
self_update = true # Optional, auto update youtube-dl every 24 hours
2020-04-17 15:47:02 +01:00
# Optional log config. If not specified logs to the stdout
[log]
filename = "podsync.log"
max_size = 50 # MB
max_age = 30 # days
max_backups = 7
compress = true
2019-11-13 21:14:52 -08:00
```
2019-11-23 13:25:07 -08:00
Episodes files will be kept at: `/path/to/data/directory/ID1` , feed will be accessible from: `http://localhost/ID1.xml`
2019-11-13 21:14:52 -08:00
2019-11-23 13:25:07 -08:00
If you want to hide Podsync behind reverse proxy like nginx, you can use `hostname` field:
```toml
[server]
port = 8080
hostname = "https://my.test.host:4443"
[feeds]
[feeds.ID1]
...
```
2020-02-08 17:00:39 -08:00
Server will be accessible from `http://localhost:8080` , but episode links will point to `https://my.test.host:4443/ID1/...`
2020-02-09 02:51:30 +03:00
2020-02-08 17:00:39 -08:00
### Schedule via cron expression
You can use `cron_schedule` field to build more precise update checks schedule.
2020-02-09 02:51:30 +03:00
A cron expression represents a set of times, using 5 space-separated fields.
2020-02-08 17:00:39 -08:00
| Field name | Mandatory? | Allowed values | Allowed special characters |
| ------------ | ---------- | --------------- | -------------------------- |
| Minutes | Yes | 0-59 | * / , - |
| Hours | Yes | 0-23 | * / , - |
| Day of month | Yes | 1-31 | * / , - ? |
| Month | Yes | 1-12 or JAN-DEC | * / , - |
| Day of week | Yes | 0-6 or SUN-SAT | * / , - ? |
2020-02-09 02:51:30 +03:00
2020-02-08 17:00:39 -08:00
Month and Day-of-week field values are case insensitive. `SUN` , `Sun` , and `sun` are equally accepted.
2020-02-09 02:51:30 +03:00
The specific interpretation of the format is based on the Cron Wikipedia page: https://en.wikipedia.org/wiki/Cron
2020-02-08 17:00:39 -08:00
#### Predefined schedules
2020-02-09 02:51:30 +03:00
You may use one of several pre-defined schedules in place of a cron expression.
2020-02-08 17:00:39 -08:00
| Entry | Description | Equivalent to |
| ----------------------- | -------------------------------------------| ------------- |
| `@monthly` | Run once a month, midnight, first of month | `0 0 1 * *` |
| `@weekly` | Run once a week, midnight between Sat/Sun | `0 0 * * 0` |
| `@daily (or @midnight)` | Run once a day, midnight | `0 0 * * *` |
| `@hourly` | Run once an hour, beginning of hour | `0 * * * *` |
2020-02-09 02:51:30 +03:00
2020-02-08 17:00:39 -08:00
#### Intervals
2020-02-09 02:51:30 +03:00
You may also schedule a job to execute at fixed intervals, starting at the time it's added
or cron is run. This is supported by formatting the cron spec like this:
@every < duration >
where "duration" is a string accepted by [time.ParseDuration ](http://golang.org/pkg/time/#ParseDuration ).
2020-02-08 17:00:39 -08:00
For example, `@every 1h30m10s` would indicate a schedule that activates after 1 hour, 30 minutes, 10 seconds, and then every interval after that.
2019-11-13 21:14:52 -08:00
2019-12-13 19:30:36 -08:00
## One click deployment
[![Deploy to AWS ](https://s3.amazonaws.com/cloudformation-examples/cloudformation-launch-stack.png )](https://console.aws.amazon.com/cloudformation/home?region=us-west-1#/stacks/new ?stackName=Podsync& templateURL=https://podsync-cf.s3.amazonaws.com/cloud_formation.yml)
2019-11-13 21:14:52 -08:00
## How to run
2020-02-09 02:51:30 +03:00
### Run as binary:
2019-11-13 21:14:52 -08:00
```
$ ./podsync --config config.toml
```
2020-02-09 02:51:30 +03:00
### Run via Docker:
2019-11-13 21:14:52 -08:00
```
$ docker pull mxpv/podsync:latest
$ docker run \
-p 8080:8080 \
-v $(pwd)/data:/app/data/ \
-v $(pwd)/config.toml:/app/config.toml \
mxpv/podsync:latest
```
2020-02-09 02:51:30 +03:00
### Run via Docker Compose:
2019-11-13 21:14:52 -08:00
```
$ docker-compose up
```
## How to make a release
2019-11-13 20:43:47 -08:00
2020-04-13 17:33:03 -07:00
Just push a git tag. CI will do the rest.