🚀 langchain-hackernews
LangChain retrievers for Hacker News — search stories, fetch the front page, and retrieve full comment threads as LangChain Document objects. No API keys required.
Perfect for building RAG applications that can search tech news, analyze discussions, and stay up to date with Hacker News.
✨ Features
| Retriever | What it does | API Key Required? |
|---|---|---|
HackerNewsSearchRetriever |
Search HN stories by keyword | ❌ No! |
HackerNewsFrontPageRetriever |
Fetch current top/best/new stories | ❌ No! |
HackerNewsCommentsRetriever |
Fetch a full discussion thread | ❌ No! |
📦 Installation
pip install langchain-hackernews
🚀 Quick Start
Search Hacker News Stories
from langchain_hackernews import HackerNewsSearchRetriever
retriever = HackerNewsSearchRetriever(
max_results=5,
sort_by="relevance", # or "date" for newest first
)
docs = retriever.invoke("langchain python")
for doc in docs:
print(f"📰 {doc.page_content}")
print(f" 👍 {doc.metadata['points']} points | 💬 {doc.metadata['num_comments']} comments")
Fetch the Front Page
from langchain_hackernews import HackerNewsFrontPageRetriever
retriever = HackerNewsFrontPageRetriever(
page_type="top", # "top", "best", "new", "ask", "show", "job"
max_results=10,
)
# The query is ignored for the front page
docs = retriever.invoke("fetch")
for doc in docs:
print(f"#{doc.metadata['rank']} — {doc.page_content}")
Fetch a Comment Thread
from langchain_hackernews import HackerNewsCommentsRetriever
retriever = HackerNewsCommentsRetriever(max_results=50)
# Pass the story URL or ID
docs = retriever.invoke("https://news.ycombinator.com/item?id=40243419")
for doc in docs:
indent = " " * doc.metadata["depth"]
print(f"{indent}💬 {doc.metadata['author']}: {doc.page_content[:80]}...")
📄 License
MIT — see LICENSE for details.
Metadata
Release files for langchain-hackernews 0.1.0
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 |
|---|---|---|---|---|
| langchain_hackernews-0.1.0.tar.gz | 6.3 kB | Without provenance | Details for langchain_hackernews-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| langchain_hackernews-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for langchain_hackernews-0.1.0-py3-none-any.whl |
Total release size: 13.7 kB
Release files / langchain_hackernews-0.1.0.tar.gz
| Download URL | langchain_hackernews-0.1.0.tar.gz |
|---|---|
| Size | 6.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ce85b328ccb5ab5535abbd61183c525eab7f4f4bf496902dace0b8a0057f2310
|
|
BLAKE2b-256 checksum How to use checksums |
ef35ef0b40a4a281320ac1032a8caab5b1668bf6499072cb2dca03c22bd1ff77
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.3
|
Release files / langchain_hackernews-0.1.0-py3-none-any.whl
| Download URL | langchain_hackernews-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fd12e45528df012b0d23c9a5ac054f09cfb6bd96ea1dc2653b9b60d17d8b984e
|
|
BLAKE2b-256 checksum How to use checksums |
d86381a665c8249372808c451b45c8e7a0df042f10faab008b540d667c6152ad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.3
|
Security for langchain-hackernews 0.1.0
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.