Skip to main content

A simple async python library for search pages and images in wikis

Project description

📚 wikipya

A simple async python library for search pages and images in wikis


🛠 Usage

# Import wikipya
from wikipya import Wikipya

# Create Wikipya object with Wikipedia methods
wiki = Wikipya(lang="en").get_instance()

# or use other MediaEiki server (or other service, but this is'n fully supported now)

wikipya = Wikipya(url="https://ipv6.lurkmo.re/api.php", lurk=True, prefix="").get_instance()

# for use Lurkmore (russian). simple and fast

# Get a pages list from search
search = await wiki.search("test")

# Get a pages list from opensearch
opensearch = await wiki.opensearch("test")

# Get page class
# You can give to wiki.page() search item, title of page, page id

# Search item (supported ONLY by wiki.search)
page = await wiki.page(search[0])

# Page title
page = await wiki.page("git")

# Pageid
page = await wiki.page(800543)

print(page.html)       # Get page html
print(page.parsed)     # Get html cleared of link, and other non-formating tags

# Get image
image = await wiki.image(page.title)  # may not work in non-wikipedia services, check true prefix, or create issue

print(image.source)    # Image url
print(image.width)     # Image width
print(image.height)    # Image height

🎉 Features

  • Full async
  • Support of other instances of MediaWiki
  • Support cleaning of HTML with TgHTML
  • Uses models by pydantic

🚀 Install

To install, run this code:

pip install wikipya

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

wikipya-4.1.2.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

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

wikipya-4.1.2-py3-none-any.whl (17.3 kB view details)

Uploaded Python 3

File details

Details for the file wikipya-4.1.2.tar.gz.

File metadata

  • Download URL: wikipya-4.1.2.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.3

File hashes

Hashes for wikipya-4.1.2.tar.gz
Algorithm Hash digest
SHA256 0aad851900f9fd8ef969a7f4728b2396dba18b89924c0e7533d7246ddd712548
MD5 aeb5298a9e986fdce41f5823f612d33f
BLAKE2b-256 c4b5aa7134277d50653a596811bb2c3c294758476bddfbff95d3d53e2cb37636

See more details on using hashes here.

File details

Details for the file wikipya-4.1.2-py3-none-any.whl.

File metadata

  • Download URL: wikipya-4.1.2-py3-none-any.whl
  • Upload date:
  • Size: 17.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.3

File hashes

Hashes for wikipya-4.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c86b74fb6e3f38728898a3a96eeb22b37abea3210b57990544be5c3f15b97aba
MD5 fc7da0b285d8ad813ccb82ea2f859939
BLAKE2b-256 6e18b6ce83b7c0067dd04ad0a36bf4fe34444c0c1e3b1a1622425833d4067599

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 Pingdom Monitoring Sentry Error logging StatusPage Status page