-Adds AMS Journals translator.
This commit is contained in:
parent
7c93c3dbe4
commit
5a4bbd2651
69
scrapers.sql
69
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-01 15:00:00'));
|
||||
REPLACE INTO version VALUES ('repository', STRFTIME('%s', '2008-05-01 16:30: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) {
|
||||
|
@ -1089,6 +1089,73 @@ REPLACE INTO translators VALUES ('88915634-1af6-c134-0171-56fd198235ed', '1.0.0b
|
|||
Zotero.wait();
|
||||
}');
|
||||
|
||||
REPLACE INTO translators VALUES ('bdaac15c-b0ee-453f-9f1d-f35d00c7a994', '1.0.0b4.r5', '', '2008-05-01 16:30:00', '0', '100', '4', 'AMS Journals', 'Michael Berkowitz', 'http://www.ams.org/',
|
||||
'function detectWeb(doc, url) {
|
||||
if (url.match(/jour(nals|search)/)) {
|
||||
return "multiple";
|
||||
} else if (url.match(/\d{4}\-\d{2}\-\d{2}/)) {
|
||||
return "journalArticle";
|
||||
}
|
||||
}',
|
||||
'function doWeb(doc, url) {
|
||||
var namespace = doc.documentElement.namespaceURI;
|
||||
var nsResolver = namespace ? function(prefix) {
|
||||
if (prefix == ''x'') return namespace; else return null;
|
||||
} : null;
|
||||
var articles = new Array();
|
||||
if (detectWeb(doc, url) == "multiple") {
|
||||
var items = new Object();
|
||||
if (url.match(/joursearch/)) {
|
||||
var titlex = ''//table/tbody/tr/td/span[@class="searchResultsArticleTitle"]'';
|
||||
var linkx = ''//table/tbody/tr[td/span[@class="searchResultsArticleTitle"]]//a[contains(text(), "Abstract")]'';
|
||||
} else {
|
||||
var titlex = ''//div[@class="contentList"]/dl/dt[@class="articleTitleInAbstract"]'';
|
||||
var linkx = ''//div[@class="contentList"]/dl/dd/a[contains(text(), "Abstract")]''
|
||||
}
|
||||
var titles = doc.evaluate(titlex, doc, nsResolver, XPathResult.ANY_TYPE, null);
|
||||
var links = doc.evaluate(linkx, doc, nsResolver, XPathResult.ANY_TYPE, null);
|
||||
var title, 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(decodeURIComponent(i));
|
||||
}
|
||||
} else {
|
||||
articles = [url];
|
||||
}
|
||||
Zotero.debug(articles);
|
||||
Zotero.Utilities.processDocuments(articles, function(doc) {
|
||||
var item = new Zotero.Item("journalArticle");
|
||||
item.publicationTitle = doc.title;
|
||||
item.ISSN = doc.evaluate(''//span[@class="journalISSN"]'', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent.match(/\(e\)\s+ISSN:?\s+(.*)\(p\)/)[1];
|
||||
item.title = Zotero.Utilities.trimInternal(doc.evaluate(''//p[@class="articleTitle"]'', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent);
|
||||
var data = Zotero.Utilities.trimInternal(doc.evaluate(''//p[span[@class="bibDataTag"]][1]'', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent);
|
||||
data = data.replace(/(Journal|MSC|Posted|Retrieve)/g, "\n$1");
|
||||
Zotero.debug(data);
|
||||
var authors = data.match(/Author\(s\):\s+(.*)\n/)[1].split(/;\s+/);
|
||||
for each (var aut in authors) {
|
||||
item.creators.push(Zotero.Utilities.cleanAuthor(aut, "author"));
|
||||
}
|
||||
var journalinfo = data.match(/Journal:\s+(.*)\n/)[1].match(/^([^\d]+)(\d+)\s+\((\d+)\),\s+(.*)$/);
|
||||
item.journalAbbreviation = journalinfo[1];
|
||||
item.volume = journalinfo[2];
|
||||
item.pages = journalinfo[4];
|
||||
item.date = Zotero.Utilities.trimInternal(data.match(/Posted:\s+(.*)\n/)[1]);
|
||||
item.url = doc.location.href;
|
||||
item.issue = item.url.match(/(\d+)\/S/)[1];
|
||||
var pdfurl = item.url.replace(/([^/]+)\/home.html$/, "$1/$1.pdf");
|
||||
item.attachments = [
|
||||
{url:item.url, title:item.journalAbbreviation + " Snapshot", mimeType:"text/html"},
|
||||
{url:pdfurl, title:item.journalAbbreviation + " PDF", mimeType:"application/pdf"}
|
||||
];
|
||||
item.abstract = Zotero.Utilities.trimInternal(doc.evaluate(''//td[@class="bottomCell"]/p[4]'', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent.substr(10));
|
||||
item.complete();
|
||||
}, function() {Zotero.done;});
|
||||
Zotero.wait();
|
||||
}');
|
||||
|
||||
REPLACE INTO translators VALUES ('5278b20c-7c2c-4599-a785-12198ea648bf', '1.0.0b4.r5', '', '2008-04-30 21:00:00', '0', '100', '4', 'ARTstor', 'Ameer Ahmed and Michael Berkowitz', 'http://web2.artstor.org',
|
||||
'function detectWeb(doc, url) {
|
||||
if (url.match(''Search'')) return "multiple"
|
||||
|
|
Loading…
Reference in New Issue
Block a user