epicpedia

main
Michael Murtaugh 2 months ago
parent 539f6262a7
commit dbcf04fd5b

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<input id="title" type="text" />
<button id="go">go</button>
<script src="epicpedia_2024.js"></script>
<script>
let title_elt = document.querySelector("#title");
let go_elt = document.querySelector("#go");
go_elt.addEventListener("click", e => {
let title = title_elt.value;
console.log("search for article named", title);
});
</script>
</body>
</html>

@ -0,0 +1,118 @@
{
"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
}

@ -0,0 +1,18 @@
var url = "https://en.wikipedia.org/w/api.php";
var params = {
action: "compare",
format: "json",
fromtitle: "Template:Unsigned",
totitle: "Template:UnsignedIP",
origin: "*"
};
fetch(url + "?" + (new URLSearchParams(params)).toString())
.then(resp => resp.json())
.then(data => {
console.log("data", data);
})
.catch(err => {
console.log("bad", err);
});

@ -0,0 +1,172 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
<head>
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<title>radio_plays</title>
<style>
html {
line-height: 1.5;
font-family: Georgia, serif;
font-size: 20px;
color: #1a1a1a;
background-color: #fdfdfd;
}
body {
margin: 0 auto;
max-width: 36em;
padding-left: 50px;
padding-right: 50px;
padding-top: 50px;
padding-bottom: 50px;
hyphens: auto;
overflow-wrap: break-word;
text-rendering: optimizeLegibility;
font-kerning: normal;
}
@media (max-width: 600px) {
body {
font-size: 0.9em;
padding: 1em;
}
h1 {
font-size: 1.8em;
}
}
@media print {
body {
background-color: transparent;
color: black;
font-size: 12pt;
}
p, h2, h3 {
orphans: 3;
widows: 3;
}
h2, h3, h4 {
page-break-after: avoid;
}
}
p {
margin: 1em 0;
}
a {
color: #1a1a1a;
}
a:visited {
color: #1a1a1a;
}
img {
max-width: 100%;
}
h1, h2, h3, h4, h5, h6 {
margin-top: 1.4em;
}
h5, h6 {
font-size: 1em;
font-style: italic;
}
h6 {
font-weight: normal;
}
ol, ul {
padding-left: 1.7em;
margin-top: 1em;
}
li > ol, li > ul {
margin-top: 0;
}
blockquote {
margin: 1em 0 1em 1.7em;
padding-left: 1em;
border-left: 2px solid #e6e6e6;
color: #606060;
}
code {
font-family: Menlo, Monaco, 'Lucida Console', Consolas, monospace;
font-size: 85%;
margin: 0;
}
pre {
margin: 1em 0;
overflow: auto;
}
pre code {
padding: 0;
overflow: visible;
overflow-wrap: normal;
}
.sourceCode {
background-color: transparent;
overflow: visible;
}
hr {
background-color: #1a1a1a;
border: none;
height: 1px;
margin: 1em 0;
}
table {
margin: 1em 0;
border-collapse: collapse;
width: 100%;
overflow-x: auto;
display: block;
font-variant-numeric: lining-nums tabular-nums;
}
table caption {
margin-bottom: 0.75em;
}
tbody {
margin-top: 0.5em;
border-top: 1px solid #1a1a1a;
border-bottom: 1px solid #1a1a1a;
}
th {
border-top: 1px solid #1a1a1a;
padding: 0.25em 0.5em 0.25em 0.5em;
}
td {
padding: 0.125em 0.5em 0.25em 0.5em;
}
header {
margin-bottom: 4em;
text-align: center;
}
#TOC li {
list-style: none;
}
#TOC ul {
padding-left: 1.3em;
}
#TOC > ul {
padding-left: 0;
}
#TOC a:not(:hover) {
text-decoration: none;
}
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
span.underline{text-decoration: underline;}
div.column{display: inline-block; vertical-align: top; width: 50%;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
ul.task-list{list-style: none;}
.display.math{display: block; text-align: center; margin: 0.5rem auto;}
</style>
</head>
<body>
<p>Georges Perec - Die Maschine</p>
<ul>
<li><a href="https://hub.xpub.nl/bootleglibrary/read/918/pdf">The
Machine: English translation</a></li>
<li><a href="https://hub.xpub.nl/bootleglibrary/book/789">Mainframe
Experimentalism</a>, Bellos article (chapter 2)</li>
<li><a
href="https://hub.xpub.nl/bootleglibrary/read/789/epub#epubcfi(/6/22%5Bchp02%5D!/4/2/4/1:0)"
class="uri">https://hub.xpub.nl/bootleglibrary/read/789/epub#epubcfi(/6/22[chp02]!/4/2/4/1:0)</a></li>
<li><a href="https://calibre.constantvzw.org/read/29/pdf">VJ12
programme</a></li>
</ul>
</body>
</html>

@ -0,0 +1,7 @@
Georges Perec - Die Maschine
* [The Machine: English translation](https://hub.xpub.nl/bootleglibrary/read/918/pdf)
* [Mainframe Experimentalism](https://hub.xpub.nl/bootleglibrary/book/789), Bellos article (chapter 2)
* <https://hub.xpub.nl/bootleglibrary/read/789/epub#epubcfi(/6/22[chp02]!/4/2/4/1:0)>
* [VJ12 programme](https://calibre.constantvzw.org/read/29/pdf)

@ -0,0 +1,48 @@
<!doctype html>
<html>
<head>
<style>
ins { color: green }
del { color: red }
#comment { font-style: italic; }
</style>
</head>
<body>
<button id="next">next</button>
<div id="timestamp"></div>
<div id="user"></div>
<div id="comment"></div>
<div id="result"></div>
<script>
let r = {
action: "compare",
format: "json",
fromtitle: "Han Kang",
totitle: "Han Kang",
torelative: "next",
formatversion: 2,
prop: "diff|ids|title|user|comment|parsedcomment|timestamp",
difftype: "inline", // table, inline, unified
origin: "*"
}
let api_url = "https://en.wikipedia.org/w/api.php"
let revid = 376586279;
// let url = "https://en.wikipedia.org/w/api.php?action=compare&format=json&fromtitle=Han%20Kang&fromrev=376586279&totitle=Han%20Kang&torelative=next&formatversion=2&origin=*";
let next = document.querySelector("button#next");
next.addEventListener("click", e=> {
r.fromrev = revid;
fetch(api_url + "?" + new URLSearchParams(r)).then(resp => resp.json()).then(data => {
console.log("data", data);
let result = document.querySelector("#result");
result.innerHTML = data.compare.body;
revid = data.compare.torevid;
console.log("next revid", revid);
document.querySelector("#user").textContent = data.compare.touser;
document.querySelector("#timestamp").textContent = data.compare.totimestamp;
document.querySelector("#comment").textContent = data.compare.tocomment;
});
})
</script>
</body>
</html>
Loading…
Cancel
Save