Skip to main content

nu-private-api

Read-only Python client for discovering and parsing public NU.nl articles.

PyPI Python License Downloads

OverviewInstallUsageAPIProject Layout

Overview

nu-private-api wraps the NU.nl web GraphQL endpoint used by the public site. It currently does two things:

  • read a NU.nl section/list page and return article URLs
  • fetch a public article URL and return a small parsed article object

[!WARNING] This is an unofficial client for NU.nl web endpoints. It intentionally fails loudly if NU.nl changes the article response shape.

Install

Install from PyPI:

pip install nu-private-api

Or from a checkout:

pip install .

Usage

from nu_private_api import NuClient, SectionUrl

client = NuClient()

urls = client.section_by_url(SectionUrl.BINNENLAND)
article = client.article_by_url(urls[0])

print(article.title)
print(article.author)
print(article.body)

Raw section URLs work too:

urls = client.section_by_url("https://www.nu.nl/binnenland")

You can also pass your own configured httpx.Client:

import httpx
from nu_private_api import NuClient

http = httpx.Client(timeout=10)
client = NuClient(client=http)

API

NuClient.section_by_url(url)

Fetches a NU.nl section/list URL and returns de-duped absolute article URLs.

urls = client.section_by_url(SectionUrl.ECONOMIE)

url can be either a SectionUrl enum value or a string URL.

NuClient.article_by_url(url)

Fetches and parses a public article URL.

article = client.article_by_url(urls[0])

Returns an Article dataclass:

Article(
    url="...",
    title="...",
    description="...",
    published_at="...",
    modified_at="...",
    author="...",
    body="...",
)

Python Shell Smoke Test

python
from nu_private_api import NuClient, SectionUrl

client = NuClient()
urls = client.section_by_url(SectionUrl.BINNENLAND)
article = client.article_by_url(urls[0])

assert urls
assert article.title
assert article.description
assert article.published_at
assert article.author
assert article.body

Project Layout

nu_private_api/
  __init__.py      public exports
  client.py        HTTP client and parsers
  sections.py      generated NU.nl section URL enum

docs/apis/         captured API notes
scripts/           capture and replay helpers
artifacts/         captured request data

Notes

  • Public article reads do not require cookies or login.
  • article_by_url() follows the currently observed NU.nl article shape: base64 JSON-LD schema, screenMetadata, and article text blocks.
  • The client is intentionally small. Add packaging, tests, and broader parsing only when the library needs them.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nu_private_api-0.1.0.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nu_private_api-0.1.0-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file nu_private_api-0.1.0.tar.gz.

File metadata

  • Download URL: nu_private_api-0.1.0.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.7

File hashes

Hashes for nu_private_api-0.1.0.tar.gz
Algorithm Hash digest
SHA256 261e8173270dc25a14f3ba3365017fcd4fe6d7224bb8193c42d5db288c0d55ce
MD5 2049b470e26ba527a85dd76848fa9299
BLAKE2b-256 0136e464e7f72be2bf4280a5fd7f3c904f7002313aee06b788b11ce92932110a

See more details on using hashes here.

File details

Details for the file nu_private_api-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: nu_private_api-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.7

File hashes

Hashes for nu_private_api-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ba865b2c473bb71e5b5bb70e33521a190a36f404829a434c105bbd5df891932e
MD5 7de1f40ddef73f06365d0b7c259f935c
BLAKE2b-256 92fd64d42e998ff05d7faaecbe3600d03d5802494cd549418846a56170c68126

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page