Consume Wikivoyage into pure (elegant) Markdown. Probably.
$ pip install wikivoyage
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.
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.
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.
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.
Represents all the Wikivoyage sections. (manually-created)
class WikivoyageSections:
url: str # The request URL
sections: List[Section] # Sections
Repersents a Wikivoyage section. (manually-created)
class Section:
title: str # The title. Alias: `section`
content: str # The content. Alias: `markdown`
Contributions are welcome! And yes, I'm not really familiar with GitHub so please help me.
MIT License.