Skip to main content

HN Book Extractor

PyPI version License: MIT Downloads LinkedIn

HN Book Extractor is a Python package designed to analyze user-submitted text from Hacker News discussions and extract a structured list of books mentioned in the year 2025. It utilizes language models to intelligently recognize book titles, authors, and publication years within unstructured comments or posts, providing a clear, formatted summary of all referenced books.

This tool is ideal for content creators, researchers, and enthusiasts who need to quickly compile relevant book lists from large discussion datasets without the need for manual effort.

Features

  • Extracts book titles, authors, and publication years from unstructured text.
  • Specifically targets books mentioned in the year 2025.
  • Leverages language models for accurate recognition of book information.
  • Outputs a structured list of extracted books.

Installation

pip install hnbookextractor

Usage

The hnbookextractor function takes user input text and returns a list of extracted book information.

from hnbookextractor import hnbookextractor

user_text = """
I recently read 'Project Hail Mary' by Andy Weir, published in 2021, and it was fantastic.
Someone in another thread mentioned 'The Three-Body Problem' by Cixin Liu, which I plan to read next.
Looking forward to 'Dune' by Frank Herbert, though that's an older classic.
Has anyone read any new sci-fi books released in 2025? I heard 'Hyperion' by Dan Simmons is getting a sequel.
"""

books = hnbookextractor(user_input=user_text)
print(books)

Parameters

The hnbookextractor function accepts the following parameters:

  • user_input (str): The raw text input from Hacker News discussions to analyze.
  • api_key (Optional[str]): Your LLM7 API key. If not provided, the package will attempt to use the LLM7_API_KEY environment variable.
  • llm (Optional[BaseChatModel]): An optional Langchain-compatible chat model instance. If not provided, a default ChatLLM7 instance will be used.

LLM Configuration

By default, the package uses ChatLLM7 from langchain_llm7.

Using a Different LLM

You can provide your own Langchain LLM instance to the hnbookextractor function if you prefer to use other models.

Example with OpenAI:

from langchain_openai import ChatOpenAI
from hnbookextractor import hnbookextractor

llm = ChatOpenAI(api_key="YOUR_OPENAI_API_KEY")
response = hnbookextractor(user_input="...", llm=llm)

Example with Anthropic:

from langchain_anthropic import ChatAnthropic
from hnbookextractor import hnbookextractor

llm = ChatAnthropic(api_key="YOUR_ANTHROPIC_API_KEY")
response = hnbookextractor(user_input="...", llm=llm)

Example with Google Generative AI:

from langchain_google_genai import ChatGoogleGenerativeAI
from hnbookextractor import hnbookextractor

llm = ChatGoogleGenerativeAI(api_key="YOUR_GOOGLE_API_KEY")
response = hnbookextractor(user_input="...", llm=llm)

LLM7 API Key

The default rate limits for the LLM7 free tier are generally sufficient for most users. If you require higher rate limits for LLM7, you can provide your own API key either by setting the LLM7_API_KEY environment variable or by passing it directly to the hnbookextractor function.

You can obtain a free API key by registering at https://token.llm7.io/.

Contributing

Please report any issues or suggest improvements on the GitHub repository.

License

[MIT License] (Specify your license here if different)

Author

GitHub Repository

https://github.com/chigwell/hnbookextractor

Metadata

Release files for hnbookextractor 2025.12.21171700

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

Source distribution (sdist)

Source distribution for hnbookextractor 2025.12.21171700
File Size Uploaded
hnbookextractor-2025.12.21171700.tar.gz 4.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hnbookextractor 2025.12.21171700
File Interpreter ABI Platform
hnbookextractor-2025.12.21171700-py3-none-any.whl Python 3 none any Details

Total release size: 9.8 kB

Release files / hnbookextractor-2025.12.21171700.tar.gz

Download URL hnbookextractor-2025.12.21171700.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
13b9d7de2e0fc7570527d9cad18e2c7c959997d2eee04bda6e4acf801e200fd5
BLAKE2b-256 checksum
How to use checksums
6502229fb1d842b84d5093fcee8d72da68936594dd786ecf36abeaea7608a231
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.1

Release files / hnbookextractor-2025.12.21171700-py3-none-any.whl

Download URL hnbookextractor-2025.12.21171700-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b25439257d361cdadcb43af5e59bdc95df1f0be73bea40a2974b893b644cbfbc
BLAKE2b-256 checksum
How to use checksums
d7d1e441844ef0aef63dba18ef1f33dfdda2a3a9acccf96d5fea3c40584e908c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.1

Release history Release notifications | RSS feed

This release

2025.12.21171700 This release

2 release files

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