![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
爬虫
GDUTSD
talk is cheap,show we the code
展开
-
爬取豆瓣电影
#-*- coding:utf-8 -*-import csvimport requestsfrom lxml import etreefrom bs4 import BeautifulSoup # 导入所需库# 请求头部headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:58.0) Gecko/20100101 Firefox/58.0'}def get_top(): # 获取单页 url =原创 2021-02-17 12:17:27 · 1086 阅读 · 12 评论 -
BeautifulSoup爬取豆瓣电影排名
豆瓣电影排名网址:https://movie.douban.com/top250?start=0&filter=在进去豆瓣电影排名后,打开浏览器的检查功能分析爬取页面源代码,在写请求代码之前,首先我们得找出网页的请求头部。请求头部中的’User-Agent’,是一个特殊的字符串头,可以使服务器识别客户使用的操作系统及版本,浏览器版本等信息。在做爬虫时加上该信息,可以伪装为浏览器,不加...原创 2019-01-18 21:11:23 · 2934 阅读 · 0 评论 -
爬取旅游景点
# -*- coding:utf-8 -*-import csvimport ioimport syssys.stdout = io.TextIOWrapper(sys.stdout.buffer,encoding='gb18030')import requestsfrom bs4 import BeautifulSoup # 导入所需库# 请求头部headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:58.0原创 2020-06-03 16:40:55 · 1127 阅读 · 0 评论 -
反反爬,搭建IP代理池
详细步骤以后再写,蹲个坑talk−is−cheap−show−me−the−codetalk- is -cheap-show -me -the -codetalk−is−cheap−show−me−the−codeimport csvimport requestsfrom bs4 import BeautifulSoup# 导入所需库# 请求头部headers = {'User-Ag...原创 2019-03-09 00:05:12 · 817 阅读 · 3 评论