94 """Get response from google's search request"""
97 detect_google_sorry(resp)
99 json_start = resp.text.find(
'{"ischj":')
100 json_data = loads(resp.text[json_start:])
102 for item
in json_data[
"ischj"].get(
"metadata", []):
104 'url': item[
"result"][
"referrer_url"],
105 'title': item[
"result"][
"page_title"],
106 'content': item[
"text_in_grid"][
"snippet"],
107 'source': item[
"result"][
"site_title"],
108 'resolution': f
'{item["original_image"]["width"]} x {item["original_image"]["height"]}',
109 'img_src': item[
"original_image"][
"url"],
110 'thumbnail_src': item[
"thumbnail"][
"url"],
111 'template':
'images.html',
114 author = item[
"result"].get(
'iptc', {}).get(
'creator')
116 result_item[
'author'] =
', '.join(author)
118 copyright_notice = item[
"result"].get(
'iptc', {}).get(
'copyright_notice')
120 result_item[
'source'] +=
' | ' + copyright_notice
122 freshness_date = item[
"result"].get(
"freshness_date")
124 result_item[
'source'] +=
' | ' + freshness_date
126 file_size = item.get(
'gsa', {}).get(
'file_size')
128 result_item[
'source'] +=
' (%s)' % file_size
130 results.append(result_item)