diff options
| author | Alexandre Flament <alex@al-f.net> | 2022-02-18 20:55:40 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-18 20:55:40 +0100 |
| commit | bf2a2ed48faf511a609d3b084b02066d69549015 (patch) | |
| tree | 5f916297681efb4b0b213e2ce8a01b0c0e3a3541 /searx/engines/youtube_noapi.py | |
| parent | c81b46150ec12b7d936fb218f447e1651826ff2a (diff) | |
| parent | 761885682d45b8a27c92eaec8ba769b03c22c9b1 (diff) | |
Merge pull request #882 from return42/fix-873
[fix] replace embedded HTML by data_src
Diffstat (limited to 'searx/engines/youtube_noapi.py')
| -rw-r--r-- | searx/engines/youtube_noapi.py | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/searx/engines/youtube_noapi.py b/searx/engines/youtube_noapi.py index 239830cc7..406314684 100644 --- a/searx/engines/youtube_noapi.py +++ b/searx/engines/youtube_noapi.py @@ -32,12 +32,6 @@ time_range_url = '&sp=EgII{time_range}%253D%253D' next_page_url = 'https://www.youtube.com/youtubei/v1/search?key=AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8' time_range_dict = {'day': 'Ag', 'week': 'Aw', 'month': 'BA', 'year': 'BQ'} -embedded_url = ( - '<iframe width="540" height="304" ' - + 'data-src="https://www.youtube-nocookie.com/embed/{videoid}" ' - + 'frameborder="0" allowfullscreen></iframe>' -) - base_youtube_url = 'https://www.youtube.com/watch?v=' @@ -91,7 +85,7 @@ def parse_next_page_response(response_text): 'author': section['ownerText']['runs'][0]['text'], 'length': section['lengthText']['simpleText'], 'template': 'videos.html', - 'embedded': embedded_url.format(videoid=section['videoId']), + 'iframe_src': 'https://www.youtube-nocookie.com/embed/' + section['videoId'], 'thumbnail': section['thumbnail']['thumbnails'][-1]['url'], } ) @@ -150,7 +144,6 @@ def parse_first_page_response(response_text): thumbnail = 'https://i.ytimg.com/vi/' + videoid + '/hqdefault.jpg' title = get_text_from_json(video.get('title', {})) content = get_text_from_json(video.get('descriptionSnippet', {})) - embedded = embedded_url.format(videoid=videoid) author = get_text_from_json(video.get('ownerText', {})) length = get_text_from_json(video.get('lengthText', {})) @@ -163,7 +156,7 @@ def parse_first_page_response(response_text): 'author': author, 'length': length, 'template': 'videos.html', - 'embedded': embedded, + 'iframe_src': 'https://www.youtube-nocookie.com/embed/' + videoid, 'thumbnail': thumbnail, } ) |