Skip to main content

A script that scrapes wikipedia

Project description

wikipedia-searcher

wikipedia-searcher is a library for scraping wikipedia information.

>>> from wikisearch.wikisearcher import WikiSearcher
>>> searcher = WikiSearcher()
>>> searcher.search('React.js')
'React (also known as React.js or ReactJS) is a free and open-source front-end JavaScript library[3] for building user interfaces or UI components.'

If a search has has many options it returns a dictionary with a list of articles. You can can also pass the article to search.

>>> from pprint import pprint
>>> search_result = searcher.search('The Hills')
>>> pprint(search_result)
>>> {'Places': [<wikisearch.article.ArticleLink object at 0x00000208A22EFAC0>,
            <wikisearch.article.ArticleLink object at 0x00000208A22EF7F0>,
            <wikisearch.article.ArticleLink object at 0x00000208A22EF6A0>,
            <wikisearch.article.ArticleLink object at 0x00000208A22EF400>,
            <wikisearch.article.ArticleLink object at 0x00000208A22EF3D0>,
            <wikisearch.article.ArticleLink object at 0x00000208A22EF370>],
 'Popular culture': [<wikisearch.article.ArticleLink object at 0x00000208A22EF940>,
                     <wikisearch.article.ArticleLink object at 0x00000208A22EF880>],
 'See also': [<wikisearch.article.ArticleLink object at 0x00000208A22EF340>,
              <wikisearch.article.ArticleLink object at 0x00000208A22EF8E0>]}
>>> article = search_result['Places'][0]
>>> article.name
'Santa Monica Mountains'
>>> article.link
'/wiki/Santa_Monica_Mountains'
>>> searcher.search(article)
'The Santa Monica Mountains is a coastal mountain range in Southern....'

How to Install

Requests is available on PyPI:

$ pip install wikipedia-searcher

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

wikipedia-searcher-0.0.5.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

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

wikipedia_searcher-0.0.5-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file wikipedia-searcher-0.0.5.tar.gz.

File metadata

  • Download URL: wikipedia-searcher-0.0.5.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.0

File hashes

Hashes for wikipedia-searcher-0.0.5.tar.gz
Algorithm Hash digest
SHA256 02b09943c5f3a5a7dd0830fbc9dca381a4cd2ba5a6332ed8b20ae3706935b7b7
MD5 4063a76ed4c4d5f207e27956cb89da02
BLAKE2b-256 7343dfe1e2796d33e22c24609e7444f76b8a1b48429c8357ac4eec33a7257071

See more details on using hashes here.

File details

Details for the file wikipedia_searcher-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: wikipedia_searcher-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.0

File hashes

Hashes for wikipedia_searcher-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 b17ea3c80c28d67c81e93345d9e5371153d08bb35e181e80721e57bcef7df87f
MD5 f4116f2d36bb86a28d7313e0044847bf
BLAKE2b-256 e91ffb764621f32281d83283bec35ac94f621b2328f172a9838bab3f1436a7e3

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