100 """Get response from google's search request"""
103 detect_google_sorry(resp)
106 dom = html.fromstring(resp.text)
109 for result
in eval_xpath_list(dom,
'//div[contains(@class, "g ")]'):
111 thumbnail = eval_xpath_getindex(result,
'.//img/@src', 0,
None)
112 if thumbnail
is None:
115 title = extract_text(eval_xpath_getindex(result,
'.//a/h3[1]', 0))
116 url = eval_xpath_getindex(result,
'.//a/h3[1]/../@href', 0)
118 c_node = eval_xpath_getindex(result,
'.//div[@class="ITZIwc"]', 0)
119 content = extract_text(c_node)
120 pub_info = extract_text(eval_xpath(result,
'.//div[@class="gqF9jc"]'))
128 'thumbnail': thumbnail,
129 'iframe_src': get_embeded_stream_url(url),
130 'template':
'videos.html',
135 for suggestion
in eval_xpath_list(dom, suggestion_xpath):
137 results.append({
'suggestion': extract_text(suggestion)})