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") logging.debug("downloading video from twitter")
import youtube_dl 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: if video_path is not None:
video_file = urljoin(nitter_url, video_path) video_file = urljoin(nitter_url, video_path)
ydl_opts = { ydl_opts = {
@ -693,6 +695,10 @@ def process_attachments(nitter_url, attachments_container, status_id, author_acc
else: else:
logging.debug('downloaded twitter video from attachments') logging.debug('downloaded twitter video from attachments')
else: else:
logging.debug("Media is unavailable")
vid_in_tweet = True
else:
logging.debug("Media is unavailable")
vid_in_tweet = True vid_in_tweet = True
return pics, vid_in_tweet return pics, vid_in_tweet
@ -1057,7 +1063,7 @@ def main(argv):
status_id, author_account) status_id, author_account)
photos.extend(pics) photos.extend(pics)
if vid_in_tweet: 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 # Add custom footer from config file
if TOML['options']['footer'] != '': if TOML['options']['footer'] != '':