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

题目地址: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)
相关推荐
深蓝电商API6 小时前
gRPC 数据抓取原理详解
爬虫
上海云盾-小余12 小时前
全链路多层防护体系,一站式拦截 DDoS、CC、爬虫与注入攻击
网络·爬虫·安全·ddos
深蓝电商API1 天前
WebSocket 数据抓取原理与实践
爬虫
TlSfoward2 天前
抓包代理链路下的 TLS 指纹变化分析 TLSFOWARD抓包工具
数据库·爬虫·网络协议·搜索引擎·php
电商API_180079052472 天前
企业ERP进销存场景|京东商品详情接口自动同步方案|凭证鉴权批量调用技术实操
大数据·运维·人工智能·爬虫·数据挖掘·网络爬虫
拓海SEO外贸2 天前
Google 爬虫管理:抓取预算、404 与重定向
爬虫·搜索引擎·信息可视化·seo·跨境电商·独立站搭建·seo优化
深蓝电商API2 天前
浏览器缓存机制对爬虫有什么影响?
爬虫
Dontla3 天前
网站爬虫控制策略介绍(robots.txt、sitemap.xml、x-robots-tag、noindex、nofollow)网站索引
xml·爬虫·dubbo
Bright Data3 天前
DuckDuckGo 搜索爬取器
爬虫·serp·网页数据
去码头整点薯条ing3 天前
某当网登录滑块【协议+OCR】
爬虫·python·ocr