随笔分类 -  B---python爬虫

摘要:https://www.runoob.com/w3cnote/reg-lookahead-lookbehind.html 取前面不是数字,后面不是数字,中间是四位数的 query = "12356/2022安徽光伏政策2222" re.findall('(?<!\d)\d{4}(?!\d)', qu 阅读全文
posted @ 2022-03-02 17:16 douzujun 阅读(64) 评论(0) 推荐(0) 编辑
摘要:https://www.cnblogs.com/lei0213/p/7506130.html 阅读全文
posted @ 2022-01-20 19:22 douzujun 阅读(34) 评论(0) 推荐(0) 编辑
摘要:import re re.findall('《(.*?)》', '《1334》qasdfa《23423》') 阅读全文
posted @ 2021-09-05 15:09 douzujun 阅读(1388) 评论(0) 推荐(0) 编辑
摘要:import re, requests, json, os, time from io import BytesIO headers = { "User-Agent":"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, l 阅读全文
posted @ 2020-06-16 22:06 douzujun 阅读(372) 评论(0) 推荐(0) 编辑
摘要:1. 爬虫代码 # -*- coding: utf-8 -*- """ Created on Sat Jun 13 20:15:03 2020 @author: Administrator """ import requests import json import chardet import r 阅读全文
posted @ 2020-06-13 23:13 douzujun 阅读(253) 评论(0) 推荐(0) 编辑
摘要:1. 爬虫常见的反爬策略和反爬攻克手段 阅读全文
posted @ 2020-02-11 12:51 douzujun 阅读(528) 评论(0) 推荐(0) 编辑
摘要:1. 前程无忧招聘信息爬虫 爬取这个网站: http://www.51job.com (设置选项后)分析链接得:https://search.51job.com/jobsearch/search_result.php # -*- coding: utf-8 -*- import requests i 阅读全文
posted @ 2020-02-09 20:42 douzujun 阅读(596) 评论(0) 推荐(0) 编辑
摘要:爬取这个网站:https://yq.aliyun.com/articles/ # -*- coding: utf-8 -*- import requests import re import time from parsel import Selector key = "Python" url = 阅读全文
posted @ 2020-02-09 20:29 douzujun 阅读(265) 评论(0) 推荐(0) 编辑
摘要:1. 基础 2. 实战 阅读全文
posted @ 2020-02-09 13:27 douzujun 阅读(156) 评论(0) 推荐(0) 编辑
摘要:1. 用Python批量爬取全站小说 爬取这个网站小说:http://www.shuquge.com/txt/89644/index.html 2. 爬取一本书 # -*- coding: utf-8 -*- """ Created on Sat Feb 8 20:31:43 2020 @autho 阅读全文
posted @ 2020-02-05 23:13 douzujun 阅读(1853) 评论(0) 推荐(0) 编辑
摘要:1. 股票定向爬虫 2. 实例编写 2.1 建立工程和spider模板 (2)配置stocks.py文件 # -*- coding: utf-8 -*- import scrapy import re class StocksSpider(scrapy.Spider): name = 'stocks 阅读全文
posted @ 2020-02-01 17:38 douzujun 阅读(329) 评论(0) 推荐(0) 编辑
摘要:1. 第一个scrapy实例 1.1 建立一个Scrapy爬虫工程 scrapy startproject python123demo 1.2 在工程中产生一个scrapy爬虫 (1)生成一个demo的爬虫 scrapy genspider demo python123demo.io 1.3 配置产 阅读全文
posted @ 2020-02-01 03:02 douzujun 阅读(332) 评论(0) 推荐(0) 编辑
摘要:1. scrapy安装(https://www.osgeo.cn/scrapy/intro/install.html) 建议直接使用anaconda安装,方便快捷,pip安装会遇到很多问题!!!!http://www.scrapyd.cn/doc/124.html conda install -c 阅读全文
posted @ 2020-02-01 01:53 douzujun 阅读(397) 评论(0) 推荐(0) 编辑
摘要:1. 股票数据定向爬虫 https://gupiao.baidu.com/stock http://quote.eastmoney.com/stock_list.html 2. 实例编写 2.1 获取HTML页面 def getHTMLText(url): try: r = requests.get 阅读全文
posted @ 2020-01-31 23:56 douzujun 阅读(975) 评论(2) 推荐(0) 编辑
摘要:1. 淘宝商品信息定向爬虫 链接: https://www.taobao.com/ 2. 实例编写 2.1 整体框架 # -*- coding: utf-8 -*- import requests import re def getHTMLText(url): print("") # 对获得的每个页 阅读全文
posted @ 2020-01-31 15:53 douzujun 阅读(3333) 评论(4) 推荐(0) 编辑
摘要:1. 代码 # -*- coding: utf-8 -*- """ Created on Thu Jan 30 01:27:38 2020 @author: douzi """ import requests from bs4 import BeautifulSoup import bs4 def 阅读全文
posted @ 2020-01-30 18:35 douzujun 阅读(533) 评论(2) 推荐(0) 编辑
摘要:1. 中国大学排名定向爬虫 网站:http://www.zuihaodaxue.com/zuihaodaxuepaiming2016.html 查看源代码,发现信息直接写在HTML里的,即该定向爬虫可以实现 2. 程序的结构设计 2. 实例编写 2.1 代码总框架 # -*- coding: utf 阅读全文
posted @ 2020-01-30 01:27 douzujun 阅读(826) 评论(0) 推荐(0) 编辑
摘要:1. 正则表达式 https://www.cnblogs.com/douzujun/p/7446448.html 单词边界的用法(非常好用啊!!!) 比如,我只想替换 app 为 qq,不像替换掉 apple和application里的app re.findall(r'\b\d{3}\b', '11 阅读全文
posted @ 2020-01-29 23:07 douzujun 阅读(1099) 评论(0) 推荐(0) 编辑
摘要:1. 基于bs4库的HTML内容查找方法 1.1 <>.find_all() 和 re (正则表达式库) (1)参数为单一字符串 (2)参数为 列表 (3)参数为True,则返回所有标签内容 (4)显示 以 b 开头的标签,如 b,body。(使用 re:正则表达式库) import request 阅读全文
posted @ 2020-01-29 20:19 douzujun 阅读(296) 评论(0) 推荐(0) 编辑
摘要:1. 信息提取的一般方法 1.1 方法一 1.2 方法2 1.3 方法3 2. 实例 import requests from bs4 import BeautifulSoup r = requests.get("http://python123.io/ws/demo.html") demo = r 阅读全文
posted @ 2020-01-29 19:48 douzujun 阅读(251) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示