Skip to content

Latest commit

 

History

History
176 lines (108 loc) · 3.87 KB

README.org

File metadata and controls

176 lines (108 loc) · 3.87 KB

Theodor Fontane on Wikipedia

Preparation

Install the Python library pageviewapi, that uses the PageView API from Wikimedia Foundation.

pip3 install git+https://github.com/Commonists/pageview-api.git

Download 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_files and use your credentials in the prompt.
  • After the user files have been generated user-password.py and user-config.py are available, which should contain the credentials.
  • Run python3 pwb.py login for verification.

“Theodor Fontane” articles in different Wikipedia language editions

Extract data from Wikipedia using wiki.py:

python3 core_stable/pwb.py wiki.py --languages "Theodor Fontane" > interwiki.tsv

Plot some of the columns using interwiki.gpi:

gnuplot interwiki.gpi

text length (wiki markup)

interwiki_textlen.png

number of contributors

interwiki_contributors.png

number of revisions

interwiki_revisions.png

number of backlinks

interwiki_backlinks.png

number of pageviews

interwiki_pageviews.png

date of the first version of a page

interwiki_firstrev.png

Articles of Fontane’s works (in the German Wikipedia)

Starting 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.tsv

Plot some of the columns using works.gpi:

gnuplot works.gpi

text length (wiki markup)

works_textlen.png

number of contributors

works_contributors.png

number of revisions

works_revisions.png

number of backlinks

works_backlinks.png

number of pageviews

works_pageviews.png

number of language editions

works_languages.png

date of the first version of a page

works_firstrev.png

Contemporaries of Fontane

Download 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.tsv

Plot some of the columns using contemporaries.gpi:

gnuplot contemporaries.gpi

text length (wiki markup)

contemporaries_textlen.png

number of contributors

contemporaries_contributors.png

number of revisions

contemporaries_revisions.png

number of backlinks

contemporaries_backlinks.png

number of pageviews

contemporaries_pageviews.png

number of language editions

contemporaries_languages.png

date of the first version of a page

contemporaries_firstrev.png