Mime type for youtube videos

main
Bob Mottram 2022-01-14 18:48:43 +00:00
parent c05b569ce6
commit e3a702efe6
3 changed files with 20 additions and 13 deletions

View File

@ -1029,7 +1029,7 @@ def _atom_feed_yt_to_dict(base_dir: str, domain: str, xml_str: str,
description = description.split('</summary>')[0]
description = remove_html(description)
link, link_mime_type = get_link_from_rss_item(atom_item)
link, _ = get_link_from_rss_item(atom_item)
if not link:
link = atom_item.split('<yt:videoId>')[1]
link = link.split('</yt:videoId>')[0]
@ -1047,7 +1047,7 @@ def _atom_feed_yt_to_dict(base_dir: str, domain: str, xml_str: str,
votes_status = []
podcast_properties = xml_podcast_to_dict(atom_item, xml_str)
if podcast_properties:
podcast_properties['linkMimeType'] = link_mime_type
podcast_properties['linkMimeType'] = 'video/youtube'
_add_newswire_dict_entry(base_dir, domain,
result, pub_date_str,
title, link,

View File

@ -39,8 +39,8 @@ def _add_embedded_video_from_sites(translate: {}, content: str,
url = content.split('>vimeo.com/')[1]
if '<' in url:
url = url.split('<')[0]
content = \
content + "<center>\n<iframe loading=\"lazy\" " + \
content += \
"<center>\n<iframe loading=\"lazy\" " + \
"src=\"https://player.vimeo.com/video/" + \
url + "\" width=\"" + str(width) + \
"\" height=\"" + str(height) + \
@ -57,8 +57,8 @@ def _add_embedded_video_from_sites(translate: {}, content: str,
url = url.split('&')[0]
if '?utm_' in url:
url = url.split('?utm_')[0]
content = \
content + "<center>\n<iframe loading=\"lazy\" src=\"" + \
content += \
"<center>\n<iframe loading=\"lazy\" src=\"" + \
video_site + url + "\" width=\"" + str(width) + \
"\" height=\"" + str(height) + \
"\" frameborder=\"0\" allow=\"autoplay; fullscreen\" " + \
@ -88,8 +88,8 @@ def _add_embedded_video_from_sites(translate: {}, content: str,
url = url.split('&')[0]
if '?utm_' in url:
url = url.split('?utm_')[0]
content = \
content + "<center>\n<iframe loading=\"lazy\" src=\"" + \
content += \
"<center>\n<iframe loading=\"lazy\" src=\"" + \
video_site + url + "\" width=\"" + \
str(width) + "\" height=\"" + str(height) + \
"\" frameborder=\"0\" allow=\"autoplay; fullscreen\" " + \
@ -103,8 +103,8 @@ def _add_embedded_video_from_sites(translate: {}, content: str,
url = url.split('"')[0]
if not url.endswith('/oembed'):
url = url + '/oembed'
content = \
content + "<center>\n<iframe loading=\"lazy\" src=\"" + \
content += \
"<center>\n<iframe loading=\"lazy\" src=\"" + \
video_site + url + "\" width=\"" + \
str(width) + "\" height=\"" + str(height) + \
"\" frameborder=\"0\" allow=\"fullscreen\" " + \
@ -153,8 +153,8 @@ def _add_embedded_video_from_sites(translate: {}, content: str,
if '"' not in url:
continue
url = url.split('"')[0].replace('/watch/', '/embed/')
content = \
content + "<center>\n<iframe loading=\"lazy\" " + \
content += \
"<center>\n<iframe loading=\"lazy\" " + \
"sandbox=\"allow-same-origin " + \
"allow-scripts\" src=\"https://" + \
site + url + "\" width=\"" + str(width) + \

View File

@ -190,7 +190,14 @@ def html_podcast_episode(css_cache: {}, translate: {},
translate['Your browser does not support the audio element.'] + \
'\n </audio>\n'
elif podcast_properties.get('linkMimeType'):
if 'video' in podcast_properties['linkMimeType']:
if '/youtube' in podcast_properties['linkMimeType'] or \
'/vimeo' in podcast_properties['linkMimeType']:
podcast_str += \
" <iframe loading=\"lazy\" src=\"" + \
link_url + "\" width=\"90%\" " + \
"frameborder=\"0\" allow=\"autoplay; fullscreen\" " + \
"allowfullscreen>\n </iframe>\n"
elif 'video' in podcast_properties['linkMimeType']:
video_mime_type = podcast_properties['linkMimeType']
video_msg = 'Your browser does not support the video element.'
podcast_str += \