爬虫
淅淅的雨声
某五流大学在读研究生
展开
-
python+selenium爬虫的安装与部署(简单易上手强烈推荐!!!)
selenium作为一款自动化测试工具,在平常的使用中我们常常也能简单的作为一款爬虫工具来使用,今天就来说一下selenium如何在我们的浏览器中进行部署。1、首先,需要安装selenium包。可以使用命令:pip install selenium。(若使用的pycharm,也可通过点击file -> Settings -> Project:***project -> python Interpreter -> 点击上方加号进行搜索并安装)2、然后呢,我们需要安装浏览器驱动:原创 2021-08-30 18:44:50 · 3818 阅读 · 2 评论 -
python+selenium爬虫爬取TCMSP药品成分的相关信息
import timefrom selenium.webdriver import Chromefrom selenium.webdriver.chrome.options import Optionsfrom selenium.webdriver.common.keys import Keysclass Spider(): #登陆函数 def Login(self): url = 'https://tcmsp-e.com/' # 躲避检测原创 2021-08-13 16:43:07 · 1450 阅读 · 1 评论 -
python+selenium爬虫搜索今日头条文章并爬取文章相关数据(点赞、评论等)
首先需要一个登录模块,由于今日头条需要登陆就可以搜索,因此这里不登陆,只获取页面#打开浏览器(不登陆)def login(): url = 'https://www.toutiao.com/' option = ChromeOptions() option.add_experimental_option('excludeSwitches', ['enable-automation']) web = Chrome(options=option) web.maximi原创 2021-08-08 14:45:14 · 4518 阅读 · 7 评论 -
python+selenium爬虫,使用selenium爬取热门微博数据
python爬虫使用selenium爬取热门微博数据#完整代码from selenium.webdriver import Chromeimport timeimport csvf = open("./热门微博.csv",mode='w',newline='',encoding='utf-8')writer_obj = csv.writer(f)url = 'https://weibo.com/'web = Chrome()web.get(url)time.sleep(10)w原创 2021-07-24 11:24:28 · 872 阅读 · 1 评论