Improve detection of missing video

This commit is contained in:
jeancf 2023-07-22 09:56:54 +02:00
parent e512838a0e
commit b69ac01b3c

View File

@ -674,7 +674,9 @@ def process_attachments(nitter_url, attachments_container, status_id, author_acc
logging.debug("downloading video from twitter")
import youtube_dl
video_path = vid_container.source['src']
video_path_source = vid_container.source
if video_path_source is not None:
video_path = video_path_source['src']
if video_path is not None:
video_file = urljoin(nitter_url, video_path)
ydl_opts = {
@ -693,6 +695,10 @@ def process_attachments(nitter_url, attachments_container, status_id, author_acc
else:
logging.debug('downloaded twitter video from attachments')
else:
logging.debug("Media is unavailable")
vid_in_tweet = True
else:
logging.debug("Media is unavailable")
vid_in_tweet = True
return pics, vid_in_tweet
@ -1057,7 +1063,7 @@ def main(argv):
status_id, author_account)
photos.extend(pics)
if vid_in_tweet:
tweet_text += '\n\n[Video embedded in original tweet]'
tweet_text += '\n\n[Video is unavailable]'
# Add custom footer from config file
if TOML['options']['footer'] != '':