An out-of-the-box lightweight asynchronous crawler framework
Project description
traspider
简介
traspider是一个开箱即用的轻量爬虫框架
如果你需要写一个小的爬虫,使用traspider会让你事半功倍
github地址:https://github.com/Ntrashh/traspider
环境要求
- Python 3.7.0+
- Works on Linux, Windows, macOS
安装
pip3 install traspider
使用
创建爬虫
traspider creat -s demo_spider
生成代码
添加需要爬取的网址 http://httpbin.org/
from loguru import logger
from traspider import Spider
class DemoSpider(Spider):
def __init__(self):
self.urls = ["http://httpbin.org/"]
def parser(self, response, request):
logger.info(response)
async def download_middleware(self, request):
request.headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"
}
return request
if __name__ == "__main__":
demo_spider = DemoSpider()
demo_spider.start()
traspider这个项目开始之初就是为了爬虫在开发一些简单的项目能够更轻更快,所以对大型项目支持还是不够好。如果开发的是大型爬虫项目,推荐你使用feapder和scrapy
鸣谢
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
traspider-0.0.2.tar.gz
(20.8 kB
view details)
Built Distribution
traspider-0.0.2-py3-none-any.whl
(25.0 kB
view details)
File details
Details for the file traspider-0.0.2.tar.gz
.
File metadata
- Download URL: traspider-0.0.2.tar.gz
- Upload date:
- Size: 20.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6c6b659b981cea4d441c123a28f8bb7b52e268e74bf8d062604d228460fd633d |
|
MD5 | b7d6e4d8465d357cc7fba8041b44a558 |
|
BLAKE2b-256 | da1768f45a9bb14495c7766ccdf248624dc183107237e409594c21f8a7237cad |
File details
Details for the file traspider-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: traspider-0.0.2-py3-none-any.whl
- Upload date:
- Size: 25.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b44f13184dcacbdd4873e0424d07b8591d8eac233dac3c39f9c896cb50aaf4f4 |
|
MD5 | 736d657a8cacfd8e47a41dea2aafca37 |
|
BLAKE2b-256 | dbf0db08b89baa0eb5675d6778693da149578553ec1306ec889630ab4e2ace83 |