Skip to main content

hacker-news-to-sqlite

PyPI Changelog Tests License

Create a SQLite database containing data fetched from Hacker News.

How to install

$ pip install hacker-news-to-sqlite

Usage

$ hacker-news-to-sqlite user hacker-news.db your-username
Importing items:  37%|███████████                        | 845/2297 [05:09<11:02,  2.19it/s]

Imports all of your Hacker News submissions and comments into a SQLite database called hacker-news.db.

$ hacker-news-to-sqlite trees hacker-news.db 22640038 22643218

Fetches the entire comments tree in which any of those content IDs appears.

Browsing your data with Datasette

You can use Datasette to browse your data. Install Datasette like this:

$ pip install datasette

Now run it against your hacker-news.db file like so:

$ datasette hacker-news.db

Visit https://localhost:8001/ to search and explore your data.

You can improve the display of your data usinng the datasette-render-timestamps and datasette-render-html plugins. Install them like this:

$ pip install datasette-render-timestamps datasette-render-html

Now save the following configuration in a file called metadata.json:

{
    "databases": {
        "hacker-news": {
            "tables": {
                "items": {
                    "plugins": {
                        "datasette-render-html": {
                            "columns": [
                                "text"
                            ]
                        },
                        "datasette-render-timestamps": {
                            "columns": [
                                "time"
                            ]
                        }
                    }
                },
                "users": {
                    "plugins": {
                        "datasette-render-timestamps": {
                            "columns": [
                                "created"
                            ]
                        }
                    }
                }
            }
        }
    }
}

Run Datasette like this:

$ datasette -m metadata.json hacker-news.db

The timestamp columns will now be rendered as human-readable dates, and any HTML in your posts will be displayed as rendered HTML.

Metadata

Release files for hacker-news-to-sqlite 0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hacker-news-to-sqlite 0.4
File Size Uploaded
hacker-news-to-sqlite-0.4.tar.gz 3.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hacker-news-to-sqlite 0.4
File Interpreter ABI Platform
hacker_news_to_sqlite-0.4-py3-none-any.whl Python 3 none any Details

Total release size: 12.4 kB

Release files / hacker-news-to-sqlite-0.4.tar.gz

Download URL hacker-news-to-sqlite-0.4.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
efcf4290ed2ea216004a2590bebb84954fc667a193301f7eae2eb8d2515769a2
BLAKE2b-256 checksum
How to use checksums
885882302c7d9e7d29fb5860d778b3d50294bf70d9ff109a562b900700ca4f13
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

Release files / hacker_news_to_sqlite-0.4-py3-none-any.whl

Download URL hacker_news_to_sqlite-0.4-py3-none-any.whl
Size 8.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
779dce2993c8de7fd5f31a3e2f033807f89b0113b0a018410537c711e3c4ab9c
BLAKE2b-256 checksum
How to use checksums
89d77c4aab56f27a0d465442f41b27074814bdd6f7b75f6c47fe3f5cb93b9ba1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

Release history Release notifications | RSS feed

This release

0.4 This release

2 release files

0.3.1

1 release file

0.3

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page