57 dom = html.fromstring(resp.text)
59 for section
in eval_xpath(dom,
'//c-wiz/section/header/..'):
60 sec_name = extract_text(eval_xpath(section,
'./header'))
61 for item
in eval_xpath(section,
'.//a'):
62 url = base_url + item.get(
'href')
63 div_1, div_2 = eval_xpath(item,
'./div')[:2]
64 title = extract_text(eval_xpath(div_2,
'./div[@title]'))
65 metadata = extract_text(eval_xpath(div_2,
'./div[@class]'))
66 img = eval_xpath(div_1,
'.//img')[0]
67 thumbnail = img.get(
'src')
73 "thumbnail": thumbnail,
75 'template':
'videos.html',
84 dom = html.fromstring(resp.text)
86 if eval_xpath(dom,
'//div[@class="v6DsQb"]'):
89 spot = eval_xpath_getindex(dom,
'//div[@class="ipRz4"]', 0,
None)
91 url = extract_url(eval_xpath(spot,
'./a[@class="Qfxief"]/@href'), search_url)
92 title = extract_text(eval_xpath(spot,
'.//div[@class="vWM94c"]'))
93 content = extract_text(eval_xpath(spot,
'.//div[@class="LbQbAe"]'))
94 img = extract_text(eval_xpath(spot,
'.//img[@class="T75of bzqKMd"]/@src'))
96 results.append({
"url": url,
"title": title,
"content": content,
"img_src": img})
98 more = eval_xpath_list(dom,
'//c-wiz[@jsrenderer="RBsfwb"]//div[@role="listitem"]', min_len=1)
100 url = extract_url(eval_xpath(result,
".//a/@href"), search_url)
101 title = extract_text(eval_xpath(result,
'.//span[@class="DdYX5"]'))
102 content = extract_text(eval_xpath(result,
'.//span[@class="wMUdtb"]'))
106 './/img[@class="T75of stzEZd" or @class="T75of etjhNc Q8CSx "]/@src',
110 results.append({
"url": url,
"title": title,
"content": content,
"img_src": img})
112 for suggestion
in eval_xpath_list(dom,
'//c-wiz[@jsrenderer="qyd4Kb"]//div[@class="ULeU3b neq64b"]'):
113 results.append({
"suggestion": extract_text(eval_xpath(suggestion,
'.//div[@class="Epkrse "]'))})