references #268, occasional problems with ingest of pages with multiple references
i've fixed the Amazon.com bug (i think) and made the translator show a "Could Not Save Item" prompt rather than show an empty list, but if you see any other pages where this happens, let me know
This commit is contained in:
parent
9f94de5e91
commit
0ab9e8b36c
|
@ -827,6 +827,17 @@ Scholar.Translate.prototype._enableAsynchronous = function() {
|
||||||
* called as selectItems() in translator code
|
* called as selectItems() in translator code
|
||||||
*/
|
*/
|
||||||
Scholar.Translate.prototype._selectItems = function(options) {
|
Scholar.Translate.prototype._selectItems = function(options) {
|
||||||
|
// hack to see if there are options
|
||||||
|
var haveOptions = false;
|
||||||
|
for(var i in options) {
|
||||||
|
haveOptions = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!haveOptions) {
|
||||||
|
throw "translator called select items with no items";
|
||||||
|
}
|
||||||
|
|
||||||
if(this._handlers.select) {
|
if(this._handlers.select) {
|
||||||
return this._runHandler("select", options);
|
return this._runHandler("select", options);
|
||||||
} else { // no handler defined; assume they want all of them
|
} else { // no handler defined; assume they want all of them
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
-- 72
|
-- 73
|
||||||
|
|
||||||
-- Set the following timestamp to the most recent scraper update date
|
-- Set the following timestamp to the most recent scraper update date
|
||||||
REPLACE INTO "version" VALUES ('repository', STRFTIME('%s', '2006-08-31 22:44:00'));
|
REPLACE INTO "version" VALUES ('repository', STRFTIME('%s', '2006-08-31 22:44:00'));
|
||||||
|
@ -116,7 +116,7 @@ function doWeb(doc, url) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var searchresults = Scholar.Utilities.gatherElementsOnXPath(doc, doc, xpath, nsResolver);
|
var searchresults = Scholar.Utilities.gatherElementsOnXPath(doc, doc, xpath, nsResolver);
|
||||||
var items = Scholar.Utilities.getItemArray(doc, searchresults, ''^http://www\.amazon\.com/(gp/product/|exec/obidos/tg/detail/)'', ''^(Buy new|Hardcover|Paperback|Digital)$'');
|
var items = Scholar.Utilities.getItemArray(doc, searchresults, ''^http://www\.amazon\.com/(gp/product/|exec/obidos/tg/detail/|[^/]+/dp/)'', ''^(Buy new|Hardcover|Paperback|Digital)$'');
|
||||||
items = Scholar.selectItems(items);
|
items = Scholar.selectItems(items);
|
||||||
|
|
||||||
if(!items) {
|
if(!items) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user