A library for scrapy tools, including but not limited to the usual pipelines, middlewares, etc.
pip install spider-brew-kit
A pipeline saved into MongoDB asynchronously with txmongo
use database db.createUser( { user: "username", pwd: "password", roles: [ { role: "readWrite", db: "database" } ] } )
how use:
- add to settings.py
ITEM_PIPELINES = {
'scrapy_kit.pipelines.MongoPipeline': 300,
}
- add mongo config to settings.py
MONGO_URI = "mongodb://username:password@host:port"
MONGO_DATABASE_NAME = "database"
MONGO_COLLECTION_NAME = "collection"
Proxy close connection multiplexing middleware
Tunnel Proxy Dynamic Edition request found that the number of requests in the Personal Centre Tunnel Proxy Usage Statistics is very small, which is seriously inconsistent with the real number of requests. Moreover, there is no IP change when using Tunnel Broker Dynamic Edition. The reason for this is that the tunnel sends requests that reuse previously established connections. You need to add Connection: close to the header.
How to use it:
- Add in settings.py:
DOWNLOADER_MIDDLEWARES = {
'scrapy_kit.middlewares.ProxyConnectionCloseMiddleware': 543,
}
git clone
cd spider-brew-kit
poetry install