40 lines
1.1 KiB
Python
40 lines
1.1 KiB
Python
import re
|
|
import requests
|
|
|
|
js = requests.get(
|
|
"https://www.gongzicp.com/assets/index.eef719ce.js",
|
|
headers={"User-Agent": "Mozilla/5.0"},
|
|
timeout=90,
|
|
).text
|
|
for needle in ["apiv2", "getNovel", "searchNovel", "chapter", "readChapter"]:
|
|
idx = 0
|
|
found = 0
|
|
while found < 8:
|
|
i = js.find(needle, idx)
|
|
if i < 0:
|
|
break
|
|
snippet = js[max(0, i - 30) : i + 100]
|
|
print("---", needle, snippet.replace("\n", " "))
|
|
idx = i + len(needle)
|
|
found += 1
|
|
|
|
API = "https://api1.gongzicp.com/apiv2"
|
|
headers = {
|
|
"User-Agent": "Mozilla/5.0",
|
|
"Referer": "https://www.gongzicp.com/",
|
|
"Origin": "https://www.gongzicp.com",
|
|
}
|
|
paths = [
|
|
"/novel/info?novel_id=429598",
|
|
"/novel/info?novelId=429598",
|
|
"/novel/detail?novel_id=429598",
|
|
"/novel/chapter/list?novel_id=429598",
|
|
"/chapter/list?novel_id=429598",
|
|
"/search/novel?keyword=天官",
|
|
"/searchNovel?keyword=天官",
|
|
"/novel/search?keyword=天官",
|
|
]
|
|
for p in paths:
|
|
r = requests.get(API + p, headers=headers, timeout=30)
|
|
print(p, r.status_code, r.text[:400])
|