-Adds translator for a not-really-Aleph library site.
This commit is contained in:
parent
d9b848c15b
commit
9eee17f2d1
42
scrapers.sql
42
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-03-18 16:30:00'));
|
||||
REPLACE INTO version VALUES ('repository', STRFTIME('%s', '2008-03-19 16:00:00'));
|
||||
|
||||
REPLACE INTO translators VALUES ('96b9f483-c44d-5784-cdad-ce21b984fe01', '1.0.0b4.r1', '', '2007-06-21 20:00:00', '1', '100', '4', 'Amazon.com', 'Sean Takats', '^https?://(?:www\.)?amazon',
|
||||
'function detectWeb(doc, url) {
|
||||
|
@ -1579,6 +1579,46 @@ function doWeb(doc, url) {
|
|||
}
|
||||
}');
|
||||
|
||||
REPLACE INTO translators VALUES ('e1140aa1-3bcf-4226-9099-78ef0b63bb3e', '1.0.0b4.r5', '', '2008-03-19 16:00:00', '0', '100', '4', 'Osterreichischer Bibliothekenverbund', 'Michael Berkowitz', 'http://meteor.bibvb.ac.at/F',
|
||||
'function detectWeb(doc, url) {
|
||||
if (doc.evaluate(''//td[@class="bar"]/a[@class="blue"]/img'', doc, null, XPathResult.ANY_TYPE, null).iterateNext()) {
|
||||
return "book";
|
||||
} else if (doc.title.indexOf("Ergebnisliste") != -1) {
|
||||
return "multiple";
|
||||
}
|
||||
}',
|
||||
'function doWeb(doc, url) {
|
||||
var arts = new Array();
|
||||
if (detectWeb(doc, url) == "multiple") {
|
||||
var itemRegexp = ''^https?://[^/]+/F/[A-Z0-9\-]+\?.*(?:func=full-set-set.*\&format=999|func=direct)''
|
||||
var items = Zotero.Utilities.getItemArray(doc, doc, itemRegexp, ''^[0-9]+$'');
|
||||
items = Zotero.selectItems(items);
|
||||
for (var i in items) {
|
||||
arts.push(i);
|
||||
}
|
||||
} else {
|
||||
arts = [url];
|
||||
}
|
||||
Zotero.Utilities.processDocuments(arts, function(newDoc) {
|
||||
var link = newDoc.evaluate(''//td[@class="bar"]/a[@class="blue"][2]'', newDoc, null, XPathResult.ANY_TYPE, null).iterateNext().href;
|
||||
link = link.replace(/full\-mail[^&]+&/, "full-mail&") + "&option_type=&format=777&encoding=UTF_TO_WEB_MAIL+++++&SUBJECT=&NAME=&EMAIL=&x=17&y=7";
|
||||
Zotero.Utilities.loadDocument([link], function(newDoc2) {
|
||||
var newest = newDoc2.evaluate(''/html/body/p[@class="text3"]/a'', newDoc2, null, XPathResult.ANY_TYPE, null).iterateNext().href;
|
||||
Zotero.Utilities.HTTP.doGet(newest, function(text) {
|
||||
var translator = Zotero.loadTranslator("import");
|
||||
translator.setTranslator("32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7");
|
||||
translator.setString(text);
|
||||
translator.setHandler("itemDone", function(obj, item) {
|
||||
item.itemType = "book";
|
||||
item.complete();
|
||||
});
|
||||
translator.translate();
|
||||
});
|
||||
});
|
||||
}, function() {Zotero.done;});
|
||||
Zotero.wait();
|
||||
}');
|
||||
|
||||
REPLACE INTO translators VALUES ('4654c76f-451c-4ae6-9a36-575e982b3cdb', '1.0.0b4.r5', '', '2008-03-14 19:10:00', '0', '100', '4', 'Investigative Ophthalmology and Visual Science', 'Michael Berkowitz', 'http://www.iovs.org/',
|
||||
'function detectWeb(doc, url) {
|
||||
if (doc.title.indexOf("Table of Contents") != -1 || doc.title.indexOf("Search Result") != -1) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user