@mkyral @fabia_man @smoon Diky za doporuceni. Ja doporucim tohle (jmena kanalu na konci).
#!/usr/bin/python3
# ytcc?
# smtube?
# scp ~/bin/periodic-yt.py pavel@jabberwock.ucw.cz:~/incoming
# cd /data/film/yt
# find perun/ 8bit/ svine/ usagi/ ac-* vas-av/ blancolirio/ veteran/ veritasium/ spacetime/
# for A in .done.*; do echo 20240804 > $A; done
# sed -i s/20241210/20241205/ .done.*
import os
import subprocess
import datetime
import time
class YT:
def run(m, v, d):
# -r 3k
#~/bin/youtube-dl -f 'best[height<=480][abr<=64]' $1
#~/bin/youtube-dl -f 'worst[height>=480]' $1
#youtube-dl -f 'bestvideo[height<=720]/best[height<=720]' $1
#format = [ "-f", "worst" ]
#format = [ "-f", "best" ]
#format = []
#format = [ "-f", "worst[height>=1080],best" ]
#cmd = ["youtube-dl"] + format + v
# , "-q" -- quiet
cmd = ["yt"] + v
print(cmd)
subprocess.run(cmd, cwd=d)
#time.sleep(120)
def channel(m, url, name, num=1):
days = 1
num = num*days+2
url = "https://www.youtube.com"+url
done = '.done.'+name
if not os.path.exists(name):
os.mkdir(name)
start_date = "20220826"
if os.path.exists(done):
start_date = open(done, "r").readline()
now = datetime.datetime.now()
end_date = str(now.strftime("%Y%02m%02d"))
print("Start: ", start_date, " end: ", end_date)
m.run(["--dateafter", start_date, "--datebefore", end_date, "--playlist-end", "%d" % num, url], name)
open(done, "w").write(end_date)
#os.chdir(os.getenv("HOME")+"/incoming/yt/")
os.chdir("/data/film/yt/")
y = YT()
#g("https://www.youtube.com/watch?v=ykS6gUmcccI")
y.channel("/channel/UCF92X9gUd9m9XyFByej0UWA/videos", "svine")
y.channel("/channel/UCC3ehuUksTyQ7bbjGntmx3Q/videos", "perun")
y.channel("/@CombatVeteranReacts/videos", "veteran", 4)
#y.channel("/@europeancults/videos", "nabozenstvi")
y.channel("/@svetovanabozenstvi/videos", "nabozenstvi", 4)
y.channel("/@RFU/videos", "rfu")
y.channel("/@ReportazezUkrajiny/videos", "crfu")
y.channel('/@Gametheory101/videos', 'game101')
#y.channel('/@icarusproject/videos', 'icarus')
y.channel("/c/pbsspacetime/videos?ucbcb=1", "spacetime")
y.channel("/@SteveMould/videos", "sm")
y.channel("/c/veritasium/videos", "veritasium")
y.channel('/@3blue1brown/videos', "3blue")
#y.channel('/@Sideprojects/videos', 'side')
y.channel('/@MarkRober/videos', 'mrober')
y.channel('/@xkcd_whatif/videos', 'xkcd')
y.channel("/user/adric22?ucbcb=1", "8bit")
y.channel('/@UsagiElectric/videos', "usagi")
y.channel('/@TheLinuxEXP/videos', "lexp")
y.channel('/@RealEngineering/videos', 're')
y.channel('/@CleoAbram/videos', 'cleo')
y.channel("/@MentourNow/videos", "mentour2")
y.channel("/c/MentourPilotaviation/videos", "mentour")
y.channel("/user/blancolirio/videos?view=0&sort=dd&shelf_id=0f", "blancolirio")
y.channel("/c/theflightchannel/videos", "ac-flight")
y.channel("/c/VASAviation/videos", "vas-av")
y.channel("/c/MiniAirCrashInvestigation/videos", "ac-miniair")
y.channel("/c/AllecJoshuaIbay/videos", "ac-yoshua")
#fix!
y.channel("/c/DisasterBreakdown/videos", "ac-disaster")
y.channel("/@VivaLaDirtLeague/videos", "vivala")
os.system("date")