Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repaired Fatal Error for Nonexistent URLs #301

Merged
merged 3 commits into from
Aug 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions tubeup/TubeUp.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,18 @@ def check_if_ia_item_exists(infodict):
return 1
return 0

def ydl_progress_each(url, entry):
if not entry:
self.logger.warning('Video "%s" is not available. Skipping.' % url)
return
if ydl.in_download_archive(entry):
return
if check_if_ia_item_exists(entry) == 0:
ydl.extract_info(url)
downloaded_files_basename.update(self.create_basenames_from_ydl_info_dict(ydl, entry))
else:
ydl.record_download_archive(entry)

def ydl_progress_hook(d):
if d['status'] == 'downloading' and self.verbose:
if d.get('_total_bytes_str') is not None:
Expand Down Expand Up @@ -171,21 +183,9 @@ def ydl_progress_hook(d):

if info_dict.get('_type', 'video') == 'playlist':
for entry in info_dict['entries']:
if ydl.in_download_archive(entry):
continue
if check_if_ia_item_exists(entry) == 0:
ydl.extract_info(entry['webpage_url'])
downloaded_files_basename.update(self.create_basenames_from_ydl_info_dict(ydl, entry))
else:
ydl.record_download_archive(entry)
ydl_progress_each(entry['webpage_url'], entry)
else:
if ydl.in_download_archive(info_dict):
continue
if check_if_ia_item_exists(info_dict) == 0:
ydl.extract_info(url)
downloaded_files_basename.update(self.create_basenames_from_ydl_info_dict(ydl, info_dict))
else:
ydl.record_download_archive(info_dict)
ydl_progress_each(url, info_dict)
else:
info_dict = ydl.extract_info(url)
downloaded_files_basename.update(self.create_basenames_from_ydl_info_dict(ydl, info_dict))
Expand Down