Loading

摘要: import requests, urllib, redis, pymongo, time, re, random, xlsxwriter, os, openpyxl, json, csv, pandas as pd from urllib import request from bs4 impor 阅读全文
posted @ 2024-04-05 23:37 踩坑大王 阅读(173) 评论(0) 推荐(0)
摘要: import requests,time,random from fake_useragent import UserAgent urls=open(r'E:\01pycharm project\网络爬虫技术\sjj1.txt',encoding='utf-8').read().split() i= 阅读全文
posted @ 2024-04-05 23:33 踩坑大王 阅读(31) 评论(0) 推荐(0)
摘要: 目录使用selenium使用requests 使用selenium from selenium.webdriver import Chrome,ChromeOptions from selenium.webdriver.support.wait import WebDriverWait from s 阅读全文
posted @ 2024-04-05 23:02 踩坑大王 阅读(504) 评论(0) 推荐(0)
摘要: 写法一: 编写两个爬虫程序文件:爬虫1将豆瓣一周口碑榜的电影url添加到redis中名为movie_url的列表中(注意避免多次运行导致重复的问题); 爬虫2从movie_url中读出网址,爬取每一部电影的导演、主演、类型、制片国家/地区、语言、上映日期、片长, 并将它们保存到redis的hash表 阅读全文
posted @ 2024-04-05 22:54 踩坑大王 阅读(101) 评论(0) 推荐(0)
摘要: #http://www.fz-bus.cn/index.asp #1)在MongoDB中创建一个数据库和一个集合。 #2)在程序执行过程中可输入线路名称查询公交线路, # 每查询到一条线路的信息后,查询MongoDB数据库中是否存在该线路。若存在,则不做任何操作,否则执行第3步。 #将线路名称、起点 阅读全文
posted @ 2024-04-05 22:49 踩坑大王 阅读(55) 评论(0) 推荐(0)
摘要: ``` #编写程序,从丁香园获取国内近期疫情数据,按省份提取当前确诊数,# 确诊总数,疑似病例数,治愈数,死亡数,高危数等数据,保存到csv文件或excel文件中。import requestsimport xlsxwriterfrom fake_useragent import UserAgent 阅读全文
posted @ 2024-04-05 22:47 踩坑大王 阅读(89) 评论(0) 推荐(0)
摘要: 抓取豆瓣读书Top250(https://book.douban.com/top250) 每本书的书名、作者、出版社、出版时间、价格、评分等数据, 将结果分别保存为csv文件和excel文件 import xlwt import xlsxwriter import re import request 阅读全文
posted @ 2024-04-05 22:45 踩坑大王 阅读(1095) 评论(0) 推荐(0)
摘要: 目录1)使用正则表达式2)使用bs4 1)使用正则表达式 #使用requests库和正则表达式抓取在https://www.kanunu8.com/book3/任选的一本电子书 import requests import re import os import time header = { 'u 阅读全文
posted @ 2024-04-05 22:43 踩坑大王 阅读(473) 评论(0) 推荐(0)
摘要: Error occurred during loading data. Trying to use cache server https://fake-useragent.herokuapp.com/browsers/0.1.11 Traceback (most recent call last): 阅读全文
posted @ 2024-04-05 21:56 踩坑大王 阅读(155) 评论(0) 推荐(0)
摘要: 目录使用re爬取+为请求头,保存为csv使用re爬取2+不保存使用xpath+lxml.html+lxml.etree+不保存 使用re爬取+为请求头,保存为csv import requests import re import csv from fake_useragent import Use 阅读全文
posted @ 2024-04-05 21:50 踩坑大王 阅读(78) 评论(0) 推荐(0)
摘要: 目录1)无代理+随机请求头+lxml.etree+百度地图api获取经纬度2)无代理+固定请求头+lxml.html3)无代理+固定请求头+使用HTMLSeesion4)代理池+固定请求头+lxml.html 1)无代理+随机请求头+lxml.etree+百度地图api获取经纬度 #使用reques 阅读全文
posted @ 2024-04-05 21:31 踩坑大王 阅读(105) 评论(0) 推荐(0)
摘要: 目录正则表达式XPathBeautifulSoupCSS-Selectorpyquery 正则表达式 XPath https://www.w3school.com.cn/xpath/xpath_axes.asp BeautifulSoup CSS-Selector https://www.w3sch 阅读全文
posted @ 2024-04-05 21:25 踩坑大王 阅读(17) 评论(0) 推荐(0)
摘要: 目录一、urllib使用request模拟发送请求官方文档urlopen发送get请求urlopen发送post请求parse介绍编码与解码Handler处理器1)登录验证2)ProxyHandler代理设置3)CookieJar/HTTPCookieProcessor获取、保存和读取Cookiee 阅读全文
posted @ 2024-04-05 04:11 踩坑大王 阅读(83) 评论(0) 推荐(0)