When you learn to use Python After that, the crawler will find that if it wants to get some data, it will no longer have to look for it by itself , Today, Xiaoqian will introduce you to a very practical reptile case , obtain Boss The recruitment information on direct employment , Let's study together .
Boss Direct employment reptile case
This time we take the sales position in Beijing as an example , open Boss Direct search 【 sales 】, But unfortunately boss The anti climbing measures of direct employment cannot be used directly requests Get information from library , So using webdriver Get the web page source code automatically .
webdriver The use of ：pip3 install selenium、 To configure chrome Browser's chrome driver.
After clicking multiple pages , It is found that the address in the address bar changes as follows ：
So we found the regular change of address , So the code is as follows ：
Now execute the code , Find out htmls_list There are a lot of data in . Now I'm relieved , It shows that we have obtained the data of the web page . With the data, we begin to traverse htmls_list, because htmls_list Storing multiple pages of data , We need to get and extract the positions page by page 、 Salary and other information . In the extraction process, we use BeautifulSoup, The specific instructions will not be repeated here .
Use BeautifulSoup The extracted data are stored in job_list= In this list . Page analysis is as follows ：
And so on , We can all find the corresponding label .
That's all Python obtain boss The above position information process of direct employment is introduced , Finally, welcome to Python Develop interested partners and focus on Xiaoqian , Share more later Python technical knowledge ！
This article is from Qianfeng education , Reprint please indicate the source .