forked from zotero/translators
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Artforum.js
438 lines (419 loc) · 16 KB
/
Artforum.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
{
"translatorID": "a127f012-4ea4-4d05-a657-24d47f91b016",
"label": "Artforum",
"creator": "czar",
"target": "^https?://(www\\.)?artforum\\.com/",
"minVersion": "3.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2021-09-02 00:33:38"
}
/*
***** BEGIN LICENSE BLOCK *****
Copyright © 2018 czar
http://en.wikipedia.org/wiki/User_talk:Czar
This file is part of Zotero.
Zotero is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Zotero is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
***** END LICENSE BLOCK *****
*/
function detectWeb(doc, url) {
if (/-\d{5,}([?#].*)?$/.test(url)) {
if (doc.querySelector('h3.print-article__issue-title')) {
return "magazineArticle";
}
return "blogPost";
}
else if (getSearchResults(doc, true)) {
return "multiple";
}
return false;
}
function scrape(doc, url) {
var translator = Zotero.loadTranslator('web');
translator.setTranslator('951c027d-74ac-47d4-a107-9c3069ab7b48'); // embedded metadata (EM)
translator.setDocument(doc);
translator.setHandler('itemDone', function (obj, item) { // corrections to EM
item.publicationTitle = "Artforum";
item.language = 'en-US';
var jsonLD = doc.querySelector('script[type="application/ld+json"]');
if (jsonLD) {
jsonLD = JSON.parse(jsonLD.textContent);
item.title = jsonLD.name;
item.date = jsonLD.dateModified || jsonLD.datePublished;
if (!item.creators.length && jsonLD.author) {
item.creators.push(ZU.cleanAuthor(jsonLD.author.name, 'author'));
}
}
var authorMetadata = doc.querySelectorAll('.contrib-link a');
for (let author of authorMetadata) {
item.creators.push(ZU.cleanAuthor(author.text, "author"));
}
if (url.includes('/print/')) {
item.itemType = "magazineArticle";
item.ISSN = "0004-3532";
var issueDate = doc.querySelector('h3.print-article__issue-title');
if (issueDate) {
item.date = issueDate.textContent.trim().replace('PRINT ','');
ZU.doGet(issueDate.querySelector('a').href, function (respText) {
var voliss = respText.match(/Vol\.\s(\d+),\sNo\.\s(\d+)/);
item.volume = voliss[1];
item.issue = voliss[2];
item.complete();
});
} else item.complete();
} else item.complete();
});
translator.getTranslatorObject(function(trans) {
trans.itemType = 'blogPost';
trans.doWeb(doc, url);
});
}
function getSearchResults(doc, checkOnly) {
var items = {};
var found = false;
// 1st for search page, 2nd for issue ToC, 3rd/4th/5th for sections, 5th+ for homepage
var rows = doc.querySelectorAll('h1.results-list__h1, .toc-article__title, .news-list h1, .reviews-list h1, .article-list h1, p.hp-singlefeature-author__writer, h3.hp-news__title, h3.hp-twocolumn__title a, h3.hp-artguide__title, p.hp-bloglist__teaser a');
for (let i = 0; i < rows.length; i++) {
let href = attr(rows[i], 'a', 'href');
if (!href) {
let link = rows[i].closest('a');
if (link) href = link.href;
}
let title = ZU.trimInternal(rows[i].textContent);
if (!href || !title) continue;
if (checkOnly) return true;
found = true;
items[href] = title;
}
return found ? items : false;
}
function doWeb(doc, url) {
switch (detectWeb(doc, url)) {
case "multiple":
Zotero.selectItems(getSearchResults(doc, false), function (items) {
if (!items) {
return;
}
ZU.processDocuments(Object.keys(items), scrape);
});
break;
default:
scrape(doc, url);
break;
}
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "https://www.artforum.com/news/ugochukwu-smooth-nzewi-appointed-curator-of-hood-museum-40747",
"items": [
{
"itemType": "blogPost",
"title": "Ugochukwu-Smooth Nzewi Appointed Curator of Hood Museum",
"creators": [],
"date": "2013-05-06",
"abstractNote": "The Hood Museum of Art at Dartmouth College, Hanover, has appointed Ugochukwu-Smooth Nzewi as its first curator of African Art, reports Artdaily. Born in Nigeria, Nzewi received his PhD in Art History from Emory University. A specialist in modern and contemporary African and African Diaspora arts, he will be responsible in his new role for the documentation, preservation, and research of Hood’s African Art collection, which includes some 1,900 objects. He will also engage Dartmouth faculty and students in the development of curricular programming related to the museum’s African holdings. Nzewi",
"blogTitle": "Artforum",
"language": "en-US",
"url": "https://www.artforum.com/news/ugochukwu-smooth-nzewi-appointed-curator-of-hood-museum-40747",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.artforum.com/diary/kaitlin-phillips-at-the-11th-new-york-art-book-fair-63626",
"items": [
{
"itemType": "blogPost",
"title": "Fine Print",
"creators": [
{
"firstName": "Kaitlin",
"lastName": "Phillips",
"creatorType": "author"
}
],
"date": "2016-09-22",
"abstractNote": "LAST THURSDAY, at the opening night preview of Printed Matter’s NY Book Fair at MoMA PS1, in the popup white dome in the courtyard, at one of the end-to-end merchandise tables, V. Vale (“That’s the name I’m famous under”), founder of RE/Search, complains to a fan that the fair, in its eleventh year, and its host city, have lost their street cred:“I never come to New York. Yeah, I never come to New York. I never come to New York,” says Vale, beaming defiantly.“Well, New York may have jumped the shark.”“I don’t know what that means. Jump the shark.”“It means that something has hit its peak, and",
"blogTitle": "Artforum",
"language": "en-US",
"url": "https://www.artforum.com/diary/kaitlin-phillips-at-the-11th-new-york-art-book-fair-63626",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.artforum.com/picks/alex-da-corte-62421",
"items": [
{
"itemType": "blogPost",
"title": "Alex Da Corte",
"creators": [
{
"firstName": "Aria",
"lastName": "Dean",
"creatorType": "author"
}
],
"date": "2016-07-28",
"abstractNote": "As you enter this space, your senses are bombarded by Alex Da Corte’s scrambled, saturated landscape. A supersized witch’s hat fills the first area, lit by green and red neon from above. This is flanked by a stained-glass window depicting a red rose, referencing Disney’s Beauty and the Beast, and a floor-to-ceiling, blown-up image of a weeping bridesmaid. The exhibition is like a dream: Recognizable elements are mashed together, but something is off, and it gradually morphs into a surreal nightmare.The gallery buzzes with sound from three video works—the focal point of the second room—depicting",
"blogTitle": "Artforum",
"language": "en-US",
"url": "https://www.artforum.com/picks/alex-da-corte-62421",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.artforum.com/film/nick-pinkerton-on-gimme-shelter-hollywood-north-66885",
"items": [
{
"itemType": "blogPost",
"title": "Canadian Makin’",
"creators": [
{
"firstName": "Nick",
"lastName": "Pinkerton",
"creatorType": "author"
}
],
"date": "2017-02-24",
"abstractNote": "AFTER THE EMERGENCE of alluring Canadian production subsidies in the late 1990s, moviegoers of the aughts became inured to watching downtown Vancouver fill in for AnyCity, USA, in a parade of multiplex productions that managed to extract bland back-lot anonymity from location shooting. But Anthology Film Archives’ twelve-film series “Gimme Shelter: Hollywood North” pays tribute to a very different, pioneering era of runaway production, part of an ongoing sesquicentennial celebration of our neighbors above to be followed by “1970s Canadian Independents,” beginning at Anthology on March 9.The",
"blogTitle": "Artforum",
"language": "en-US",
"url": "https://www.artforum.com/film/nick-pinkerton-on-gimme-shelter-hollywood-north-66885",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.artforum.com/print/previews/201701/whitney-biennial-2017-65484",
"items": [
{
"itemType": "magazineArticle",
"title": "Whitney Biennial 2017",
"creators": [
{
"firstName": "Beau",
"lastName": "Rutland",
"creatorType": "author"
}
],
"date": "January 2017",
"ISSN": "0004-3532",
"abstractNote": "Curated by Christopher Y. Lew and Mia LocksFollowing a three-year hiatus to accommodate the museum’s move downtown, the Whitney Biennial makes its Gansevoort Street debut this March. As the republic falls before our very eyes, one hopes that this divisive survey of American art will react against, and not just reflect, the current state of affairs. This year’s roster of sixty-three artists and collectives is thankfully diverse in perspectives and refreshingly full of emerging and underrecognized voices—absent are the many elder statesmen often gratuitously included in these affairs. The",
"issue": "5",
"language": "en-US",
"libraryCatalog": "www.artforum.com",
"publicationTitle": "Artforum",
"url": "https://www.artforum.com/print/previews/201701/whitney-biennial-2017-65484",
"volume": "55",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.artforum.com/interviews/jamie-stewart-talks-about-xiu-xiu-s-record-forget-and-recent-collaborations-66615",
"items": [
{
"itemType": "blogPost",
"title": "Jamie Stewart",
"creators": [
{
"firstName": "Paige K.",
"lastName": "Bradley",
"creatorType": "author"
}
],
"date": "2017-02-21",
"abstractNote": "Across thirteen albums and a handful of EPs, Xiu Xiu have remained a prickly, relentless force, inspiring loyalty, love, annoyance, and disgust in equal measure. Some people never get over their music, and some you couldn’t pay to even approach it. On the occasion of the release of their latest album, FORGET, the band’s mainstay Jamie Stewart discusses how he met Vaginal Davis (who performs on its last track), the band’s collaborations with Danh Vō, and the concept behind the record’s title. Polyvinyl will release FORGET on February 24, 2017.HOW I MET VAGINAL DAVIS is actually a long story and",
"blogTitle": "Artforum",
"language": "en-US",
"url": "https://www.artforum.com/interviews/jamie-stewart-talks-about-xiu-xiu-s-record-forget-and-recent-collaborations-66615",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.artforum.com/print/reviews/201408/dak-art-2014-48214",
"items": [
{
"itemType": "magazineArticle",
"title": "Dak’Art 2014",
"creators": [
{
"firstName": "Chika",
"lastName": "Okeke-Agulu",
"creatorType": "author"
}
],
"date": "October 2014",
"ISSN": "0004-3532",
"abstractNote": "THE ELEVENTH EDITION of the Dak’Art Biennial of Contemporary African Art, which took place this past summer, may well have been the most ambitious since the exhibition’s inception in 1992. It was the largest and most diverse yet, not only showcasing emerging artists from across Africa but also including the work of many superstars from the established biennial circuit. This roster showed that the global art world must reckon with Dak’Art, which seems poised to take its place among the most established international art shows. Yet this year’s iteration also suggested that the biennial is still",
"issue": "2",
"language": "en-US",
"libraryCatalog": "www.artforum.com",
"publicationTitle": "Artforum",
"url": "https://www.artforum.com/print/reviews/201408/dak-art-2014-48214",
"volume": "53",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.artforum.com/search?search=1%3A54&sort=date",
"items": "multiple"
},
{
"type": "web",
"url": "https://www.artforum.com/",
"items": "multiple"
},
{
"type": "web",
"url": "https://www.artforum.com/print/previews/current/new-york",
"items": "multiple"
},
{
"type": "web",
"url": "https://www.artforum.com/print/201806",
"items": "multiple"
},
{
"type": "web",
"url": "https://www.artforum.com/news/levy-gorvy-amalia-dayan-salon-94-merge-to-form-upper-east-side-megagallery-86598",
"items": [
{
"itemType": "blogPost",
"title": "New York Dealers Lévy Gorvy, Amalia Dayan, Salon 94, Announce Merger",
"creators": [],
"date": "2021-09-01",
"abstractNote": "Two New York galleries—Lévy Gorvy and Salon 94—and dealer Amalia Dayan have announced that they are joining forces to establish a single consortium, called LGDR, whose flagship will be situated on the city’s tony Upper East Side. The news, first reported in the New York Times, is said to have come as a shock to a number of the galleries’ artists, whose fate is unclear.The new entity, which takes its name from the last initials of its owners—Dominique Lévy and Brett Gorvy, cofounders of Lévy Gorvy; veteran dealer Amalia Dayan; and Jeanne Greenberg Rohatyn, the owner of Salon 94—will occupy digs",
"blogTitle": "Artforum",
"language": "en-US",
"url": "https://www.artforum.com/news/levy-gorvy-amalia-dayan-salon-94-merge-to-form-upper-east-side-megagallery-86598",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.artforum.com/print/202107/david-salle-on-janet-malcolm-86314",
"items": [
{
"itemType": "magazineArticle",
"title": "JANET MALCOLM (1934–2021)",
"creators": [
{
"firstName": "David",
"lastName": "Salle",
"creatorType": "author"
}
],
"date": "September 2021",
"ISSN": "0004-3532",
"abstractNote": "ABOUT TWENTY-FIVE YEARS AGO Janet Malcolm published a profile of me in the New Yorker that became something of a touchstone of art journalism. It served as the title essay of one of her collections, and has been reprinted several times. I’m told it’s often assigned in classes on art writing, on the assumption that it sheds some light on that murky enterprise.It’s uncommon for the subject of a profile to warmly remember the profiler, and my friendship with Janet struck some people as odd. For some, it would be hard, or so they imagined, to get past the discomforts of so much self-exposure, and",
"issue": "1",
"language": "en-US",
"libraryCatalog": "www.artforum.com",
"publicationTitle": "Artforum",
"url": "https://www.artforum.com/print/202107/david-salle-on-janet-malcolm-86314",
"volume": "60",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
}
]
/** END TEST CASES **/