希望看到的能够回复这个帖
  • 板块学术版
  • 楼主_QrSn_
  • 当前回复6
  • 已保存回复6
  • 发布时间2022/11/28 10:50
  • 上次更新2023/10/27 01:07:29
查看原帖
希望看到的能够回复这个帖
511253
_QrSn_楼主2022/11/28 10:50

求助Python爬虫 代码:

from urllib.request import urlopen
from urllib import request
import requests

myURL = "https://note.ms/rbeg"
headers = {
    "Cookie" : "__client_id=b5e87275-ff9c-419b-9bbc-edb350e5c042",
    "User-Agent" : "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:107.0) Gecko/20100101 Firefox/107.0",
    'Host' : 'note.ms',
    "Accept" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
    "Upgrade-Insecure-Requests" : "1"    
}
html = requests.get(myURL,headers=headers)
print(html.text)
#res = request.urlopen(req)
# 提取响应内容
#html = res.read().decode('utf-8')
#print(html)
#Let you hey you hey pick me ei ei/nLet you hey you hey pick me ei ei/nLet music going round round round round round/n听到你为我欢呼尖叫

结果: https://www.luogu.com.cn/paste/5myvhgpo

明显不是我想爬下来的,应该是爬虫被ban了

但是我加了user-agent,cookies,还有什么办法吗

2022/11/28 10:50
加载中...