Scrape 2018 Chinese City Job Listings with Python and Visualize the Results
This tutorial shows how to use Python to crawl all Chinese city names from Zhaopin, retrieve the number of Android job postings for each city via HTTP GET requests, parse the results with regex, store them in a dictionary, and finally plot the data with Matplotlib for clear visual comparison.
1. Scrape all city names nationwide
We start by fetching the city list from Zhaopin's city map page (http://www.zhaopin.com/citymap.html). All city names are wrapped in tags, so we extract the text of every element to obtain a complete list of Chinese cities.
2. Iterate city names to fetch job counts
For each city we send a GET request to Zhaopin's job search page with the parameters jl (city) and kw (keyword, e.g., "android"). The response contains a line like "共84个职位满足条件". Because many tags appear elsewhere, we use a regular expression to capture the number: (?!共<em>)[0-9]+(?=</em>个职位满足条件) Adding a browser‑like User‑Agent header prevents the request from being blocked.
We store the results in a dictionary, e.g. {'北京': 4205, '上海': 2702, ...}.
3. Plot data with Matplotlib
After collecting the city‑job count dictionary, we use the matplotlib library to draw a bar chart, which visualizes the distribution of job openings across cities.
4. Result display
The script prints the chart and shows the top cities with the most Android positions. By changing the keyword, the same script can analyze other professions.
Code repository: https://github.com/miqt/PythonLearn/.../ZhiLian.py Author: 痕迹 Source: http://imaster.top/
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
