import json import requests UA = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/124.0.0.0" BASE = "https://www.gongzicp.com/webapi" headers = { "User-Agent": UA, "Referer": "https://www.gongzicp.com/novel-429598.html", "Accept": "application/json, text/plain, */*", } paths = [ "/novel/novelInfo?id=429598", "/novel/chapterGetList?nid=429598", ] for p in paths: r = requests.get(BASE + p, headers=headers, timeout=30) print(p, r.status_code) data = r.json() print(json.dumps(data, ensure_ascii=False)[:1500]) # chapter content - need cid from chapter list clist = requests.get(BASE + "/novel/chapterGetList?nid=429598", headers=headers, timeout=30).json() items = clist.get("data", {}).get("list") or [] print("chapters", len(items)) if items: cid = items[0].get("id") r = requests.get( BASE + f"/novel/chapterGetInfo?nid=429598&cid={cid}", headers=headers, timeout=30, ) print("chapter info", r.status_code, json.dumps(r.json(), ensure_ascii=False)[:800]) # search r = requests.get( BASE + "/novel/searchNovel?keyword=天官&page=1&module=all", headers={**headers, "Referer": "https://www.gongzicp.com/"}, timeout=30, ) print("search", r.status_code, r.text[:800])