我正在尝试获取 class='profile-search-school-link' 的所有 URL,但甚至无法获取汤对象。
我执行以下操作:
site = "http://www.geteducated.com/profiles/search/Computer%20Science%20%26%20IT&SS=Search%20by%20Subject%20%3E%20Computer%20Science%20%26%20IT/?start=15"
""" gets a list of the urls for the degree programs """
r = requests.get(site)
html_source = r.text
soup = BeautifulSoup(html_source)
print(soup.prettify())
输出:
<class 'bs4.BeautifulSoup'> # print statement
[] # my depressingly empty soup
代码怎么了?当我粘贴到浏览器中时,链接没有损坏。
如何获取 URL?