this post was submitted on 22 Sep 2024
710 points (98.4% liked)

Technology

60062 readers
4459 users here now

This is a most excellent place for technology news and articles.


Our Rules


  1. Follow the lemmy.world rules.
  2. Only tech related content.
  3. Be excellent to each another!
  4. Mod approved content bots can post up to 10 articles per day.
  5. Threads asking for personal tech support may be deleted.
  6. Politics threads may be removed.
  7. No memes allowed as posts, OK to post as comments.
  8. Only approved bots from the list below, to ask if your bot can be added please contact us.
  9. Check for duplicates before posting, duplicates may be removed

Approved Bots


founded 2 years ago
MODERATORS
 

cross-posted from: https://discuss.tchncs.de/post/22423685

EDIT: For those who are too lazy to click the link, this is what it says

Hello,

Sad news for everyone. YouTube/Google has patched the latest workaround that we had in order to restore the video playback functionality.

Right now we have no other solutions/fixes. You may be able to get Invidious working on residential IP addresses (like at home) but on datacenter IP addresses Invidious won't work anymore.

If you are interested to install Invidious at home, we remind you that we have a guide for that here: https://docs.invidious.io/installation/..

This is not the death of this project. We will still try to find new solutions, but this might take time, months probably.

I have updated the public instance list in order to reflect on the working public instances: https://instances.invidious.io. Please don't abuse them since the number is really low.

Feel free to discuss this politely on Matrix or IRC.

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 2 points 2 months ago* (last edited 2 months ago) (1 children)

Another example, which i can personally verify has been working fine for months. It works a bit different to the above, it downloads the latests 2* vids that are not already downloaded and runs once every hour with cron. I also attempted to filter out live vids and shorts.

Channels i am "subscribed" too are stored in a single text file, it also uses the avc1 codec because i found p9 and p10 had issues with the jellyfin client on my tv.

looks like this, i added categories but i don't actually use them in the script besides putting them in a variable, lol. Vid-limit is how many of the latests vids it should look at to download. The original reason i implemented that is so i could selectively download a bulk of latests vids if i wanted to.

Cat=Science
Name=Vertitasium
VidLimit=2
URL=https://www.youtube.com/channel/UCHnyfMqiRRG1u-2MsSQLbXA

Cat=Minecraft
Name=EthosLab
VidLimit=2
URL=https://www.youtube.com/channel/UCFKDEp9si4RmHFWJW1vYsMA
#!/bin/bash


# Define the directory to store channel lists and scripts
script_dir="/.../YTDL"

# Define the base directory to store downloaded videos
base_download_dir="/.../youtubevids"

# Change to the script directory
cd "$script_dir"

# Parse the Channels.txt file and process each channel
awk -F'=' '
  /^Cat/ {Cat=$2}
  /^Name/ {Name=$2}
  /^VidLimit/ {VidLimit=$2}
  /^URL/ {URL=$2; print Cat, Name, VidLimit, URL}
' "$script_dir/Channels.txt" | while read -r Cat Name VidLimit URL; do
    # Define the download directory for this channel
    download_dir="$base_download_dir"
    
    # Define the download archive file for this channel
    archive_file="$script_dir/DLarchive$Name.txt"
    
    # Create the download directory if it does not exist
    mkdir -p "$download_dir"
    
    # If VidLimit is "ALL", set playlist_end option to empty, otherwise set it to --playlist-end <VidLimit>
    playlist_end_option=""
    if [[ $VidLimit != "ALL" ]]; then
        playlist_end_option="--playlist-end $VidLimit"
    fi
yt-dlp \
        --download-archive "$archive_file" \
        $playlist_end_option \
        --write-description \
        --write-thumbnail \
        --convert-thumbnails jpg \
        --add-metadata \
        --embed-thumbnail \
        --match-filter "!is_live & !was_live & original_url!*=/shorts/" \
        --merge-output-format mp4 \
        --format "bestvideo[vcodec^=avc1]+bestaudio[ext=m4a]/best[ext=mp4]/best" \
        --output "$download_dir/${Name} - %(title)s.%(ext)s" \
        "$URL"
        
done
[–] [email protected] 1 points 2 months ago (1 children)

Yeah this is more elegant and closer to what I’d actually want to implement. I was more just showing what could be done in literally thirty seconds on the can with ChatGPT.

[–] [email protected] 1 points 2 months ago

I knew i recognized that output.

Mine is actually also made with the help of Chatgpt but manually refined and tested.