89 """Get response from google's search request"""
92 detect_google_sorry(resp)
94 json_start = resp.text.find(
'{"ischj":')
95 json_data = loads(resp.text[json_start:])
97 for item
in json_data[
"ischj"].get(
"metadata", []):
99 'url': item[
"result"][
"referrer_url"],
100 'title': item[
"result"][
"page_title"],
101 'content': item[
"text_in_grid"][
"snippet"],
102 'source': item[
"result"][
"site_title"],
103 'resolution': f
'{item["original_image"]["width"]} x {item["original_image"]["height"]}',
104 'img_src': item[
"original_image"][
"url"],
105 'thumbnail_src': item[
"thumbnail"][
"url"],
106 'template':
'images.html',
109 author = item[
"result"].get(
'iptc', {}).get(
'creator')
111 result_item[
'author'] =
', '.join(author)
113 copyright_notice = item[
"result"].get(
'iptc', {}).get(
'copyright_notice')
115 result_item[
'source'] +=
' | ' + copyright_notice
117 freshness_date = item[
"result"].get(
"freshness_date")
119 result_item[
'source'] +=
' | ' + freshness_date
121 file_size = item.get(
'gsa', {}).get(
'file_size')
123 result_item[
'source'] +=
' (%s)' % file_size
125 results.append(result_item)