-Adds ReliefWeb translator.
This commit is contained in:
parent
6193a162a5
commit
0b5bd220ae
46
scrapers.sql
46
scrapers.sql
|
@ -20310,6 +20310,52 @@ function doWeb(doc, url) {
|
||||||
Zotero.wait();
|
Zotero.wait();
|
||||||
}');
|
}');
|
||||||
|
|
||||||
|
REPLACE INTO translators VALUES ('6f5f1b24-7519-4314-880f-d7004fbcfe7e', '1.0.0b4.r5', '', '2008-07-08 14:58:12', '0', '100', '4', 'ReliefWeb', 'Michael Berkowitz', 'http://(www.)?reliefweb.int/',
|
||||||
|
'function detectWeb(doc, url) {
|
||||||
|
if (url.match(/(S|s)earch(R|r)esults/)) {
|
||||||
|
return "multiple";
|
||||||
|
} else if (url.match(/(O|o)pen(D|d)ocument/)) {
|
||||||
|
return "journalArticle";
|
||||||
|
}
|
||||||
|
}',
|
||||||
|
'function doWeb(doc, url) {
|
||||||
|
var arts = new Array();
|
||||||
|
if (detectWeb(doc, url) == "multiple") {
|
||||||
|
var items = new Object();
|
||||||
|
var links = doc.evaluate(''//div[@id="View"]/table/tbody/tr/td[4][@class="docView"]/a'', doc, null, XPathResult.ANY_TYPE, null);
|
||||||
|
var link;
|
||||||
|
while (link = links.iterateNext()) {
|
||||||
|
items[link.href] = Zotero.Utilities.trimInternal(link.textContent);
|
||||||
|
}
|
||||||
|
items = Zotero.selectItems(items);
|
||||||
|
for (var i in items) {
|
||||||
|
arts.push(i);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
arts = [url];
|
||||||
|
}
|
||||||
|
Zotero.debug(arts);
|
||||||
|
Zotero.Utilities.processDocuments(arts, function(doc) {
|
||||||
|
var item = new Zotero.Item("journalArticle");
|
||||||
|
item.title = Zotero.Utilities.trimInternal(doc.evaluate(''//div[@id="docTitle"]/h1'', doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent);
|
||||||
|
item.date = Zotero.Utilities.trimInternal(doc.evaluate(''//div[@id="link"]/p[2]'', doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent.substr(6));
|
||||||
|
item.url = doc.location.href;
|
||||||
|
if (doc.evaluate(''//div[@id="docBody"]/p/i'',doc, null, XPathResult.ANY_TYPE, null).iterateNext()) {
|
||||||
|
var auts = doc.evaluate(''//div[@id="docBody"]/p/i'', doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent;
|
||||||
|
item.abstractNote = Zotero.Utilities.trimInternal(doc.evaluate(''//div[@id="docBody"]/p[1]'', doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent.replace(auts, ""));
|
||||||
|
auts = auts.replace(''By '', "").split(/\//);
|
||||||
|
for each (var aut in auts) {
|
||||||
|
item.creators.push(Zotero.Utilities.cleanAuthor(aut, "author"));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
item.abstractNote = Zotero.Utilities.trimInternal(doc.evaluate(''//div[@id="docBody"]/p[1]'', doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent);
|
||||||
|
}
|
||||||
|
|
||||||
|
item.complete();
|
||||||
|
}, function() {Zotero.done;});
|
||||||
|
Zotero.wait();
|
||||||
|
}');
|
||||||
|
|
||||||
REPLACE INTO translators VALUES ('594ebe3c-90a0-4830-83bc-9502825a6810', '1.0.0b4.r5', '', '2008-07-07 14:50:00', '1', '100', '4', 'ISI Web of Knowledge', 'Michael Berkowitz', '(WOS_GeneralSearch|product=WOS)',
|
REPLACE INTO translators VALUES ('594ebe3c-90a0-4830-83bc-9502825a6810', '1.0.0b4.r5', '', '2008-07-07 14:50:00', '1', '100', '4', 'ISI Web of Knowledge', 'Michael Berkowitz', '(WOS_GeneralSearch|product=WOS)',
|
||||||
'function detectWeb(doc, url) {
|
'function detectWeb(doc, url) {
|
||||||
if (doc.title.indexOf("Web of Science Results") != -1) {
|
if (doc.title.indexOf("Web of Science Results") != -1) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user