Python happy enemy: crawler and anti crawler with a solution to give you New Year

Java architects Alliance 2021-02-23 01:05:08
python happy enemy crawler anti

Before we know what anti crawler means , Let's first take a look at what a reptile is ?

What is a reptile

In modern society , The Internet is full of useful data , We just need to be patient , Plus some technical means , You can get a lot of valuable data . there " Technical means " It's a web crawler .

A crawler is a program that automatically gets the content of a web page , Search engines, for example ,Google,Baidu etc. , There's a huge crawler system running every day , Crawling data from websites around the world , For users to use when searching .

Malicious crawlers not only take up a lot of website traffic , Cause users with real needs can't enter the website , At the same time, it may also cause the leakage of key information of the website , Affect website or app Normal operation of .

So for websites with high data value , Website developers will give some technical means for web crawlers .

Want to achieve a simple case of crawler , You can go to the article I wrote before :

Five steps to explore the truth behind the crawler crawling video barrage , Attached crawler implementation source code

Common anti crawler measures

generally speaking , We will subdivide the anti crawler methods from the characteristics , Can be divided into information verification anti crawler 、 Dynamic rendering anti crawler 、 Text obfuscation anti crawler 、 Behavior verification, anti crawler, etc .

The text obfuscation anti crawler is the most interesting one , The behavior verification anti crawler is the most difficult one .

Text obfuscation anti crawler

Text obfuscation is simply how to effectively avoid crawler acquisition Web Important text data in application . The premise of anti crawler is that it can't affect the user's normal browsing and reading text content , It's easy to see directly confused text , Therefore, developers usually use the mapping relationship between fonts to achieve confusion .

for example : Text mapping of Auto Home Forum .

Python Introduction to reptiles ! The most anti crawler series of the whole web

Here, through font mapping for some special characters , When a web crawler collects data, it can't get complete data directly , And it does not affect the normal reading of normal users .

Dynamic rendering anti crawler

With the continuous iteration of technology in the era , More and more websites have changed from static data loading to dynamic data loading , And in the process of dynamic loading is accompanied by more and more data encryption .

Dynamic data loading is easy to understand , Let the browser load the general framework of the website first , After completion, send asynchronous request to complete data filling , In the process of sending the request, by encrypting the request parameters , To block very low-level crawler scripts .

for example : Red man data set ---js Parameter encryption

Python Introduction to reptiles ! The most anti crawler series of the whole web

Here, when sending an asynchronous request , Verify key parameters , Directly intercept some of the most basic crawler requests , It is necessary to simulate the process of parameter encryption , In order to get the data normally .

Behavior verification anti crawler

Behavioral captcha is a kind of popular captcha . Understand... Literally , It is to complete the verification through the user's operation behavior , Without the need to read distorted pictures and words . There are two kinds of common : Drag and touch .

for example :12306 Login verification code --- Touch behavior verification

Python Introduction to reptiles ! The most anti crawler series of the whole web

After identifying the image according to the user , Make a choice to judge , Whether the request is currently made by a normal user , Used to block out low tech crawler programs .

Finally, crawler and anti crawler are the battle of wits and bravery among Internet development engineers . As a website developer, we should master the technology of crawler , We need to learn more about how to implement anti crawler .

If you want to further study, you can continue to pay attention to , Next, we will update a series of specific anti crawler solutions for websites .

Thank you for attention ~

Need more python Related to the source code , It can be in mine git Take it from the warehouse , There are also Java And big data related code , If you want to learn, you can take it by yourself, and it will be updated in the future

The warehouse address is here


For starters , stay readme in , I also wrote about python Some initial introductions of , You can check it yourself

Official account :Java Architects Alliance , Be a versatile coder

本文为[Java architects Alliance]所创,转载请带上原文链接,感谢

  1. Python 空间绘图 - 房价气泡图绘制
  2. Translation: practical Python Programming 02_ 02_ Containers
  3. Research on Portfolio Optimization Based on particle swarm optimization
  4. Ubuntu deploying Django project
  5. Two years of Java, write Python and go without byte beating
  6. Translation: practical Python Programming 02_ 02_ Containers
  7. So learn python, grandfather learned! Introduction to super simple Python
  8. python3 多线程 与 mongo亿级消费日志数据 新鲜demo 【优化第一版】
  9. Summary of Chinese word segmentation based on Jieba
  10. I've heard it n times, but I'm not impressed. After reading this, you'll understand
  11. Summary of Chinese word segmentation based on Jieba
  12. From movie art to Python code to realize God's reverse thinking mode
  13. Summary of Chinese word segmentation based on Jieba
  14. ARIMA模型预测CO2浓度时间序列-python实现
  15. Python belongs to back-end development or front-end development? Introduction to Python!
  16. python isinstance()
  17. I've heard it n times, but I'm not impressed. After reading this, you'll understand
  18. This article will familiarize you with the transformation process of Python - & gt; cafe - & gt; om model
  19. 如何用Python一键修改上万个文件名
  20. One day quick start to Python
  21. Python 学习笔记: List
  22. 翻译:《实用的Python编程》02_03_Formatting
  23. Is there any age requirement for learning Python? Is 30 OK?
  24. Professor Tsinghua! The most complete Python tutorial in 12 hours (free sharing at the end of the article)
  25. Using Python to develop defi project
  26. Detailed explanation of Python function
  27. Python 可变类型作为函数默认参数时的副作用
  28. What do Python engineers do? What's their future?
  29. 这是我见过最好的Python教程:十分钟带你认识Python
  30. Python欢喜冤家:爬虫与反爬虫带着处理方案来给大家拜年了
  31. Python - zip() function
  32. 写Python会遇到如下的错误:ModuleNotFoundError: No module named 'email.mime'; 'email' is not a package
  33. Python类的调用以及私有和公有属性方法的调用
  34. Python类的专有方法
  35. Python基础之:数字字符串和列表
  36. How did Python pioneers evaluate this language on their 30th birthday?
  37. Python基础之:数字字符串和列表
  38. Python基础之:数字字符串和列表
  39. 窥探未来不是梦,python数据分析轻松实现
  40. This article will familiarize you with the transformation process of Python - & gt; cafe - & gt; om model
  41. 阿里、华为Python工程师总结的实用技巧,只有你还没看?
  42. 酸了!看到抖音上Python程序员晒得工资条......
  43. Python基础之:数字字符串和列表
  44. Importing excel into database adaptively by Python
  45. Python安装教程
  46. Python安装教程
  47. From Xiaobai to master, here is a guide to pandas
  48. [Python] drawing method of stem leaf diagram and compound pie diagram
  49. Drawing of Python geoplot spatial kernel density estimation map
  50. Python Seaborn economist's classic chart imitation
  51. Python space drawing - regionmask mask operation example
  52. Python space drawing - cartopy longitude and latitude add
  53. Python pykrige package Kriging interpolation calculation and visual rendering
  54. Python batch resampling, mask, slope extraction
  55. Python - Analysis of reachable circle of multiple traffic modes
  56. Python space drawing bubble drawing
  57. Python 3 multithreading and Mongo 100 million consumption log data fresh demo
  58. ARIMA model for predicting time series of CO2 concentration
  59. python isinstance()
  60. How to modify tens of thousands of file names with one key in Python