(我与爬虫的较量)码上爬第三题

题目地址:https://www.mashangpa.com/problem-detail/3/

这里作者很有意思,当我想F12调试的时候,就出现了

典型的JS禁用了调试工具,我们通过手动的进入浏览器-->更多工具-->开发者工具

出现了这个,一定是在强制打开后发生了什么,经过全局搜索debugger后

这里即使禁止了debugger,但是还是会发生页面自毁,主要因为会检测开发者工具的检测

解决办法:打开这个设备仿真(原理就是更改页面显示的大小)

复制代码
import requests



headers = {
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0",
    "Referer": "https://www.mashangpa.com/problem-detail/1/",
    "Accept": "*/*",
    "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
    "Accept-Encoding": "gzip, deflate, br, zstd",
    "Cookie": "yours Cookie"
}
sum_all = 0
for i in range(1, 21):
    url = f"https://www.mashangpa.com/api/problem-detail/3/data/?page={i}"
    resp = requests.get(url, headers=headers)
    # print(resp.status_code)
    arr = resp.json()['current_array']
    total = sum(arr)
    sum_all+=total
url = f"https://www.mashangpa.com/api/problem-detail/2/data/?page=2"
resp = requests.get(url, headers=headers)
print(sum_all)
相关推荐
星空椰16 小时前
从零到实战:一套完整的 Python 爬虫技术体系(requests + BeautifulSoup + 正则 + JSON)
爬虫·python·json·beautifulsoup
zhangfeng11331 天前
合法爬虫四底线 法律边界
爬虫
S1998_1997111609•X2 天前
论恶意注入污染蜜罐进程函数值取仺⺋以集团犯罪获取数据爬虫的轮系依据
网络·数据库·爬虫·网络协议·百度
大邳草民2 天前
Python 爬虫:从 HTTP 请求到接口分析
笔记·爬虫·python
S1998_1997111609•X2 天前
恶意注入污染蜜罐HDMI进程函数值进行封禁垃圾蠕虫仓蟲的轮系依据行为戆直㞢仓shell token
数据库·爬虫·网络协议·百度·开闭原则
huzhongqiang3 天前
Python全站链接爬取工具优化:支持过滤和断点续爬
后端·爬虫
李松桃3 天前
Python爬虫-实战
爬虫·python
跨境数据猎手3 天前
B 站 item_search_video 接口开发,搭建生产级视频搜索服务
大数据·爬虫·python
小白学大数据3 天前
Python 自动化爬取网易云音乐歌手歌词实战教程
爬虫·python·okhttp·自动化
深蓝电商API3 天前
京东API批量操作优化:单次1000条限制的突破方案
爬虫·接口·api·京东api