skip premium videos, clean exit for empty bulk_list, #237
This commit is contained in:
parent
9a2b29c2ae
commit
94fa191fb8
|
@ -219,10 +219,11 @@ class PendingList(PendingIndex):
|
||||||
thumb_handler.download_vid(thumb_needed)
|
thumb_handler.download_vid(thumb_needed)
|
||||||
self._notify_add(idx)
|
self._notify_add(idx)
|
||||||
|
|
||||||
# add last newline
|
if bulk_list:
|
||||||
bulk_list.append("\n")
|
# add last newline
|
||||||
query_str = "\n".join(bulk_list)
|
bulk_list.append("\n")
|
||||||
_, _ = ElasticWrap("_bulk").post(query_str, ndjson=True)
|
query_str = "\n".join(bulk_list)
|
||||||
|
_, _ = ElasticWrap("_bulk").post(query_str, ndjson=True)
|
||||||
|
|
||||||
def _notify_add(self, idx):
|
def _notify_add(self, idx):
|
||||||
"""send notification for adding videos to download queue"""
|
"""send notification for adding videos to download queue"""
|
||||||
|
@ -246,7 +247,11 @@ class PendingList(PendingIndex):
|
||||||
try:
|
try:
|
||||||
vid = yt_dlp.YoutubeDL(self.yt_obs).extract_info(youtube_id)
|
vid = yt_dlp.YoutubeDL(self.yt_obs).extract_info(youtube_id)
|
||||||
except yt_dlp.utils.DownloadError:
|
except yt_dlp.utils.DownloadError:
|
||||||
print("failed to extract info for: " + youtube_id)
|
print(f"{youtube_id}: failed to extract info")
|
||||||
|
return False
|
||||||
|
if vid.get("id") != youtube_id:
|
||||||
|
# skip premium videos with different id
|
||||||
|
print(f"{youtube_id}: skipping premium video, id not matching")
|
||||||
return False
|
return False
|
||||||
# stop if video is streaming live now
|
# stop if video is streaming live now
|
||||||
if vid["is_live"]:
|
if vid["is_live"]:
|
||||||
|
|
Loading…
Reference in New Issue