diff --git a/chrome/content/zotero/ingester/browser.js b/chrome/content/zotero/ingester/browser.js index a9c8f2c4d..27c96895a 100644 --- a/chrome/content/zotero/ingester/browser.js +++ b/chrome/content/zotero/ingester/browser.js @@ -12,6 +12,13 @@ var Zotero_Ingester_Interface = function() {} +Zotero_Ingester_Interface.blacklist = [ + "googlesyndication.com", + "doubleclick.net", + "questionmarket.com", + "atdmt.com" +]; + ////////////////////////////////////////////////////////////////////////////// // // Public Zotero_Ingester_Interface methods @@ -138,6 +145,13 @@ Zotero_Ingester_Interface.contentLoad = function(event) { } } + for each(var blacklistedURL in Zotero_Ingester_Interface.blacklist) { + if(doc.domain.substr(doc.domain.length-blacklistedURL.length) == blacklistedURL) { + Zotero.debug("Ignoring blacklisted URL "+document.location); + return; + } + } + // get translators var translate = new Zotero.Translate("web"); translate.setDocument(doc); diff --git a/scrapers.sql b/scrapers.sql index ca9fa90e5..6d47c01c2 100644 --- a/scrapers.sql +++ b/scrapers.sql @@ -1,4 +1,4 @@ --- 96 +-- 97 DROP TABLE IF EXISTS translators; CREATE TABLE translators ( @@ -3408,7 +3408,7 @@ function doWeb(doc, url) { Zotero.wait(); }'); -REPLACE INTO "translators" VALUES ('ce7a3727-d184-407f-ac12-52837f3361ff', '2006-10-02 17:00:00', 1, 100, 4, 'New York Times', 'Simon Kornblith', '^http://(?:query\.nytimes\.com/search/query|www\.nytimes\.com/.+)', +REPLACE INTO "translators" VALUES ('ce7a3727-d184-407f-ac12-52837f3361ff', '2006-10-02 17:00:00', 1, 100, 4, 'New York Times', 'Simon Kornblith', '^http://(?:query\.nytimes\.com/search/query|(?:www\.)?nytimes\.com/.+)', 'function detectWeb(doc, url) { if(doc.title.substr(0, 30) == "The New York Times: Search for") { var namespace = doc.documentElement.namespaceURI; @@ -3810,7 +3810,7 @@ REPLACE INTO "translators" VALUES ('d1bf1c29-4432-4ada-8893-2e29fc88fd9e', '2006 downloadable:true}); // grab title from doc title - newItem.title = doc.title; + newItem.title = doc.title.replace(" - washingtonpost.com", ""); var byline = doc.evaluate(''//div[@id="byline"]'', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); @@ -4971,7 +4971,7 @@ function doExport() { // set term type Zotero.RDF.addStatement(term, rdf+"type", n.dcterms+"URI", false); // set url value - Zotero.RDF.addStatement(term, rdf+"value", attachment.url, true); + Zotero.RDF.addStatement(term, rdf+"value", item.url, true); // add relationship to resource Zotero.RDF.addStatement(resource, n.dc+"identifier", term, false); } @@ -4996,7 +4996,7 @@ function doExport() { // set section title Zotero.RDF.addStatement(section, n.dc+"title", item.section, true); // add relationship to resource - Zotero.RDF.addStatement(resource, n.dc+"isPartOf", section, false); + Zotero.RDF.addStatement(resource, n.dcterms+"isPartOf", section, false); } // generate container @@ -5504,13 +5504,22 @@ function doImport() { // type var type = Zotero.RDF.getTargets(node, rdf+"type"); + // also deal with type detection based on parts, so we can differentiate // magazine and journal articles, and find container elements var isPartOf = getFirstResults(node, [n.dcterms+"isPartOf"]); - if(type) { - type = Zotero.RDF.getResourceURI(type[0]); - + // get parts of parts, because parts are sections of wholes. + if(isPartOf) { + for(var i=0; i