114 results_data = extr(response_text,
'ytInitialData = ',
';</script>')
116 results_json = loads(results_data)
if results_data
else {}
118 results_json.get(
'contents', {})
119 .get(
'twoColumnSearchResultsRenderer', {})
120 .get(
'primaryContents', {})
121 .get(
'sectionListRenderer', {})
125 for section
in sections:
126 if "continuationItemRenderer" in section:
128 section[
"continuationItemRenderer"]
129 .get(
"continuationEndpoint", {})
130 .get(
"continuationCommand", {})
136 "engine_data": next_page_token,
137 "key":
"next_page_token",
140 for video_container
in section.get(
'itemSectionRenderer', {}).get(
'contents', []):
141 video = video_container.get(
'videoRenderer', {})
142 videoid = video.get(
'videoId')
143 if videoid
is not None:
144 url = base_youtube_url + videoid
145 thumbnail =
'https://i.ytimg.com/vi/' + videoid +
'/hqdefault.jpg'
159 'template':
'videos.html',
160 'iframe_src':
'https://www.youtube-nocookie.com/embed/' + videoid,
161 'thumbnail': thumbnail,