5080a233ca3e91953ddf217d34280d45.png

Python crawler camouflages browser_Python anti-crawler camouflages browser to crawl

For some websites in the crawler, the ip will be blocked after too many requests are set. Now the browser is simulated to crawl, that is to say, let the server realize that the access to him is a real browser rather than a machine operation Simply add the request header directly, and pass in the browser information when requesting data: Open browser–open developer mode–request any website As shown in the picture below: Find the name of the request, open it, check the headers column, find User-Agent, and copy it. Then add it to the request header The code is as follows: import requests url = ‘https://www.baidu.com’ headers ={ ‘User-Agent’:’Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko)’ ‘Chrome/65.0.3325.181 Safari/537.36’ } rq = requests. get(url=url, headers=headers) print(rq. text) Deeper camouflage browser, add multiple browser information, randomly send browser information every time a request is made, let the server know that not one browser has been accessing, (you can search user-agent on Baidu) The code is as follows: import requests import random url = ‘https://www.baidu.com’ headers_lists =( ‘Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko)’ ‘Chrome/65.0.3325.181 Safari/537.36’, ‘Mozilla/4.0(compatible;MSIE7.0;WindowsNT5.1;Maxthon2.0’, ‘Opera/9.80(Android2.3.4;Linux;Operamobi/adr-1107051709;U;zh-cn)Presto/2.8.149Version/11.10’, ‘Mozilla/5.0(WindowsNT6.1;rv:2.0.1)Gecko/20100101Firefox/4.0.1’, ‘Mozilla/5.0(Android;Linuxarmv7l;rv:5.0)Gecko/Firefox/5.0fennec/5.0’,) rq = requests.get(url=url,headers={‘User-Agent’:random.choice(headers_lists)}) print(rq. text)…

Detailed explanation of VC file operation, CFile, CStdioFile_tyc13061298’s blog

In VC, if the amount of data is not large, the database is generally not used, and files are used to save data. Moreover, more file operation classes or methods are provided in VC. This article just briefly introduces a few file operations method. The first one is to introduce a VC file operation class that I think is the simplest, which can directly read the file by line, and output the string directly when outputting to the file, instead of reading and writing by byte Enter. How to use CStdioFile to read and write files in VC.txt When using this method, there may be an error situation, that is, when you use the WriteString(str) method, if the output is Chinese characters, it may become garbled. The solution is: CStdioFile.WriteString can’t handle Chinese CStdioFile’s bug, change the character set property of the project to use multi-byte character set,,,, the specific setting method is as follows: open project properties –> configuration properties –>General–>Character Set–>Change to use multi-byte character set Example methods are as follows: #include #include #define MAX_LENGTH 1024 void main() { CStdioFile stdiofile; char szPath[MAX_LENGTH] = {0}; cout << "Please enter the path of the file you want to view:"…

一文看懂 LSTM(Long Short-Term Memory)_码猿小菜鸡的博客

Pycharm安装PyQt5和pyqt5-tools(pyqt5-tools下没有designer.exe)_tayer13的博客

通过SharedPreferences/SP实现保存密码 学习笔记_sharedpreferences实例_保存qq密码_别急,还差一行代码的博客

Android Automotive OS | 车载相机HAL_android 车机没有相机_Justin-Yip的博客

xiaomi5小米5手机刷原生安卓10_小米5能升级安卓10吗_Azure.dream的博客

安装Box2D_范坤3371的博客

OpenWrt U disk partition startup settings_openwrt ubi partition_xiaomingtongxie’s blog

1. Update the router software source (note: the router needs to be connected to the Internet) opkg update 2. Add USB support opkg install kmod-usb-core #optional opkg install kmod-usb-uhci opkg install kmod-usb-storage opkg install kmod-usb2 opkg install kmod-usb-ohci #The command is lsusb 3. Add usb mount, hot swap, and boot support opkg install block-mount #Mount, hot swap, boot support Two, U disk partition Why do you want to partition the U disk? First, it is convenient to manage files. We want to start openwrt from the U disk, so run the system image on the U disk, so as to obtain more space for storing various files. For enhanced management, necessary partitions are useful. Second, create a Swap swap partition. We need to open up some space on the U disk for Swap exchange. Use Swap to increase the throughput of RAM, thereby preventing the system from hanging up when some software needs to use a large amount of RAM (for example, Transmission offline download service). So, how to partition the U disk? We need to do the following: 1. Preparation, add necessary software opkg install kmod-fs-ext4 #Add ext3 file system support opkg install fdisk #Add partition tool opkg install…

数理方程突击复习_2、典型方程和定解条件的推导_数理方程总复习总结2_张无极2018的博客

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索