Skip to main content

unofficial wikihow python api

Project description

PyWikiHow

An unofficial WikiWow python API. Uses BeautifulSoup to scrape WikiHow and return the data you want.

Installation

pip install pywikihow

Usage

Random How To

Learn random stuff! Retuns a random WikiHow article. Sometimes they're weird.

from pywikihow import RandomHowTo

how_to = RandomHowTo()
how_to.print()

Searching

from pywikihow import WikiHow, search_wikihow


max_results = 1  # default for optional argument is 10
how_tos = search_wikihow("how to learn programming", max_results)
assert len(how_tos) == 1
how_tos[0].print()


# for efficiency and to get unlimited entries, the best is to use the generator
for how_to in WikiHow.search("how to learn python"):
    how_to.print()

Parsing

Manipulate HowTo objects

from pywikihow import HowTo

how_to = HowTo("https://www.wikihow.com/Train-a-Dog")

data = how_to.as_dict()

print(how_to.url)
print(how_to.title)
print(how_to.intro)
print(how_to.n_steps)
print(how_to.summary)

first_step = how_to.steps[0]
first_step.print()
data = first_step.as_dict()

how_to.print(extended=True)

ToDo

  • Many WikiHow articles also contain "Parts" which break down further into sub-steps. Write a function to parse these additional divisions.
  • Add parser for tips
  • Add parser for warnings

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

pywikihow-0.5.6a1.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

pywikihow-0.5.6a1-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file pywikihow-0.5.6a1.tar.gz.

File metadata

  • Download URL: pywikihow-0.5.6a1.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for pywikihow-0.5.6a1.tar.gz
Algorithm Hash digest
SHA256 e90289cfe5237a662c5c7114a66b50b5008ddfb9809efd09d24cb048b4793cfd
MD5 809ee4825d149b5d6206b7fb2d822d60
BLAKE2b-256 5856c3618d26142fb335a484904948ab6d4d3c77804ecee481d7cc5786d02a39

See more details on using hashes here.

File details

Details for the file pywikihow-0.5.6a1-py3-none-any.whl.

File metadata

  • Download URL: pywikihow-0.5.6a1-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for pywikihow-0.5.6a1-py3-none-any.whl
Algorithm Hash digest
SHA256 f9c46be63998c9c3d597474427fdf1fff5489e3de0a314128664ec63f73f6bcb
MD5 ce2dd006a5f4c32cd3840d63efb04669
BLAKE2b-256 61bccb5dce78fa266475365858fec919fea72d141b2cc0c480302454336e3d96

See more details on using hashes here.

Supported by

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