seco

发表的评论

我认为 Selenium 或 BeautifulSoup 更好也更容易。
像这样

tags = res.findAll("h3", {"class": "post-title"})

或者这样

tags = res.findAll("span", "a" "img")

您也可以使用正则表达式

import re
tags = res.findAll("img", {"src": re.compile("\.\./uploads/photo_.*\.png")})

我从这个教程中得到了这些例子
https://likegeeks.com/python-web-scraping/

希望能有所帮助。

© . All rights reserved.