mirror of https://gitlab.com/bashrc2/epicyon
Less indentation
parent
8ca03c3e20
commit
0aec071dea
|
@ -114,7 +114,7 @@ def _is_twitter_post(content: str) -> bool:
|
||||||
"""
|
"""
|
||||||
features = (
|
features = (
|
||||||
'/x.com', '/twitter.', '/nitter.',
|
'/x.com', '/twitter.', '/nitter.',
|
||||||
'@twitter.', '@nitter.','@x.com',
|
'@twitter.', '@nitter.', '@x.com',
|
||||||
'>RT <', '_tw<', '_tw@', 'tweet', 'Tweet', '🐦🔗'
|
'>RT <', '_tw<', '_tw@', 'tweet', 'Tweet', '🐦🔗'
|
||||||
)
|
)
|
||||||
for feat in features:
|
for feat in features:
|
||||||
|
|
72
utils.py
72
utils.py
|
@ -5306,42 +5306,44 @@ def get_media_url_from_video(post_json_object: {}) -> (str, str, str, str):
|
||||||
media_url = None
|
media_url = None
|
||||||
media_torrent = None
|
media_torrent = None
|
||||||
media_magnet = None
|
media_magnet = None
|
||||||
if post_json_object.get('url'):
|
if not post_json_object.get('url'):
|
||||||
if isinstance(post_json_object['url'], list):
|
return media_type, media_url, media_torrent, media_magnet
|
||||||
for media_link in post_json_object['url']:
|
if not isinstance(post_json_object['url'], list):
|
||||||
if not isinstance(media_link, dict):
|
return media_type, media_url, media_torrent, media_magnet
|
||||||
|
for media_link in post_json_object['url']:
|
||||||
|
if not isinstance(media_link, dict):
|
||||||
|
continue
|
||||||
|
if not media_link.get('mediaType'):
|
||||||
|
continue
|
||||||
|
if not media_link.get('href'):
|
||||||
|
continue
|
||||||
|
if media_link.get('tag'):
|
||||||
|
media_tags = media_link['tag']
|
||||||
|
if isinstance(media_tags, list):
|
||||||
|
for tag_link in media_tags:
|
||||||
|
if not isinstance(tag_link, dict):
|
||||||
|
continue
|
||||||
|
if not tag_link.get('mediaType'):
|
||||||
|
continue
|
||||||
|
if not tag_link.get('href'):
|
||||||
|
continue
|
||||||
|
if tag_link['mediaType'] == 'video/mp4' or \
|
||||||
|
tag_link['mediaType'] == 'video/ogv':
|
||||||
|
media_type = tag_link['mediaType']
|
||||||
|
media_url = remove_html(tag_link['href'])
|
||||||
|
break
|
||||||
|
if media_type and media_url:
|
||||||
continue
|
continue
|
||||||
if not media_link.get('mediaType'):
|
if media_link['mediaType'] == 'application/x-bittorrent':
|
||||||
continue
|
media_torrent = remove_html(media_link['href'])
|
||||||
if not media_link.get('href'):
|
if media_link['href'].startswith('magnet:'):
|
||||||
continue
|
media_magnet = remove_html(media_link['href'])
|
||||||
if media_link.get('tag'):
|
if media_link['mediaType'] != 'video/mp4' and \
|
||||||
media_tags = media_link['tag']
|
media_link['mediaType'] != 'video/ogv':
|
||||||
if isinstance(media_tags, list):
|
continue
|
||||||
for tag_link in media_tags:
|
if not media_url:
|
||||||
if not isinstance(tag_link, dict):
|
media_type = media_link['mediaType']
|
||||||
continue
|
media_url = remove_html(media_link['href'])
|
||||||
if not tag_link.get('mediaType'):
|
|
||||||
continue
|
|
||||||
if not tag_link.get('href'):
|
|
||||||
continue
|
|
||||||
if tag_link['mediaType'] == 'video/mp4' or \
|
|
||||||
tag_link['mediaType'] == 'video/ogv':
|
|
||||||
media_type = tag_link['mediaType']
|
|
||||||
media_url = remove_html(tag_link['href'])
|
|
||||||
break
|
|
||||||
if media_type and media_url:
|
|
||||||
continue
|
|
||||||
if media_link['mediaType'] == 'application/x-bittorrent':
|
|
||||||
media_torrent = remove_html(media_link['href'])
|
|
||||||
if media_link['href'].startswith('magnet:'):
|
|
||||||
media_magnet = remove_html(media_link['href'])
|
|
||||||
if media_link['mediaType'] != 'video/mp4' and \
|
|
||||||
media_link['mediaType'] != 'video/ogv':
|
|
||||||
continue
|
|
||||||
if not media_url:
|
|
||||||
media_type = media_link['mediaType']
|
|
||||||
media_url = remove_html(media_link['href'])
|
|
||||||
return media_type, media_url, media_torrent, media_magnet
|
return media_type, media_url, media_torrent, media_magnet
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue