-Adds Verniana translator.
This commit is contained in:
parent
ef5a359eb9
commit
412269efd3
73
scrapers.sql
73
scrapers.sql
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
-- Set the following timestamp to the most recent scraper update date
|
||||
REPLACE INTO version VALUES ('repository', STRFTIME('%s', '2008-05-21 14:30:00'));
|
||||
REPLACE INTO version VALUES ('repository', STRFTIME('%s', '2008-05-21 16:00:00'));
|
||||
|
||||
REPLACE INTO translators VALUES ('96b9f483-c44d-5784-cdad-ce21b984fe01', '1.0.0b4.r1', '', '2008-03-21 20:00:00', '1', '100', '4', 'Amazon.com', 'Sean Takats and Michael Berkowitz', '^https?://(?:www\.)?amazon',
|
||||
'function detectWeb(doc, url) {
|
||||
|
@ -1149,6 +1149,77 @@ REPLACE INTO translators VALUES ('83538f48-906f-40ef-bdb3-e94f63676307', '1.0.0b
|
|||
}, function() {Zotero.done;});
|
||||
}');
|
||||
|
||||
REPLACE INTO translators VALUES ('cdf8269c-86b9-4039-9bc4-9d998c67740e', '1.0.0b4.r5', '', '2008-05-21 16:00:00', '0', '100', '4', 'Verniana-Jules Verne Studies', 'Michael Berkowitz', 'http://jv.gilead.org.il/studies/',
|
||||
'function detectWeb(doc, url) {
|
||||
if (url.match(/article\/view/)) {
|
||||
return "journalArticle";
|
||||
} else if (url.match(/(issue|advancedResults)/)) {
|
||||
return "multiple";
|
||||
}
|
||||
}',
|
||||
'function prepNos(link) {
|
||||
if (link.match(/\d+\/\d+$/)) {
|
||||
var nos = link.match(/\d+\/\d+$/)[0];
|
||||
} else {
|
||||
var nos = link.match(/\d+$/)[0] + ''/0'';
|
||||
}
|
||||
return ''http://jv.gilead.org.il/studies/index.php/studies/rt/captureCite/'' + nos + ''/RefManCitationPlugin'';
|
||||
}
|
||||
|
||||
function doWeb(doc, url) {
|
||||
var n = doc.documentElement.namespaceURI;
|
||||
var ns = n ? function(prefix) {
|
||||
if (prefix == ''x'') return n; else return null;
|
||||
} : null;
|
||||
|
||||
var arts = new Array();
|
||||
if (detectWeb(doc, url) == "multiple") {
|
||||
var items = new Object();
|
||||
var xpath = ''//tr[td/a[2]]'';
|
||||
if (url.match(/issue/)) {
|
||||
var titlex = ''./td[1]'';
|
||||
var linkx = ''./td[2]/a[contains(text(), "HTML")]'';
|
||||
} else if (url.match(/advanced/)) {
|
||||
var titlex = ''./td[2]'';
|
||||
var linkx = ''./td[3]/a[contains(text(), "HTML")]'';
|
||||
}
|
||||
var results = doc.evaluate(xpath, doc, ns, XPathResult.ANY_TYPE, null);
|
||||
var result;
|
||||
while (result = results.iterateNext()) {
|
||||
var title = Zotero.Utilities.trimInternal(doc.evaluate(titlex, result, ns, XPathResult.ANY_TYPE, null).iterateNext().textContent);
|
||||
var link = doc.evaluate(linkx, result, ns, XPathResult.ANY_TYPE, null).iterateNext().href;
|
||||
items[link] = title;
|
||||
}
|
||||
items = Zotero.selectItems(items);
|
||||
for (var i in items) {
|
||||
arts.push(prepNos(i));
|
||||
}
|
||||
} else {
|
||||
arts = [prepNos(url)];
|
||||
}
|
||||
Zotero.Utilities.HTTP.doGet(arts, function(text) {
|
||||
var translator = Zotero.loadTranslator("import");
|
||||
translator.setTranslator("32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7");
|
||||
translator.setString(text);
|
||||
translator.setHandler("itemDone", function(obj, item) {
|
||||
var auts = new Array();
|
||||
for each (var aut in item.creators) {
|
||||
auts.push(Zotero.Utilities.cleanAuthor(aut.lastName, "author"));
|
||||
}
|
||||
item.creators = auts;
|
||||
item.attachments = [{url:item.url, title:"Verniana Snapshot", mimeType:"text/html"}];
|
||||
var bits = item.publicationTitle.split(/;/);
|
||||
item.publicationTitle = bits[0];
|
||||
var voliss = bits[1].match(/Vol\s+(\d+)\s+\((\d+)\)/);
|
||||
item.volume = voliss[1];
|
||||
item.date = voliss[2];
|
||||
item.complete();
|
||||
});
|
||||
translator.translate();
|
||||
});
|
||||
Zotero.wait();
|
||||
}');
|
||||
|
||||
REPLACE INTO translators VALUES ('b33af0e1-d122-45b2-b144-4b4eedd12d5d', '1.0.0b4.r5', '', '2008-05-20 21:30:00', '0', '100', '4', 'Wildlife Biology in Practice', 'Michael Berkowitz', 'http://www.socpvs.org/journals/index.php/wbp',
|
||||
'function detectWeb(doc, url) {
|
||||
if (url.match(/showToc/) || url.match(/advancedResults/)) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user