From d0ef6eeae2cc2538a96ce3ba3fa7111612c29220 Mon Sep 17 00:00:00 2001 From: tech234a <46801700+tech234a@users.noreply.github.com> Date: Wed, 23 Sep 2020 23:04:25 -0400 Subject: [PATCH] Improve youtube-dl handling --- tracker.py | 2 +- worker.py | 18 ++++++++---------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/tracker.py b/tracker.py index c457ea3..b5bd685 100644 --- a/tracker.py +++ b/tracker.py @@ -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" diff --git a/worker.py b/worker.py index a686a7e..3454033 100644 --- a/worker.py +++ b/worker.py @@ -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: