34def response(resp):
35 results = []
36 match = re.search(r'window\.__INITIAL_STATE__\s*=\s*({.*?});', resp.text, re.S)
37 if not match:
38 return results
39
40 data = json.loads(match.group(1))
41 if "searchList" in data and "searchList" in data["searchList"]:
42 for item in data["searchList"]["searchList"]:
43 results.append(
44 {
45 "template": "images.html",
46 "url": item.get("url", ""),
47 "thumbnail_src": item.get("picUrl", ""),
48 "img_src": item.get("picUrl", ""),
49 "content": item.get("content_major", ""),
50 "title": item.get("title", ""),
51 "source": item.get("ch_site_name", ""),
52 }
53 )
54
55 return results