Overview
After the tweet was posted yesterday, a friend reported that there was too little information on the form, so I added the details of each adjustment information.
Here I only list a part of the data of the adjustment colleges. For more data, please reply to the "Adjustment" in the backstage of the official account. The reply file is continuously updated. I wish a successful landing. Bless Wuhan, bless Hubei, bless China, bless the world!
Project overview
In fact, there is no difference from what I wrote before, so I won’t go into details here. For details, please refer to dozens of lines of code to download HD wallpapers in batches.
Part of the code
Build url
# 构建所有url
def get_url_list(self):
url_list = []
for i in range(1, 17):
url = self.base_url.format(i)
url_list.append(url)
return url_list
Data analysis part of a website
# 解析存储数据
def parse_data(self, data):
tree = etree.HTML(data)
info_list = tree.xpath("//div[@class='info-item font14']")
for info in info_list:
school_name = info.xpath('./span/text()')[0]
major_name = info.xpath('./span/text()')[1]
info_title = info.xpath('./span/a/text()')
info_time = info.xpath('./span/text()')[2]
global n
sheet.write(n, 0, school_name)
sheet.write(n, 1, major_name)
sheet.write(n, 2, info_title)
sheet.write(n, 3, info_time)
n = n + 1
Get data view