实例一:中国大学排名定向爬虫
网址.:http://www.zuihaodaxue.cn/zuihaodaxuepaiming2016.html
查看定向爬虫的可行性
每个大学以tr标签开始,每个大学的每项信息都以td标签开始。
判断定向爬虫的可行性:打开robots协议看是否有爬虫限制
http://www.zuihaodaxue.cn/robots.txt
并没有爬虫限制。
功能描述
程序结构设计
主函数的框架如下:
import requests
import bs4
from bs4 import BeautifulSoup
def getHTMLText(ur