Scrapy Warcio
A Web Archive WARC I/O module for Scrapy
Install
$ pip install scrapy-warcio
Usage
- Create a project and spider:
https://docs.scrapy.org/en/latest/intro/tutorial.html
$ scrapy startproject <project>
$ cd <project>
$ scrapy genspider <spider> example.com
- Copy and edit
scrapy_warciodistributedsettings.ymlwith your configuration settings:
---
warc_spec: https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.0/
max_warc_size: 10000000000 # 10GB
collection: ~ # collection name
description: ~ # collection description
operator: ~ # operator email address
robots: ~ # robots policy (obey or ignore)
user_agent: ~ # your user-agent
warc_prefix: ~ # WARC filename prefix
warc_dest: ~ # WARC files destination
...
-
Export
SCRAPY_WARCIO_SETTINGS=/path/to/settings.yml -
Add
WarcioDownloaderMiddleware(distributed asmiddlewares.py) to your<project>/<project>/middlewares.py:
import scrapy_warcio
class WarcioDownloaderMiddleware:
def __init__(self):
self.warcio = scrapy_warcio.ScrapyWarcIo()
def process_request(self, request, spider):
request.meta['WARC-Date'] = scrapy_warcio.warc_date()
return None
def process_response(self, request, response, spider):
self.warcio.write(response, request)
return response
- Enable
WarcioDownloaderMiddlewarein<project>/<project>/settings.py:
DOWNLOADER_MIDDLEWARES = {
'<project>.middlewares.WarcioDownloaderMiddleware': 543,
}
- Validate your warcs with
internetarchive/warctools:
$ warcvalid WARC.warc.gz
- Upload your WARC(s) to your favorite web archive!
Help
$ pydoc scrapy_warcio
or
>>> help(scrapy_warcio)
TODO
Making this a Scrapy extension may make it more useful:
https://docs.scrapy.org/en/latest/topics/extensions.html
@internetarchive
Metadata
Release files for scrapy-warcio 0.0.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| scrapy-warcio-0.0.8.tar.gz | 5.2 kB | Without provenance | Details for scrapy-warcio-0.0.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| scrapy_warcio-0.0.8-py3-none-any.whl | Python 3 | none | any | Details for scrapy_warcio-0.0.8-py3-none-any.whl |
Total release size: 11.5 kB
Release files / scrapy-warcio-0.0.8.tar.gz
| Download URL | scrapy-warcio-0.0.8.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3d2ea376b17ea805e0e39792e5f6aa8c1ca70c171bbd875e1ed30a51954b9481
|
|
BLAKE2b-256 checksum How to use checksums |
0aaee8011acb33b4cb3b7bc671df3f1bcdccae9353ddb4a27fdd633f31bea2ec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.5.2
|
Release files / scrapy_warcio-0.0.8-py3-none-any.whl
| Download URL | scrapy_warcio-0.0.8-py3-none-any.whl |
|---|---|
| Size | 6.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
20ad1c5882054f64581579e32009f7975843463a45be7cdb5839a3666ebe5073
|
|
BLAKE2b-256 checksum How to use checksums |
61bbce38cdb87e46af477965952862431c9f9c4bda7e38866ffa73cb17a4990e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.5.2
|
Security for scrapy-warcio 0.0.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.