scrapy-feed-storage-internetarchive
This is a Storage Backend for Scrapy Item Feeds that uploads feed files to archive.org when a scrape job ends.
This was created to make it easy to archive data at the Internet Archive which you are authorised to distribute. e.g. to archive public data.
Usage
Install the custom storage backend
We recommend the scheme internetarchive
FEED_STORAGES = {
"internetarchive": "feedstorage_internetarchive.storages.InternetArchiveStorage",
}
Configure the Internet Archive metadata template
Metadata values can be specified using the settings key FEED_STORAGE_INTERNETARCHIVE, e.g.
FEED_STORAGE_INTERNETARCHIVE = {
"metadata": {
"mediatype": "data",
"coverage": "South Africa",
"title": "eTender Portal %(name)s %(time)s %(filetype)s",
}
}
Configure the storage for your feeds
Use the Feed Exporter configuration with the URI scheme you used for installing the backend.
The Internet Archive feed exporter should have the hostname archive.org, Internet Archive S3 API access key and secret in the username and password positions.
Only one level of path is allowed. This will be used as the filename, and will be transformed into a unique identifier, meaning it should be unique on all of the Internet Archive. Including the scrape job timestamp in this path is useful for ensuring uniqueness.
Extra parameters can be provided as query string parameters, which will then be templated into the metadata values.
e.g.
FEEDS = {
"internetarchive://YourIAS3AccessKey:YourIAS3APISecretKey@archive.org/south-africa-%(name)s-%(time)s.csv?time=%(time)s&name=%(name)s&filetype=csv": {
"format": "csv",
},
"internetarchive://YourIAS3AccessKey:YourIAS3APISecretKey@archive.org/south-africa-%(name)s-%(time)s.jsonlines?time=%(time)s&name=%(name)s&filetype=jsonlines": {
"format": "jsonlines",
},
}
You probably don't want to put credentials into your project settings module, since it can then easily be discovered if added to source control. So try to set it in the environment where you will run your spider.
Scrapinghub
You can set the FEEDS key in scrapinghub by providing the value dictionary as JSON on a single line in your spider's Raw Settings. For the above example, you would add the following line in the scrapinghub Raw settings:
FEEDS = {"internetarchive://YourIAS3AccessKey:YourIAS3APISecretKey@archive.org/south-africa-%(name)s-%(time)s.csv?time=%(time)s&name=%(name)s": {"format": "csv"}, "internetarchive://YourIAS3AccessKey:YourIAS3APISecretKey@archive.org/south-africa-%(name)s-%(time)s.jsonlines?time=%(time)s&name=%(name)s": { "format": "jsonlines" }}
After saving, you should see it parsed into a key and value on the standard settings pane.
Metadata
Release files for scrapy-feed-storage-internetarchive 0.0.1
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 | |
|---|---|---|---|---|
| scrapy-feed-storage-internetarchive-0.0.1.tar.gz | 3.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| scrapy_feed_storage_internetarchive-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.6 kB
Release files / scrapy-feed-storage-internetarchive-0.0.1.tar.gz
| Download URL | scrapy-feed-storage-internetarchive-0.0.1.tar.gz |
|---|---|
| Size | 3.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3bb241a120259bd85c00f53f2c375a5e2498b948a41e5570d6aa201abb0617d3
|
|
BLAKE2b-256 checksum How to use checksums |
86b94799bbbe824f6d3102d9ef12f57ca73d4ee470dacb1eb726c09eadf0329d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3
|
Release files / scrapy_feed_storage_internetarchive-0.0.1-py3-none-any.whl
| Download URL | scrapy_feed_storage_internetarchive-0.0.1-py3-none-any.whl |
|---|---|
| Size | 4.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b940fea1ff9745c84f957ba5b9413b2f204d02522ae5644320af6da01cbb7897
|
|
BLAKE2b-256 checksum How to use checksums |
2e245a8596cca1829fd702d44ee906fbb1364b88e626775625758d35c86da829
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3
|
Security for scrapy-feed-storage-internetarchive 0.0.1
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.