135 lines
4.7 KiB
Markdown
135 lines
4.7 KiB
Markdown
# subsyt
|
|
|
|
## config
|
|
|
|
`config.toml`:
|
|
|
|
```toml
|
|
dry_run = true # set to `false` for real run
|
|
out_dir = "./vids" # path to archive vids
|
|
|
|
[provider]
|
|
[provider.youtube]
|
|
cmd = "./yt-dlp" # path to yt-dlp binary
|
|
quality = "res:1080" # set the preferred quality
|
|
output_path_template = "s%(upload_date>%Y)s/%(channel)s.s%(upload_date>%Y)Se%(upload_date>%m%d)S.%(title)s.%(id)s-1080p.%(ext)s" # yt-dlp output template
|
|
url = "https://www.youtube.com" # full yt url
|
|
throttle = 5 # throttle yt request, 5s works well
|
|
range = "1:5:1" # downloads last 5 videos: [START][:STOP][:STEP]
|
|
after_date = "20250326" # only download videos after date
|
|
cookies_file = "" # pass user cookies to yt, blank to disable
|
|
opml_file = "./opml.xml" # the opml file to use
|
|
```
|
|
|
|
`subs-opml.xml`:
|
|
|
|
```xml
|
|
<?xml version="1.0"?>
|
|
<opml version="1.1">
|
|
<body>
|
|
<outline ...>
|
|
<outline text="" title="" xmlUrl="" .../>
|
|
<outline text="" title="" xmlUrl="" .../>
|
|
<outline text="" title="" xmlUrl="" .../>
|
|
</outline>
|
|
<outline ...>
|
|
<outline text="" title="" xmlUrl="" .../>
|
|
<outline text="" title="" xmlUrl="" .../>
|
|
<outline text="" title="" xmlUrl="" .../>
|
|
</outline>
|
|
</body>
|
|
</opml>
|
|
```
|
|
|
|
## build
|
|
|
|
```sh
|
|
CGO_ENABLED=0 go build
|
|
```
|
|
|
|
## Cookies
|
|
|
|
> [!WARNING]
|
|
> Your account **MAY** be banned when using cookies !
|
|
|
|
E.g. from Chromium:
|
|
|
|
```
|
|
yt-dlp --cookies-from-browser chromium --cookies cookies.txt
|
|
```
|
|
|
|
## Scheduling
|
|
|
|
### systemd
|
|
|
|
`~/.config/systemd/user/subsyt-archival.service`
|
|
```
|
|
[Unit]
|
|
Description=subsyt archival of yt subscribtions
|
|
|
|
[Service]
|
|
Type=oneshot
|
|
ExecStart=/home/varl/yt/yt-dlp -U
|
|
ExecStart=/home/varl/yt/subsyt
|
|
WorkingDirectory=/home/varl/yt
|
|
|
|
```
|
|
|
|
`~/.config/systemd/user/subsyt-archival.timer`
|
|
```
|
|
[Unit]
|
|
Description=subsyt archival on boot and daily
|
|
|
|
[Timer]
|
|
OnCalendar=*-*-* 4:00:00
|
|
Persistent=true
|
|
AccuracySec=1us
|
|
RandomizedDelaySec=30
|
|
|
|
[Install]
|
|
WantedBy=timers.target
|
|
```
|
|
|
|
## Container
|
|
|
|
```
|
|
podman run --rm \
|
|
--env='CONFIG=/data/config.toml' \
|
|
--volume=path/to/config:/data/config.toml \
|
|
--volume=path/to/opml:/data/opml.xml \
|
|
--volume=path/to/cookies:/data/cookies.txt
|
|
registry.meatbag.se/varl/subsyt
|
|
```
|
|
|
|
## Result
|
|
|
|
```
|
|
.
|
|
├── Technology Connextras
|
|
│ ├── archive.txt
|
|
│ ├── fanart.jpg
|
|
│ ├── poster.jpg
|
|
│ ├── s2024
|
|
│ │ ├── Technology_Connextras.s2024e0611.Connextras_dishwasher_follow_up_the_sequel.0Kp3bjm55xw-1080p-thumb.jpg
|
|
│ │ ├── Technology_Connextras.s2024e0611.Connextras_dishwasher_follow_up_the_sequel.0Kp3bjm55xw-1080p.nfo
|
|
│ │ ├── Technology_Connextras.s2024e0611.Connextras_dishwasher_follow_up_the_sequel.0Kp3bjm55xw-1080p.webm
|
|
│ │ ├── Technology_Connextras.s2024e0712.Here_s_what_Numitron_tubes_in_an_actual_product_look_like.XgzL05Gojfw-1080p-thumb.jpg
|
|
│ │ ├── Technology_Connextras.s2024e0712.Here_s_what_Numitron_tubes_in_an_actual_product_look_like.XgzL05Gojfw-1080p.nfo
|
|
│ │ ├── Technology_Connextras.s2024e0712.Here_s_what_Numitron_tubes_in_an_actual_product_look_like.XgzL05Gojfw-1080p.webm
|
|
│ │ ├── Technology_Connextras.s2024e0909.Answering_your_pinball_questions_-_Williams_Aztec_Q_A.P3Y4d2aHnNE-1080p-thumb.jpg
|
|
│ │ ├── Technology_Connextras.s2024e0909.Answering_your_pinball_questions_-_Williams_Aztec_Q_A.P3Y4d2aHnNE-1080p.nfo
|
|
│ │ └── Technology_Connextras.s2024e0909.Answering_your_pinball_questions_-_Williams_Aztec_Q_A.P3Y4d2aHnNE-1080p.webm
|
|
│ ├── s2025
|
|
│ │ ├── Technology_Connextras.s2025e0330.Renewable_energy_means_we_can_stop_setting_money_on_fire_silly_billy.Y2qSaD1v4cQ-1080p-thumb.jpg
|
|
│ │ ├── Technology_Connextras.s2025e0330.Renewable_energy_means_we_can_stop_setting_money_on_fire_silly_billy.Y2qSaD1v4cQ-1080p.nfo
|
|
│ │ ├── Technology_Connextras.s2025e0330.Renewable_energy_means_we_can_stop_setting_money_on_fire_silly_billy.Y2qSaD1v4cQ-1080p.webm
|
|
│ │ ├── Technology_Connextras.s2025e0331.An_unplanned_trip_from_Chicago_to_Milwaukee_in_an_electric_car.3GUQdrpduo0-1080p-thumb.jpg
|
|
│ │ ├── Technology_Connextras.s2025e0331.An_unplanned_trip_from_Chicago_to_Milwaukee_in_an_electric_car.3GUQdrpduo0-1080p.nfo
|
|
│ │ └── Technology_Connextras.s2025e0331.An_unplanned_trip_from_Chicago_to_Milwaukee_in_an_electric_car.3GUQdrpduo0-1080p.webm
|
|
│ └── tvshow.nfo
|
|
```
|
|
|
|
## Generate OPML
|
|
|
|
E.g. https://github.com/jeb5/YouTube-Subscriptions-RSS
|