Save an RSS or ATOM feed to a SQLITE database
Project description
feed-to-sqlite
Download an RSS or Atom feed and save it to a SQLite database. This is meant to work well with datasette.
Installation
pip install feed-to-sqlite
CLI Usage
Let's grab the ATOM feeds for items I've shared on NewsBlur and my instapaper favorites save each its own table.
feed-to-sqlite feeds.db http://chrisamico.newsblur.com/social/rss/35501/chrisamico https://www.instapaper.com/starred/rss/13475/qUh7yaOUGOSQeANThMyxXdYnho
This will use a SQLite database called feeds.db
, creating it if necessary. By default, each feed gets its own table, named based on a slugified version of the feed's title.
To load all items from multiple feeds into a common (or pre-existing) table, pass a --table
argument:
feed-to-sqlite feeds.db --table links <url> <url>
That will put all items in a table called links
.
Python API
One function, ingest_feed
, does most of the work here. The following will create a database called feeds.db
and download my NewsBlur shared items into a new table called links
.
from feed_to_sqlite import ingest_feed
url = "http://chrisamico.newsblur.com/social/rss/35501/chrisamico"
ingest_feed("feeds.db", url=url, table_name="links")
Development
Tests use pytest. Run pytest tests/
to run the test suite.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for feed_to_sqlite-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 79ecece4d1d9678f85000eca11ee7bf9e2ffa8515fdb43f488b41318575e9d93 |
|
MD5 | fb4ef139bb68d11c4a8ca3f6a8c283ed |
|
BLAKE2b-256 | d558e7b964a1ba5b674da4abe805b5ebf9001d1f5abefa03f28b9d61813fb06c |