- Remove load eventListener after it has been called once
- Capture editors from Google Books
This commit is contained in:
parent
90ff41cb40
commit
6d1e447154
2 changed files with 20 additions and 6 deletions
|
@ -147,7 +147,7 @@ Scholar.Ingester.Utilities.prototype.processDocuments = function(browser, firstD
|
|||
var onLoad = function() {
|
||||
Scholar.debug("onLoad called");
|
||||
if(hiddenBrowser.id == "scholar-hidden-browser") {
|
||||
hiddenBrowser.removeEventListener("DOMContentLoaded", onLoad, true);
|
||||
hiddenBrowser.removeEventListener("load", onLoad, true);
|
||||
try {
|
||||
var newHiddenBrowser = new Object();
|
||||
Scholar.debug("new hidden browser");
|
||||
|
@ -586,20 +586,18 @@ Scholar.Ingester.Document.prototype.scrapePage = function(callback) {
|
|||
|
||||
Scholar.debug("Scraping "+this.browser.contentDocument.location.href);
|
||||
|
||||
Scholar.debug(this.scraper.scraperJavaScript);
|
||||
|
||||
var scraperSandbox = this._sandbox;
|
||||
try {
|
||||
Components.utils.evalInSandbox(this.scraper.scraperJavaScript, scraperSandbox);
|
||||
} catch(e) {
|
||||
Scholar.debug(e+' in scraperJavaScript for '+this.scraper.label);
|
||||
this._scrapePageComplete();
|
||||
return;
|
||||
}
|
||||
|
||||
Scholar.debug("scraping complete");
|
||||
|
||||
// If synchronous, call _scrapePageComplete();
|
||||
if(!this._waitForCompletion) {
|
||||
Scholar.debug("is asynch");
|
||||
this._scrapePageComplete();
|
||||
}
|
||||
}
|
||||
|
@ -739,6 +737,12 @@ Scholar.Ingester.Document.prototype._updateDatabase = function() {
|
|||
creatorIndex++;
|
||||
}
|
||||
}
|
||||
if(this.model.data[uri][prefixDummy + 'editor']) {
|
||||
for(i in this.model.data[uri][prefixDummy + 'editor']) {
|
||||
newItem.setCreator(creatorIndex, null, this.model.data[uri][prefixDummy + 'editor'][i], 3);
|
||||
creatorIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle years, extracting from date if necessary
|
||||
if(Scholar.ItemFields.isValidForType(Scholar.ItemFields.getID("year"), typeID)) {
|
||||
|
|
12
scrapers.sql
12
scrapers.sql
|
@ -1412,11 +1412,21 @@ utilities.loadDocument(newUri, browser, function(newBrowser) {
|
|||
for(j in authors) {
|
||||
model.addStatement(uri, prefixDC + ''creator'', authors[j]);
|
||||
}
|
||||
} else if(field == "Editor(s)") {
|
||||
var authors = value.split(", ");
|
||||
for(j in authors) {
|
||||
model.addStatement(uri, prefixDummy + ''editor'', authors[j]);
|
||||
}
|
||||
} else if(field == "Publisher") {
|
||||
model.addStatement(uri, prefixDC + ''publisher'', value);
|
||||
} else if(field == "Publication Date") {
|
||||
var date = value;
|
||||
|
||||
jsDate = new Date(value);
|
||||
var date = utilities.dateToISO(jsDate);
|
||||
if(!isNaN(jsDate.valueOf())) {
|
||||
date = utilities.dateToISO(jsDate);
|
||||
}
|
||||
|
||||
model.addStatement(uri, prefixDC + ''date'', date);
|
||||
} else if(field == "Format") {
|
||||
model.addStatement(uri, prefixDC + ''medium'', value);
|
||||
|
|
Loading…
Reference in a new issue