[TOC] 爬虫介绍 爬虫的本质就是模拟发送http请求(requests模块),之后解析返回的数据(re,bs4,lxml,json等模块),最后将数据入库(redis,mysql,mongodb)。 app的爬虫,本质上是一模一样的。 python做爬虫的优势在于:包多,而且有爬虫的框架scra ...
分类:
其他好文 时间:
2020-04-07 23:57:24
阅读次数:
160
```python from bs4 import BeautifulSoup from urllib import request import threading import re import os from lxml import html class SpiderCategory(thr... ...
分类:
编程语言 时间:
2020-04-06 00:13:04
阅读次数:
69
#!/usr/bin/py2 # -*- coding: utf-8 -*- #encoding=utf-8 from bs4 import BeautifulSoup from scrapy.http import Request, FormRequest from spider_test.ite ...
分类:
Web程序 时间:
2020-04-02 22:20:48
阅读次数:
95
import xlrdfrom xlrd import xldate_as_tupleimport jsonimport requestsimport datetimeimport openpyxlimport osimport timefrom bs4 import BeautifulSoupim ...
分类:
编程语言 时间:
2020-04-01 12:50:45
阅读次数:
155
# 聚焦爬虫的设计思路:1.确定url, 发起请求, 获取响应 > 抓包, requests, urllib, aiohttp, scrapy2.数据解析 --> 目标数据, xpath, re正则, bs4, pyquery3.数据持久化 --> 文件系统, 数据库 --> MySQL, Mong ...
分类:
其他好文 时间:
2020-03-31 14:48:18
阅读次数:
81
一个简单爬虫案例 from bs4 import BeautifulSoup import os import requests response = requests.get("http://www.90xiaohua.com/") response.encoding = "utf-8" # pr ...
分类:
其他好文 时间:
2020-03-25 10:38:34
阅读次数:
52
1.打开网站http://top.baidu.com/buzz?b=1&fr=topindex 2.右键找到源代码 3.用工具爬取数据 import requestsfrom bs4 import BeautifulSoupimport pandas as pdtitles=[]hots=[]url ...
分类:
其他好文 时间:
2020-03-22 01:25:54
阅读次数:
70
import requestsfrom bs4 import BeautifulSoup url = 'http://fj.huatu.com/zt/2019zwb/'def sss(url): reque = requests.get(url) reque.encoding=reque.appar ...
分类:
Web程序 时间:
2020-03-21 23:37:30
阅读次数:
113
import requestsimport bs4 url = "https://search.bilibili.com/all?keyword=%E7%BA%AA%E5%BD%95%E7%89%87"header={'User-Agent':""}de = requests.get(url)de. ...
分类:
其他好文 时间:
2020-03-21 21:04:39
阅读次数:
95
import requests from bs4 import BeautifulSoup as bs res = requests.get('http://politics.people.com.cn/GB/1024/index.html') content = res.content.decod ...
分类:
编程语言 时间:
2020-03-21 18:29:37
阅读次数:
75