Skip to main content

Consume Wikivoyage pages into pure (elegant) Markdown. Probably.

Project description

wikivoyage

Consume Wikivoyage into pure (elegant) Markdown. Probably.

$ pip install wikivoyage

Usage

Just do what you want.

import wikivoyage

# Learn about the States
res = wikivoyage.get("https://en.wikivoyage.org/wiki/United_States_of_America")
print(res)
WikivoyageSections(
    url='https://en.wikivoyag…',
    sections=[
        Section(
            title='United States of America', 
            content='The **United States of America** spans a continent…'
        ), 
        Section(
            title='Regions', 
            content="Wikivoyage organizes the 50 states and the nation'…"
        ), 
        Section(
            title='Cities', 
            content='The following is a list of nine of the most notabl…'
        ),
        ...
    ]
)

Super simple.

Why?

I'm initially an "i-aint-reading-allat" person, thus I made this project so I can better categorize all the sections from a Wikivoyage page, feed it to an LLM and summarize it for me.

Check out where-next, a Next.JS project created by me to learn more.

API Reference

The juicy API reference. Press CTRL + F to search for what you need or type directly in the search bar if you're on mobile.

def get()

get(url: str, **requests_kwargs) -> WikivoyageSections

Fetches a Wikivoyage page and parses it into Markdown.

Args:

  • url (str): The URL.
  • **requests_kwargs: Keyword-only arguments to pass into requests.get.

Returns:
WikivoyageSections: Wikivoyage sections.

dataclass WikivoyageSections

Represents all the Wikivoyage sections. (manually-created)

class WikivoyageSections:
    url: str  # The request URL
    sections: List[Section]  # Sections

dataclass Section

Repersents a Wikivoyage section. (manually-created)

class Section:
    title: str  # The title. Alias: `section`
    content: str  # The content. Alias: `markdown`

Contributing

Contributions are welcome! And yes, I'm not really familiar with GitHub so please help me.

License

MIT License.

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

wikivoyage-0.2.tar.gz (5.2 kB view details)

Uploaded Source

File details

Details for the file wikivoyage-0.2.tar.gz.

File metadata

  • Download URL: wikivoyage-0.2.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for wikivoyage-0.2.tar.gz
Algorithm Hash digest
SHA256 2e64f8ce74a61a9f61b8ad01d564357985eb066a4a21e65aa28588abe81a2a0c
MD5 8d0c25c10d7b61dd49ac24dba466c3b0
BLAKE2b-256 12971f1c2fa19fd3f5edaa72a1356da563037017d61649357c5bed6e6bba44a8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page