爬虫准备前工作

1.Pycham的下载

网址:PyCharm: The only Python IDE you need

2.Python的下载

网址:python.org(python3.9版本之后都可以)

3.node.js的下载

网址:Node.js --- 在任何地方运行 JavaScript(版本使用18就可以)

4.curl的使用

网址:Convert curl commands to code(复制网址的curl写简单的request)

5.Python代码中运行js代码

python 复制代码
import subprocess
from functools import partial

subprocess.Popen = partial(subprocess.Popen, encoding="utf-8")

import execjs


with open("007 js逆向解密、加密数据.js", encoding="utf-8") as f:
    jsCode = f.read()
js_compile = execjs.compile(jsCode)
sign = js_compile.call("d", json_data)

6.Proxy补环境监听

python 复制代码
// proxy代理监控器
delete __dirname
delete __filename

top = self = window = global

document = {}
location = {}
navigator = {}
history = {}
screen = {}

function getEnv(proxy_array) {
    for (var i = 0; i < proxy_array.length; i++) {
        handler = `{\n
            get: function(target, property, receiver) {\n
                   console.log('方法:get','    对象:${proxy_array[i]}','    属性:',property,'    属性类型:',typeof property,'    属性值类型:',typeof target[property]);
                   return target[property];
            },
            set: function(target, property, value, receiver){\n
                    console.log('方法:set','    对象:${proxy_array[i]}','    属性:',property,'    属性类型:',typeof property,'    属性值类型:',typeof target[property]);
                    return Reflect.set(...arguments);
            }
        }`
        eval(`
            try {
                ${proxy_array[i]};
                ${proxy_array[i]} = new Proxy(${proxy_array[i]}, ${handler});
            } catch (e) {
                ${proxy_array[i]} = {};
                ${proxy_array[i]} = new Proxy(${proxy_array[i]}, ${handler});
            }
        `)
    }
}

proxy_array = ['window', 'document','location', 'navigator', 'history', 'screen']
getEnv(proxy_array)

7. webpack细节

开头进行补环境 window = global (先运行,看哪些环境需要进行补)
在加载函数中,注释初始化,一般在加载器函数中(最后一行)的进行注释 例如: // o(o.s = 0)
全局要调用加载器函数(看加载器函数中调用的是哪个对象就调用哪个全局变量) 例如: o.e/o.c/o.r(这时候我们就可以这样调用window.zhang = o)
打上执行模块日志,也在加载器函数中 (console.log("t:::",t))
使用webpack的步骤

(1) 定位入口确认使用了webpack对象
(2) 断点加载器,一般通过刷新页面触发
(3) 注意这是一个单文件的还是多文件的webpack
(4) 将加载器文件拷贝到本地,做以下三件事
-- 全局化
-- 日志
-- 观察初始化

(5) 测试加载器的调用,根据模块日志补充mod

8.js入口定位查找方法

第1知识点:关于json请求体

第2知识点:关于精准请求(如何排除干扰请求)
第3知识点:入口定位
一、关键字方法
(1) 方法关键字
encrypt :加密入口
decrypt :解密入口
JSON.stringify:加密入口
JSON.parse:解密入口
(2) key关键字
(3) headers关键字 xxx()
(4) 拦截器关键字
interceptors.request.use
interceptors.response.use
(5) 路径关键字

第4知识点:断点与断点调试

普通断点
XHR断点
条件断点
日志断点
脚本断点

相关推荐
一个天蝎座 白勺 程序猿25 分钟前
Python爬虫(40)基于Selenium与ScrapyRT构建高并发动态网页爬虫架构:原理、实现与性能优化
爬虫·python·selenium
丶Xylon16 小时前
Java爬虫,获取未来40天预测气象并写入Excel
java·爬虫·excel
z_mazin19 小时前
分布式爬虫监控架构设计
分布式·爬虫
电商API_180079052471 天前
批量获取电商商品数据的解决方案|API接口自动化商品采集|item_get 接口详解
java·大数据·前端·爬虫·数据挖掘·数据分析·自动化
一个天蝎座 白勺 程序猿2 天前
Python爬虫(32)Python爬虫高阶:动态页面处理与Scrapy+Selenium+BeautifulSoup分布式架构深度解析实战
爬虫·python·selenium·scrapy·beautifulsoup
z_mazin2 天前
分布式爬虫架构设计
分布式·爬虫
cliffordl2 天前
Python 爬虫开发
开发语言·爬虫·python
知识中的海王2 天前
爬虫学习-Scrape Center spa2 超简单 JS 逆向
javascript·爬虫·学习
cliffordl2 天前
Python 爬虫入门
开发语言·爬虫·python
爬虫程序猿2 天前
利用 Java 爬虫根据关键词获取某手商品列表
java·开发语言·爬虫