随笔分类 -  项目— 爬虫

摘要:利用selenium 模仿浏览器,登陆豆瓣 重点: 1. 要设置好 chromedriver配置与使用, chromedriver.exe 和 Chrome的浏览器版本要对应, http://chromedriver.storage.googleapis.com/index.html 2. Js代码 阅读全文
posted @ 2019-09-17 17:39 FishMan552 阅读(725) 评论(0) 推荐(0)
摘要:重点: 1. 用def函数 2. 使用 os.path.dirname("路径保存") , 实现每组图片保存在独立的文件夹中 方法1: import requests from lxml import etree import os import time start = time.time() d 阅读全文
posted @ 2019-08-20 15:15 FishMan552 阅读(922) 评论(0) 推荐(1)
摘要:重点: 1. 指定路径创建文件夹,判断是否存在 2. 保存图片文件 # 获得校花网的地址,图片的链接 import re import requests import time import os start = time.time() num = 0 # 为了记录爬的照片的次数 # 设置路径 pa 阅读全文
posted @ 2019-08-19 14:39 FishMan552 阅读(475) 评论(0) 推荐(1)
摘要:import pandas as pd import requests from bs4 import BeautifulSoup import time def spider(url, headers): print("正在抓取url: " + url) datas = requests.get( 阅读全文
posted @ 2019-08-06 16:56 FishMan552 阅读(1461) 评论(0) 推荐(0)
摘要:案例一: 重点: 1. 使用bs4 爬取 2. 数据写入本地 txt from bs4 import BeautifulSoup import requests url = "http://maoyan.com/board" header = { 'User-Agent':'Mozilla/5.0 阅读全文
posted @ 2019-07-12 10:55 FishMan552 阅读(878) 评论(0) 推荐(0)