42 lines
1.3 KiB
Python
42 lines
1.3 KiB
Python
import json
|
|
import requests
|
|
|
|
AUTH = "Basic 6ZmI5aSn5a6dOmNwMTIzNDU2"
|
|
headers = {
|
|
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/124.0.0.0",
|
|
"Referer": "https://www.gongzicp.com/",
|
|
"Origin": "https://www.gongzicp.com",
|
|
"Authorization": AUTH,
|
|
"Content-Type": "application/json",
|
|
}
|
|
|
|
body = {"url": "/novel/chapterGetList", "params": {"nid": 429598}}
|
|
for endpoint in [
|
|
"https://www.gongzicp.com/webapi",
|
|
"https://www.gongzicp.com/webapi/",
|
|
"https://www.gongzicp.com/webapi/novel/chapterGetList",
|
|
"https://api1.gongzicp.com/apiv2/novel/chapterGetList",
|
|
]:
|
|
r = requests.post(endpoint, headers=headers, json=body, timeout=30)
|
|
print(endpoint, r.status_code, len(r.text), r.text[:800])
|
|
|
|
# GET webapi with query?
|
|
r = requests.get(
|
|
"https://www.gongzicp.com/webapi",
|
|
headers=headers,
|
|
params={"url": "/novel/chapterGetList", "nid": 429598},
|
|
timeout=30,
|
|
)
|
|
print("GET webapi", r.status_code, r.text[:500])
|
|
|
|
# try apiv2 with form data
|
|
import urllib.parse
|
|
data = urllib.parse.urlencode({"nid": "429598"})
|
|
r = requests.post(
|
|
"https://api1.gongzicp.com/apiv2/novel/chapterGetList",
|
|
headers={**headers, "Content-Type": "application/x-www-form-urlencoded"},
|
|
data=data,
|
|
timeout=30,
|
|
)
|
|
print("form", r.status_code, r.text[:500])
|