You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

119 lines
4.5 KiB
Plaintext

{
"cells": [
{
"cell_type": "markdown",
"id": "e2544890-3bb4-4457-a4c3-9711121c59f9",
"metadata": {},
"source": [
"Epicpedia: graduation work made in 2008 by Networked Media student Annemieke van der Hoek \n",
"https://pzwiki.wdka.nl/mediadesign/Epicpedia\n",
"\n",
"Later Annemieke would present the work, in collaboration with her sister as a theater performance and workshop at VJ12: \n",
"https://video.constantvzw.org/vj12/epicpedia.ogv\n",
"\n",
"Following example begrudginly given here: \n",
"https://stackoverflow.com/questions/52283962/how-to-find-textual-differences-between-revisions-on-wikipedia-pages-with-mwclie\n",
"\n",
"https://www.mediawiki.org/wiki/API:Compare\n",
"\n",
"\n",
"Considering: \n",
"https://en.wikipedia.org/wiki/Han_Kang\n",
"\n",
"Oldest revision: \n",
"https://en.wikipedia.org/w/index.php?title=Han_Kang&oldid=376586279\n",
"\n",
"Thanks, Fred, now I see that there's a [REST API](https://www.mediawiki.org/wiki/API:REST_API) as well. Not sure what the differences are.\n",
"\n",
"Also using the URLSearchParams class in js: \n",
"https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams\n",
"\n",
"Using the classic/action API, there's page > revisions: \n",
"https://www.mediawiki.org/wiki/API:Revisions\n",
"\n",
"Examples given on API:Revisions page:\n",
"\n",
"Last 5 edits\n",
"\n",
"https://www.mediawiki.org/w/api.php?action=query&prop=revisions&titles=MediaWiki&rvlimit=5&rvprop=timestamp|user|comment\n",
"\n",
"first edits\n",
"\n",
"https://www.mediawiki.org/w/api.php?action=query&prop=revisions&titles=MediaWiki&rvlimit=5&rvprop=timestamp|user|comment&rvdir=newer\n",
"\n",
"Adding ids and flags\n",
"\n",
"https://www.mediawiki.org/w/api.php?action=query&prop=revisions&titles=MediaWiki&rvlimit=5&rvprop=timestamp|user|comment|ids|flags&rvdir=newer\n",
"\n",
"adapted to Han Kang's entry:\n",
"\n",
"https://www.mediawiki.org/w/api.php?action=query&prop=revisions&titles=Han_Kang&rvlimit=5&rvprop=timestamp|user|comment|ids|flags&rvdir=newer\n",
"\n",
"https://en.wikipedia.org/w/api.php?action=query&prop=revisions&titles=Han%20Kang&rvlimit=5&rvprop=timestamp|user|comment|ids|flags&rvdir=newer\n",
"\n",
"\n",
"\n",
"\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "b3a48c4e-dcb3-4fa7-9524-e4fc8eae8a39",
"metadata": {},
"outputs": [
{
"ename": "ModuleNotFoundError",
"evalue": "No module named 'mwclient'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[1], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mmwclient\u001b[39;00m\n\u001b[1;32m 3\u001b[0m revisions \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mlist\u001b[39m(page\u001b[38;5;241m.\u001b[39mrevisions(prop\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mids\u001b[39m\u001b[38;5;124m'\u001b[39m)) \n\u001b[1;32m 4\u001b[0m last_revision_id \u001b[38;5;241m=\u001b[39m revisions[\u001b[38;5;241m-\u001b[39m\u001b[38;5;241m1\u001b[39m][\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mrevid\u001b[39m\u001b[38;5;124m'\u001b[39m]\n",
"\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'mwclient'"
]
}
],
"source": [
"import mwclient\n",
"\n",
"revisions = list(page.revisions(prop='ids')) \n",
"last_revision_id = revisions[-1]['revid']\n",
"first_revision_id = revisions[0]['revid']\n",
"compare_result = site.get('compare', fromrev=last_revision_id, torev=first_revision_id)\n",
"html_diff = compare_result['compare']['*']\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f710d169-e284-4e27-834b-e31d98d7bf63",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.2"
}
},
"nbformat": 4,
"nbformat_minor": 5
}