scrapy_huo_utilities
介绍
包含一个随机UserAgent和基于leveldb的DuplicateUrls中间件、几个清洗html的函数,自用的几个常用功能。
安装教程
pip install scrapy_huo_utilities
使用说明
-
RandomUserAgent_DOWNLOADER_MIDDLEWARES:
在
settings.py的DOWNLOADER_MIDDLEWARES中修改添加:"scrapy_huo_utilities.MIDDLEWARES.Downloader_Middleware_Utils.RandomUserAgent_DOWNLOADER_MIDDLEWARES": 543, -
DuplicateUrls_SPIDER_MIDDLEWARES: 在
settings.py的SPIDER_MIDDLEWARES中修改添加:"scrapy_huo_utilities.MIDDLEWARES.Spider_Middleware_Utils.DuplicateUrls_SPIDER_MIDDLEWARES": 543, -
html_clean:
from scrapy_huo_utilities.PROCESSORS import clean_html_attributes,clean_html_tags,clean_empty_img_tagsclean_empty_img_tags:清除没有src属性或src属性为空字符串的img标签。clean_empty_a_tags:清除没有href属性或href属性为空字符串的a标签。clean_html_tags:用于清除指定列表中的HTML标签。:param html_data: 传入html :param remove_tags:删除标签列表 :param reserve_content:是否保留删除标签的文本内容,默认保留。 :return: 处理后的htmlclean_html_attributes:用于清除HTML标签中的属性,除了白名单中包含的属性。:param html_data:传入html :param whitelist:白名单 :return: html_data处理后的html
Metadata
Release files for scrapy_huo_utilities 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| scrapy_huo_utilities-0.0.4.tar.gz | 4.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| scrapy_huo_utilities-0.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.9 kB
Release files / scrapy_huo_utilities-0.0.4.tar.gz
| Download URL | scrapy_huo_utilities-0.0.4.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4415be9981067217e072d4ad708fdbfa44a1126ef8e7c2e822c9bd2d86876907
|
|
BLAKE2b-256 checksum How to use checksums |
dfbc2a1c8b782b0d5b008948e646e7c356fd515c296c53fe85213cc1d6326345
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.10.9 Windows/10
|
Release files / scrapy_huo_utilities-0.0.4-py3-none-any.whl
| Download URL | scrapy_huo_utilities-0.0.4-py3-none-any.whl |
|---|---|
| Size | 7.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1e4ebd12c853844fce9bec1e190e2db9b9e17b7ea1f80b544b85c74bf7f31ba3
|
|
BLAKE2b-256 checksum How to use checksums |
cfee0e837eba9ed9f69c7d6fcca798e7607021dcbe73efa3f9d54905293a8588
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.10.9 Windows/10
|