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

题目地址: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)
相关推荐
yijianace4 小时前
Python爬虫实战:分页爬取 + 详情页采集 + CSV存储
前端·爬虫·python
yijianace5 小时前
Python爬虫实战:ThreadPoolExecutor多线程采集书籍信息与图片下载
开发语言·爬虫·python
在放️6 小时前
Python 爬虫 · bs4 模块基础
开发语言·爬虫·python
belong_my_offer6 小时前
Python 数据采集完全指南 —— 从零开始掌握网络爬虫与文件读取
开发语言·爬虫·python
深蓝电商API6 小时前
Playwright vs Puppeteer vs Selenium 2026终极对比
爬虫·selenium·puppeteer·playwright
遇事不決洛必達14 小时前
【Python基础】GIL 锁是什么及其对爬虫的影响
爬虫·python·线程·进程·gil锁
綝~15 小时前
爬虫数据采集工程师岗位面试题
爬虫·面试·请求
跨境数据猎手16 小时前
大数据在电商行业的应用
大数据·运维·爬虫
tang777891 天前
异步爬虫与代理IP池结合:用aiohttp提升10倍抓取效率
爬虫·网络爬虫·爬虫代理·代理ip·代理ip池
深蓝电商API1 天前
行为模拟的艺术:如何让爬虫的鼠标轨迹像真人
爬虫