Editing DS4UX (Spring 2016)/Wikipedia API
From CommunityData
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
[[File:Wikipedia.png|right|250px]] | [[File:Wikipedia.png|right|250px]] | ||
== Getting data from Wikipedia | == Getting data from the Wikipedia API == | ||
In this project, we will explore a few ways to gather data using the Wikipedia API. Once we've done that, we will extend this to code to create our own datasets of Wikipedia edits or other data that we might be able to use to ask and answer questions in future sessions. | In this project, we will explore a few ways to gather data using the Wikipedia API. Once we've done that, we will extend this to code to create our own datasets of Wikipedia edits or other data that we might be able to use to ask and answer questions in future sessions. | ||
Line 16: | Line 16: | ||
=== Download and test the Wikipedia project === | === Download and test the Wikipedia project === | ||
# Right click the following file, click "Save Target as..." or "Save link as...", and save it to your Desktop directory: FIXME | |||
# The ".zip" extension on the above file indicates that it is a compressed Zip archive. We need to "extract" its contents. | # The ".zip" extension on the above file indicates that it is a compressed Zip archive. We need to "extract" its contents. | ||
Line 23: | Line 23: | ||
python wikipedia1-1.py | python wikipedia1-1.py | ||
== What | == What is Wikipedia? == | ||
* As you probably already know, Wikipedia is a website that anyone can edit. | * As you probably already know, Wikipedia is a website that anyone can edit. | ||
Line 56: | Line 56: | ||
=== Editor metadata === | === Editor metadata === | ||
You can get metadata about a particular editor through the <code>usercontribs=</code> parameter. Here are some of the things you can get ([https://www.mediawiki.org/wiki/API:Revisions#Parameters Click here for the full list]): | |||
* | * https://www.mediawiki.org/wiki/API:Usercontribs | ||
* https://www.mediawiki.org/wiki/API:Users | |||
=== Page text and metadata === | === Page text and metadata === | ||
Line 67: | Line 68: | ||
* categorymembers: all of the pages that are in a particular category: https://www.mediawiki.org/wiki/API:Categorymembers | * categorymembers: all of the pages that are in a particular category: https://www.mediawiki.org/wiki/API:Categorymembers | ||
* pageprops: basic information about the page: https://www.mediawiki.org/wiki/API:Pageprops | * pageprops: basic information about the page: https://www.mediawiki.org/wiki/API:Pageprops | ||
== Anatomy of the API query == | |||
=== Building and testing queries === | |||
Line 78: | Line 85: | ||
There are several other interesting examples [[Sample_Wikipedia_API_queries|available on the Sample API queries page]]. | There are several other interesting examples [[Sample_Wikipedia_API_queries|available on the Sample API queries page]]. | ||
== Resources == | == Next steps == | ||
=== API === | === Resources === | ||
==== API ==== | |||
* [https://www.mediawiki.org/wiki/API:Main_page Main MediaWiki API Documentation] | * [https://www.mediawiki.org/wiki/API:Main_page Main MediaWiki API Documentation] | ||
* [https://en.wikipedia.org/w/api.php Autogenerated API Documentation] | * [https://en.wikipedia.org/w/api.php Autogenerated API Documentation] | ||
Line 85: | Line 93: | ||
* [[Sample API queries]] | * [[Sample API queries]] | ||
=== Research using Wikipedia data === | ==== Research using Wikipedia data ==== | ||
* ''[https://www.research.ibm.com/visual/projects/history_flow/ HistoryFlow]'' — A colorful visualization of the development of Wikipedia articles over time. | * ''[https://www.research.ibm.com/visual/projects/history_flow/ HistoryFlow]'' — A colorful visualization of the development of Wikipedia articles over time. | ||
* [http://www.brianckeegan.com/papers/CSCW_2015.pdf ‘Is’ to ‘Was’: Coordination and Commemoration on Posthumous Wikipedia Biographies] — an exploration of editing patterns around Wikipedia articles about people who have recently died. | * [http://www.brianckeegan.com/papers/CSCW_2015.pdf ‘Is’ to ‘Was’: Coordination and Commemoration on | ||
Posthumous Wikipedia Biographies] — an exploration of editing patterns around Wikipedia articles about people who have recently died. | |||
* [http://www.brianckeegan.com/papers/ICS_2015.pdf WikiWorthy: Judging a Candidate’s Notability in the Community] — A study that uses the editing activity on Wikipedia articles about political candidates as a predictor of election success. | * [http://www.brianckeegan.com/papers/ICS_2015.pdf WikiWorthy: Judging a Candidate’s Notability in the Community] — A study that uses the editing activity on Wikipedia articles about political candidates as a predictor of election success. | ||
=== Websites that use the MediaWiki API === | ==== Websites that use the MediaWiki API ==== | ||
[[Category:DS4UX (Spring 2016)]] | [[Category:DS4UX (Spring 2016)]] |