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
Release files for wikipedia-searcher 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| wikipedia-searcher-0.0.5.tar.gz | 5.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| wikipedia_searcher-0.0.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.7 kB
Release files / wikipedia-searcher-0.0.5.tar.gz
| Download URL | wikipedia-searcher-0.0.5.tar.gz |
|---|---|
| Size | 5.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
02b09943c5f3a5a7dd0830fbc9dca381a4cd2ba5a6332ed8b20ae3706935b7b7
|
|
BLAKE2b-256 checksum How to use checksums |
7343dfe1e2796d33e22c24609e7444f76b8a1b48429c8357ac4eec33a7257071
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / wikipedia_searcher-0.0.5-py3-none-any.whl
| Download URL | wikipedia_searcher-0.0.5-py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b17ea3c80c28d67c81e93345d9e5371153d08bb35e181e80721e57bcef7df87f
|
|
BLAKE2b-256 checksum How to use checksums |
e91ffb764621f32281d83283bec35ac94f621b2328f172a9838bab3f1436a7e3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|