-Adds African Journals Online translator.
This commit is contained in:
parent
004d5d9b06
commit
3639f11cd8
60
scrapers.sql
60
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-04-17 17:00:00'));
|
||||
REPLACE INTO version VALUES ('repository', STRFTIME('%s', '2008-04-17 19: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) {
|
||||
|
@ -1087,6 +1087,64 @@ REPLACE INTO translators VALUES ('88915634-1af6-c134-0171-56fd198235ed', '1.0.0b
|
|||
Zotero.wait();
|
||||
}');
|
||||
|
||||
REPLACE INTO translators VALUES ('9d822257-2eec-4674-b6d0-2504f54c8890', '1.0.0b4.r5', '', '2008-04-17 19:00:00', '0', '100', '4', 'African Journals Online', 'Michael Berkowitz', 'http://www.ajol.info',
|
||||
'function detectWeb(doc, url) {
|
||||
if (url.match(/viewarticle.php/)) {
|
||||
return "journalArticle";
|
||||
} else if (url.match(/search.php/) || url.match(/viewissue.php/)) {
|
||||
return "multiple";
|
||||
}
|
||||
}',
|
||||
'function getID(str) {
|
||||
return str.match(/(&|\?)id=(\d+)&?/)[2];
|
||||
}
|
||||
|
||||
function doWeb(doc, url) {
|
||||
var articles = new Array();
|
||||
if (detectWeb(doc, url) == "multiple") {
|
||||
if (url.match(/search.php/)) {
|
||||
var items = Zotero.Utilities.getItemArray(doc, doc, "viewarticle.php?");
|
||||
} else if (url.match("viewissue.php")) {
|
||||
var items = new Object();
|
||||
var titles = doc.evaluate(''//span[@class="toctitle"]'', doc, null, XPathResult.ANY_TYPE, null);
|
||||
var links = doc.evaluate(''//a[text() = "Abstract"]'', doc, null, XPathResult.ANY_TYPE, null);
|
||||
var title;
|
||||
var link;
|
||||
while ((title = titles.iterateNext()) && (link = links.iterateNext())) {
|
||||
items[link.href] = Zotero.Utilities.trimInternal(title.textContent);
|
||||
}
|
||||
}
|
||||
items = Zotero.selectItems(items);
|
||||
for (var i in items) {
|
||||
articles.push(getID(i));
|
||||
}
|
||||
} else {
|
||||
articles = [getID(url)];
|
||||
}
|
||||
Zotero.debug(articles);
|
||||
for each (var id in articles) {
|
||||
var getstr = ''http://www.ajol.info/rst/rst.php?op=capture_cite&id='' + id + ''&cite=refman'';
|
||||
Zotero.Utilities.HTTP.doGet(getstr, function(text) {
|
||||
// load translator for RIS
|
||||
var translator = Zotero.loadTranslator("import");
|
||||
translator.setTranslator("32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7");
|
||||
translator.setString(text);
|
||||
translator.setHandler("itemDone", function(obj, item) {
|
||||
var pubinfo = item.publicationTitle.match(/(.*);([^;]+)$/);
|
||||
item.publicationTitle = pubinfo[1];
|
||||
var voliss = pubinfo[2].toLowerCase();
|
||||
if (voliss.match(/v/)) item.volume = voliss.match(/v(ol\.)?\s+(\d+)/)[2];
|
||||
if (voliss.match(/n/)) item.issue = voliss.match(/n(o\.)?\s+(\d+)/)[2];
|
||||
if (voliss.match(/p(age)?/)) item.pages = voliss.match(/\d+\-\d+/)[0];
|
||||
item.attachments[0].title = "African Journals Online Snapshot";
|
||||
item.attachments[0].mimeType = "text/html";
|
||||
item.complete();
|
||||
});
|
||||
translator.translate();
|
||||
});
|
||||
}
|
||||
}');
|
||||
|
||||
REPLACE INTO translators VALUES ('4afb932d-9211-4c0b-a31c-cfa984d62b66', '1.0.0b4.r5', '', '2008-04-17 17:00:00', '0', '100', '4', 'OAIster', 'Michael Berkowitz', 'http://quod.lib.umich.edu/cgi/b/',
|
||||
'function detectWeb(doc, url) {
|
||||
if (doc.title.indexOf("OAIster") != -1) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user