![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
爬虫
菜鸟小超
这个作者很懒,什么都没留下…
展开
-
【python asyncio模块的协程使用示例】
asyncio是Python的一个异步I/O框架,允许使用async/await语法进行并发编程原创 2023-04-20 22:47:47 · 234 阅读 · 0 评论 -
利用python进行zip文件解压缩
import os import zipfile zip_files = [file for file in os.listdir("./") if file.endswith('.zip')] print(zip_files) for zfile in zip_files: #print(zfile.split('.')[0]) fz = zipfile.ZipFile(zfile, 'r') #print(fz.namelist()) for file in fz.na原创 2020-09-16 23:29:36 · 156 阅读 · 0 评论 -
网络文件下载方式
import urllib.request url = 'https://dl.bandisoft.com/honeycam/HONEYCAM-SETUP-ALL.EXE' urllib.request.urlretrieve(url, "demo.exe") print('ok')原创 2020-09-16 23:28:28 · 180 阅读 · 0 评论 -
scrapy框架cookies设置,xpath以及css基本使用记录
import scrapy class ZhihucookieSpider(scrapy.Spider): name = 'zhihucookie' allowed_domains = ['https://www.zhihu.com'] start_urls = ['https://www.zhihu.com/question/361173250/answer/968438958'] def start_requests(self): cookies =原创 2020-09-15 23:24:36 · 93 阅读 · 0 评论 -
python爬虫:音乐下载器
import requests from lxml import etree def gethtml(url): try: kw = { 'cookies':'UM_distinctid=17121941056289-00038658d91354-f313f6d-190140-17121941057216; CNZZDATA1260502790=...原创 2020-03-29 00:01:56 · 1024 阅读 · 0 评论 -
python3+selenium爬取百度图片
python3+selenium爬取百度图片 from selenium import webdriver from lxml import etree from urllib import request import time class Baidu_pic(object): def __init__(self,kw): self.kw = kw op...原创 2020-03-25 20:27:41 · 351 阅读 · 0 评论 -
爬取boss直聘网上海地区python相关职业招聘信息
比较简单的代码,有不少地方可以优化! import requests from lxml import etree import os def getpage(url): try: header={'User-Agent':'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML,...原创 2019-04-13 22:24:55 · 254 阅读 · 0 评论 -
python网络爬虫之框架3
"股票数据Scrapy爬虫"实例 下面是stocks.py文件源代码 # -*- coding: utf-8 -*- import scrapy import re class StocksSpider(scrapy.Spider): name = "stocks" start_urls = ['https://quote.eastmoney.com/stocklist.h...原创 2019-04-11 12:16:00 · 116 阅读 · 0 评论 -
python网络爬虫之框架2
scrapy爬虫的第一个实例 产生步骤: 步骤一:建立一个scrapy爬虫工程 步骤二:在工程内产生一个Scrapy爬虫 步骤三:配置产生的spider爬虫 步骤四:运行爬虫,获取网页 # -*- coding: utf-8 -*- import scrapy class DemoSpider(scrapy.Spider): name = "demo" #allowed_dom...原创 2019-04-11 12:13:51 · 141 阅读 · 0 评论 -
Python网络爬虫之框架1
scrapy爬虫框架介绍 scrapy不是一个简单的函数功能库,而是一个爬虫框架 爬虫框架: 爬虫框架是实现爬虫功能的一个软件结构和功能组件的集合。 爬虫框架是一个半成品,能够帮助用户实现专业网络爬虫。 scrapy爬虫框架结构 “5+2”结构: ENGINE :已有的,核心,控制所有模块之间的数据流,根据条件触发事件 SCHEDULER:已有的,对所有的爬虫请求进行调度管理 ITEM PI...原创 2019-04-11 12:12:11 · 270 阅读 · 0 评论 -
猫眼电影榜单TOP100爬取项目
猫眼电影top100爬取 全代码如下: import requests import re import json # from multiprocessing import Pool ##多进程爬取时需要 def getonepage(url): try: r=requests.get(url) r.raise_for_status() ...原创 2019-04-11 00:22:50 · 429 阅读 · 0 评论 -
scrapy框架爬取1000本epub格式玄幻小说
github源码链接(分别用requests、lxml库和scrapy两种方法爬取,如果有参考意义麻烦给star点赞哦:)):https://github.com/chengchaoccss/CCcode.git spider部分 # -*- coding: utf-8 -*- import scrapy from epub.items import EpubItem class Epubdow...原创 2019-04-11 00:12:39 · 392 阅读 · 0 评论