Giter Club home page Giter Club logo

boosty-downloader's Introduction

Boosty Downloader

This simple shell script downloads videos from Boosty using yt-dlp. Designed to be used as scheduled job to download new videos and make them available in Plex.

Prerequisites

  1. Dependencies: curl bash coreutils sed jq sendmail

  2. A last version of yt-dlp is needed:

# install latest yt-dlp using pip in virtual environment
mkdir -p /srv/yt-dlp
cd /srv/yt-dlp
apt install python3-venv
python3 -m venv .
./bin/pip3 install yt-dlp

# update existing yt-dlp (if was already installed)
./bin/pip3 install --upgrade yt-dlp

# check version of installed yt-dlp to be 2024.03.10+
./bin/yt-dlp --version

# for convinience, create symlink in search path
ln -sf /srv/yt-dlp/bin/yt-dlp /usr/local/bin/yt-dlp

# update shell search path and check version again
hash -r
yt-dlp --version
  1. Cookies file

Use browser plugion to do to dump boosty.to cookies into boosty.cookies.txt (authenticate before):

Installation

cd /srv
git clone https://github.com/sormy/boosty-downloader.git
ln -sfv /srv/boosty-downloader/boosty-downloader /usr/local/bin/boosty-downloader

Usage

export COOKIES_FILE="/srv/boosty.cookies.txt"
export TARGET_PATH="/media/MediaFiles/Boosty"
export CHANNELS="blog1 blog2 blog3"
# if boosty support will be merged into upstream
# export YT_DLP="yt-dlp"
boosty-downloader

Service

Create service unit:

nano /etc/systemd/system/boosty-downloader.service

[Unit]
Wants=boosty-downloader.timer

[Service]
Type=oneshot
User=root
Environment="YT_DLP=/usr/local/bin/yt-dlp"
Environment="COOKIES_FILE=/srv/boosty.cookies.txt"
Environment="TARGET_PATH=/media/MediaFiles/Boosty"
Environment="TEMP_PATH=/media/MediaFiles/Boosty.tmp"
Environment="CHANNELS=blog1 blog2 blog3"
Environment="[email protected]"
ExecStart=boosty-downloader

[Install]
WantedBy=multi-user.target

Create timer unit:

nano /etc/systemd/system/boosty-downloader.timer

[Unit]
Requires=boosty-downloader.service

[Timer]
Unit=boosty-downloader.service
OnCalendar=hourly

[Install]
WantedBy=timers.target
# reload units
systemctl daemon-reload
# try to start once
systemctl start boosty-downloader
# check status and logs
systemctl status boosty-downloader
journalctl -u boosty-downloader
# if all is ok, enable timer
systemctl enable boosty-downloader.timer

Plex rescan

Login to Plex console, open debug console, open local storage and grab value of "myPlexAccessToken".

Find section IDs:

curl -L -X GET 'http://localhost:32400/library/sections' \
    -H 'Accept: application/json' \
    -H 'X-Plex-Token: <TOKEN>' \
    | jq '.MediaContainer.Directory[] | { key: .key, title: .title }'

Edit boosty-downloader.service:

nano /etc/systemd/system/boosty-downloader.service

[Service]
...
Environment="PLEX_SECTION=<PLEX_SECTION_ID>"
Environment="PLEX_TOKEN=<PLEX_TOKEN>"
# see more https://support.plex.tv/articles/201638786-plex-media-server-url-commands/
ExecStartPost=curl -sS -L -X GET \
    'http://localhost:32400/library/sections/${PLEX_SECTION}/refresh' \
    -H 'X-Plex-Token: ${PLEX_TOKEN}'

Jellyfin rescan

Login to Jellyfin console, open settings and create new api key.

Find item IDs:

curl -sS -L -X GET -G \
    "http://localhost:8096/Items" \
    -H 'Authorization: MediaBrowser Token=<JELLYFIN_API_KEY>' \
    -d 'Recursive=True' \
    -d 'IncludeItemTypes=CollectionFolder' \
    | jq '.Items[] | { id: .Id, name: .Name }'

Edit boosty-downloader.service:

nano /etc/systemd/system/boosty-downloader.service

[Service]
...
Environment="JELLYFIN_ITEM=<JELLYFIN_ITEM_ID>"
Environment="JELLYFIN_TOKEN=<JELLYFIN_API_KEY>"
# see more https://api.jellyfin.org/#tag/ItemRefresh/operation/RefreshItem
ExecStartPost=curl -sS -L -X POST \
    'http://localhost:8096/Items/${JELLYFIN_ITEM}/Refresh' \
    -H 'Authorization: MediaBrowser Token="${JELLYFIN_TOKEN}"' \
    -d 'Recursive=true' \
    -d 'MetadataRefreshMode=Default' \
    -d 'ImageRefreshMode=Default' \
    -d 'ReplaceAllImages=false' \
    -d 'ReplaceAllMetadata=false'

boosty-downloader's People

Contributors

sormy avatar

Stargazers

Dragoy avatar Kirby avatar Sergey Ko avatar  avatar Nikita Artikhovich avatar

Watchers

 avatar  avatar

boosty-downloader's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.