增加多线程抓取数据,增加url判断,若数据已抓取,不在重复抓取 (可参考URL管理器) 需要再添加上队列,否则全开 from lxml import etree import requests import time import os import random import urllib3 fr ...
分类:
编程语言 时间:
2020-01-20 18:54:59
阅读次数:
79
from lxml import etree import requests """ 获取章节列表和地址 """ def getContents(): tagret = "https://www.kanunu8.com/files/old/2011/2447.html" req = requests ...
分类:
编程语言 时间:
2020-01-19 19:09:20
阅读次数:
103
网上的妹子图爬虫:只爬取一个人物相册 import requests from bs4 import BeautifulSoup headers = { 'User-Agent':'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)', 'Refer ...
分类:
编程语言 时间:
2020-01-18 00:45:19
阅读次数:
76
import requests import lxml.etree as etree import xml.etree.ElementTree as ET # 详情页 # 3093-148 # http://www.etymon.cn/yingyucigen/148.html def getTgeP ...
分类:
Web程序 时间:
2020-01-14 10:09:49
阅读次数:
111
1.安装lxml lxml是一种使用 Python 编写的库,可以迅速、灵活地处理 XML。 网址 选择对应的Python版本安装。 2.安装zope.interface 直接使用pip命令下载 3.安装Twisted Twisted是用Python实现的基于事件驱动的网络引擎框架,可以直接pip安 ...
分类:
其他好文 时间:
2020-01-13 10:50:27
阅读次数:
78
因为教程的demo网站糗事百科已经gg(好像是涉及用户私人信息什么的原因),所以我就只好随便找了个网站练手。 前几天学习了部分lxml的用法,主要是etree,因为4.4.2版本的更新,etree现在在ElementInclude包内,直接引用是不行了,并且etree添加了新的parser,调用pa ...
分类:
编程语言 时间:
2020-01-12 00:27:47
阅读次数:
136
1、windows+r,进入cmd命令; 2.查看python安装路径:where python 3.打开Python文件的安装目录,进入安装目录的Scripts文件中,执行命令 pip install lxml ...
分类:
编程语言 时间:
2020-01-10 15:57:37
阅读次数:
518
# -*- coding : utf-8 -*-#@Time :2020/1/9 10:32#@Author :LIimport requestsimport jsonfrom lxml import etreedef getOnePage(n): url = f'https://maoyan.co ...
分类:
其他好文 时间:
2020-01-09 20:53:06
阅读次数:
93
#!usr/bin/env python #-*- coding:utf-8 _*- """ @author:Administrator @file: 可视化天气预报.py @time: 2020/1/7 17:54 """ from lxml import etree import request ...
分类:
其他好文 时间:
2020-01-08 12:53:58
阅读次数:
164
碰到的问题: 1.list 越界 查询后加了个 try: except IndexError: pass 一个简单的爬虫程序 1 import requests 2 from lxml import etree 3 import csv 4 import os 5 6 7 #创建一个csv文件 如果 ...
分类:
其他好文 时间:
2020-01-04 16:11:13
阅读次数:
78