马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
小白想爬一下晋江文学城的小说,结果爬出来后,内容出现“于您的浏览器禁用了javascript,无法正常使用本网站功能”。请各位大佬帮帮忙,这个怎么解决QAQ
import urllib.request as ur
import urllib.parse as up
import lxml.etree as le
import re
def saveNovel():
pass
novel_id = input("请输入小说id:")
data = {}
data['novelid'] = novel_id
n_name = up.urlencode(data,'gbk')
print(n_name)
headers = {}
headers['User-Agent']: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.106 Safari/537.36'
headers['Cookie']:' __cfduid=d05e6379b2ecf6669ba8eccbc08d3aca71582380742; UM_distinctid=1706d3e27728ca-0885e7c45727d3-313f69-144000-1706d3e2773bb5; timeOffset_o=-11180.89990234375; __gads=ID=118427538be126a2:T=1582380978:S=ALNI_MaqzIhZM7iOEdZ4hWzL9ExIDC0I0Q; token=NDI0NjE2MTV8OGIyYzk3ZmFiYTVkMzhiY2JlMDg5NzkzMDk0N2NjMDB8fHx8MjU5MjAwMHwxfHx85qyi6L%2BO5oKo77yM5pmL5rGf55So5oi3fDB8bW9iaWxl; JJEVER=%7B%22ispayuser%22%3A%2242461615-0%22%2C%22foreverreader%22%3A%2242461615%22%2C%22sms_total%22%3A0%7D; testcookie=yes; Hm_lvt_bc3b748c21fe5cf393d26c12b2c38d99=1582380755,1582423239; CNZZDATA30075907=cnzz_eid%3D1798975185-1582377415-null%26ntime%3D1582424627; JJSESS=%7B%22nicknameAndsign%22%3A%22undefined%7E%29%2524%22%2C%22clicktype%22%3A%22%22%7D; Hm_lpvt_bc3b748c21fe5cf393d26c12b2c38d99=1582429903'
url_1 = 'http://www.jjwxc.net/onebook.php?'+n_name
response = ur.Request(url_1,headers)
url_2 = ur.urlopen(response).read().decode('gb2312','ignore')
print(url_2)
试试 :
novel_id = str(input("请输入小说id:"))
url_1 = 'http://www.jjwxc.net/onebook.php?novelid=' + nid
|