skip video if is_live now

This commit is contained in:
simon 2021-10-17 10:49:02 +07:00
parent 63be6afcfe
commit 1a88c85436

View File

@ -80,7 +80,6 @@ class PendingList:
# skip already downloaded # skip already downloaded
continue continue
video = self.get_youtube_details(youtube_id) video = self.get_youtube_details(youtube_id)
thumb_url = video["vid_thumb_url"]
# skip on download error # skip on download error
if not video: if not video:
continue continue
@ -89,6 +88,7 @@ class PendingList:
video["channel_indexed"] = True video["channel_indexed"] = True
else: else:
video["channel_indexed"] = False video["channel_indexed"] = False
thumb_url = video["vid_thumb_url"]
video["status"] = "pending" video["status"] = "pending"
action = {"create": {"_id": youtube_id, "_index": "ta_download"}} action = {"create": {"_id": youtube_id, "_index": "ta_download"}}
bulk_list.append(json.dumps(action)) bulk_list.append(json.dumps(action))
@ -126,6 +126,9 @@ class PendingList:
except youtube_dl.utils.DownloadError: except youtube_dl.utils.DownloadError:
print("failed to extract info for: " + youtube_id) print("failed to extract info for: " + youtube_id)
return False return False
# stop if video is streaming live now
if vid["is_live"]:
return False
# parse response # parse response
seconds = vid["duration"] seconds = vid["duration"]
duration_str = DurationConverter.get_str(seconds) duration_str = DurationConverter.get_str(seconds)