Install the Python library pageviewapi, that uses the PageView API from Wikimedia Foundation.
pip3 install git+https://github.com/Commonists/pageview-api.gitDownload and extract Pywikibot, a Python library for interacting with Wikipedia:
wget https://tools.wmflabs.org/pywikibot/core_stable.tar.gz
tar xzf core_stable.tar.gz- Then generate your bot password on https://www.mediawiki.org/wiki/Special:BotPasswords (or the corresponding page on another wiki).
- After setting rights and range (i.e., 0.0.0.0) you will receive a message like The new password to log in with Valhallasw@my-botpassword-name is mysupersecretbotpassword.
- Do not close this window until you saved the password in your password file.
- Run
python3 pwb.py generate_user_filesand use your credentials in the prompt. - After the user files have been generated
user-password.pyanduser-config.pyare available, which should contain the credentials. - Run
python3 pwb.py loginfor verification.
Extract data from Wikipedia using wiki.py:
python3 core_stable/pwb.py wiki.py --languages "Theodor Fontane" > interwiki.tsvPlot some of the columns using interwiki.gpi:
gnuplot interwiki.gpiStarting point is the Wikipedia category https://de.wikipedia.org/wiki/Kategorie:Werk_von_Theodor_Fontane.
Extract data from Wikipedia using wiki.py:
python3 core_stable/pwb.py wiki.py --category "Kategorie:Werk_von_Theodor_Fontane" > works.tsvPlot some of the columns using works.gpi:
gnuplot works.gpiDownload the result of the SPARQL query https://w.wiki/aNi as TSV file contemporaries_wikidata.tsv and then extract data from Wikipedia using wiki.py:
python3 core_stable/pwb.py wiki.py --file contemporaries_wikidata.tsv > contemporaries.tsvPlot some of the columns using contemporaries.gpi:
gnuplot contemporaries.gpi


















