Skip to main content

API to extract more data from wikiHow

Project description

wikihowAPI_pk

wikihowAPI_pk is basically base on vigilant-umbrella/wikiHowUnofficialAPI but add more parser on it.

New features

  • Return map(json) format for server use
  • Video Parser in Method section: each method is either one picture or video
  • Ingredients parser
  • Video Parser in section: some page would have videos after method section
  • Parer to show more tipps
  • Make <li> inside a Text visible after parsing

Installation

pip install wikiHowUnofficialAPI, wikihowAPI-pk

Usage

Random HowTo

Learn random stuff! Retuns a random WikiHow article URL.

import wikihowunofficialapi as wha

ra = wha.random_article()
print(ra)

Article Details

Uses the article URL to return various details about an article. In addition, it returns whether an article is written by an expert or not.

import wikihowunofficialapi as wha

article = wha.Article('https://www.wikihow.com/Train-a-Dog')

print(article.url)					# Print Article's URL
print(article.title)					# Print Article's Title
print(article.intro)					# Print Article's Introduction
print(article.n_methods)				# Print number of methods in an Article
print(article.methods)					# Print a list of methods in an Article
print(article.num_votes)				# Print number of votes given to an Article
print(article.percent_helpful)				# Print percentage of helpful votes given to an Article
print(article.is_expert)				# Print True if the Article is written by an expert
print(article.last_updated)				# Print date when the Article was last updated
print(article.views)					# Print the number of views recieved by Article
print(article.co_authors)				# Print the number of co-authors of an Article
print(article.references)				# Print the number of references in an Article
print(article.summary)					# Print Article's summary
print(article.warnings)					# Print Article's warnings
print(article.tips)					# Print Article's tips

first_method = article.methods[0]
first_step = first_method.steps[0]
print(first_step)					# Print Article's first step of the first method
print(first_step.title)					# Print the title of Article's first step of the first method
print(first_step.description)				# Print the description of Article's first step of the first method

Images

Retrieves a list of image included in a step as URLs.

import wikihowunofficialapi as wha

article = wha.Article('https://www.wikihow.com/Train-a-Dog')
print(article.methods[0].steps[0].picture)		# Print the URL of the image of Article's first step of the first method

Search

Searches WikiHow for the string and returns a list containing the title of the articles. The default max results is 10, but this can be changed.

import wikihowunofficialapi as wha

max_results = 1
how_tos = wha.search_wikihow("sleep", max_results)
print(how_tos[0])

Json as ouput

The fields in map are basically the same as Article Details

import wikihowunofficialapi as wha

article = wha.Article('https://www.wikihow.com/Train-a-Dog')
article_json :Map = article.get()

Credit

Most of the codes are base on vigilant-umbrella/wikiHowUnofficialAPI

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

wikihowapi_pk-0.0.3.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

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

wikihowapi_pk-0.0.3-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file wikihowapi_pk-0.0.3.tar.gz.

File metadata

  • Download URL: wikihowapi_pk-0.0.3.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.16

File hashes

Hashes for wikihowapi_pk-0.0.3.tar.gz
Algorithm Hash digest
SHA256 988fd22309c4f599f2b852bef167051f20379d04a1c7318f2ba6d99dce445875
MD5 db407b30946849856291a49f392f7d4a
BLAKE2b-256 41a5fe316742c18953099adf35e8c1c6c92f70ee3f1128e66f9d9e7de5a4c912

See more details on using hashes here.

File details

Details for the file wikihowapi_pk-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: wikihowapi_pk-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.16

File hashes

Hashes for wikihowapi_pk-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 77b29f6e1a2a5b18b085b6101bb5d9c9b526dd551b741c82922f01beb154e3b3
MD5 97747d45851cf751d5cdb06e67caaf56
BLAKE2b-256 7df989d98923062418390a4907a75ad0d6ab4eeca3be5427173e20890e39181c

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