Browse Source

Improve youtube-dl handling

microtasks
tech234a 3 years ago
parent
commit
d0ef6eeae2
2 changed files with 9 additions and 11 deletions
  1. +1
    -1
      tracker.py
  2. +8
    -10
      worker.py

+ 1
- 1
tracker.py View File

@@ -9,7 +9,7 @@ from os.path import isfile
from json import loads

# https://github.com/ArchiveTeam/tencent-weibo-grab/blob/9bae5f9747e014db9227821a9c11557267967023/pipeline.py
VERSION = "20200923.04"
VERSION = "20200923.05"

TRACKER_ID = "ext-yt-communitycontribs"
TRACKER_HOST = "trackerproxy.meo.ws"


+ 8
- 10
worker.py View File

@@ -158,24 +158,22 @@ def threadrunner(jobs: Queue):
while True:
try:
y = ydl.extract_info("https://www.youtube.com/channel/"+desit.split(":", 1)[1], download=False)
for itemyv in y["entries"]:
jobs.put(("submitdiscovery", itemyv["id"], tracker.ItemType.Video))
jobs.put(("complete", None, "channel:"+args))
break
except:
print("YouTube-DL error, waiting 30 seconds...")
sleep(30)
for itemyv in y["entries"]:
jobs.put(("submitdiscovery", itemyv["id"], tracker.ItemType.Video))
jobs.put(("complete", None, "channel:"+args))
print("YouTube-DL error, ignoring but not marking as complete...")
elif task == "playlist":
while True:
try:
y = ydl.extract_info("https://www.youtube.com/playlist?list="+desit.split(":", 1)[1], download=False)
for itemyvp in y["entries"]:
jobs.put(("submitdiscovery", itemyvp["id"], tracker.ItemType.Video))
jobs.put(("complete", None, "playlist:"+args))
break
except:
print("YouTube-DL error, waiting 30 seconds...")
sleep(30)
for itemyvp in y["entries"]:
jobs.put(("submitdiscovery", itemyvp["id"], tracker.ItemType.Video))
jobs.put(("complete", None, "playlist:"+args))
print("YouTube-DL error, ignoring but not marking as complete...")
elif task == "complete":
size = 0
if ":" in args:


Loading…
Cancel
Save