Skip Navigation

User banner
InitialsDiceBearhttps://github.com/dicebear/dicebearhttps://creativecommons.org/publicdomain/zero/1.0/„Initials” (https://github.com/dicebear/dicebear) by „DiceBear”, licensed under „CC0 1.0” (https://creativecommons.org/publicdomain/zero/1.0/)G
Posts
1
Comments
136
Joined
2 yr. ago

  • “Give me a Python script using yt-dlp that I can run on a cronjob that will download the videos from any of my subscribed channels since the last time the script was run”

    You can use the following Python script to download videos from your subscribed channels since the last run. This script uses yt-dlp and stores the last download timestamp to track new videos.

    First, ensure you have yt-dlp installed:

     bash
        
    pip install yt-dlp
    
      

    Then, create a script called download_videos.py:

     python
        
    import os
    import json
    import subprocess
    from datetime import datetime
    
    # Configuration
    last_run_file = 'last_run.json'
    download_directory = 'downloads'
    
    # Ensure the download directory exists
    os.makedirs(download_directory, exist_ok=True)
    
    # Load the last run time
    if os.path.exists(last_run_file):
        with open(last_run_file, 'r') as f:
            last_run = json.load(f)['last_run']
    else:
        last_run = datetime.now().isoformat()
    
    # Update the last run time to now
    current_run = datetime.now().isoformat()
    
    # Command to get videos from subscribed channels since the last run
    command = [
        'yt-dlp',
        '--download-archive', 'archive.txt',
        '--output', f'{download_directory}/%(title)s.%(ext)s',
        '--date-after', last_run,
        '--no-post-overwrites',
        '--merge-output-format', 'mp4',
        'https://www.youtube.com/channel/CHANNEL_ID',  # Replace with your channel URL
    ]
    
    # Run the command
    subprocess.run(command)
    
    # Save the current run time
    with open(last_run_file, 'w') as f:
        json.dump({'last_run': current_run}, f)
    
    print("Download complete. Next run will check for videos since:", current_run)
    
      

    Setting Up the Cron Job

    1. Make the script executable:
       bash
          
      chmod +x download_videos.py
      
      
        
    2. Open your crontab:
       bash
          
      crontab -e
      
      
        
    3. Add a line to run the script at your desired interval (e.g., daily at 2 AM):
       bash
          
      0 2 * * * /path/to/python /path/to/download_videos.py
      
        

    Notes

    • Replace CHANNEL_ID in the script with your actual channel IDs or use a playlist URL if preferred.
    • The archive.txt file keeps track of already downloaded videos to avoid duplicates.
    • Adjust the paths to Python and your script as needed.
  • Well you know what they say “Great minds think quicker than mine and probably have already had that thought.”

  • Donate to the EFF for fighting that fight in court already.

  • Yes but literally throwing together a script to download the days subscription videos to a jellyfin media drive would be stupidly simple.

  • The design has absolutely not “definitely” improved.

  • Any time anyone is able to claw back some scraps of justice or get some kind of recompense for wrongs or - here’s a big one - change the law: that’s lawyers too. The characterization of all lawyers as sharks and assholes has done more to exacerbate the justice gap then help.

  • Deleted

    deleted by creator

    Jump
  • Any idea if it’s self host able if it’s open source?

  • I’d probably go Python but I’m an idiot

  • Someone made an app using the OpenAI api, offered it for “free”, and scooped a bunch of users conversations (sort of. 89k isn’t that large) before getting shut down. That’s not at all what you were alleging.

  • That’s… not true at all.

  • Patently not true

  • RIP

  • Seems bad, man.

  • Who makes better?

  • Yeah, right? Gooooood luck telling, idk, my uncle to do that. He’s approaching seventy but uses drones as a hobbyist photographer and to do the occasional surveying for work. He’s not going to be able to “lol just build your own”. And afaik there’s nothing remotely competitive by us manufacturers