www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 7385ba4df2e547a7ed08a66132daa0c72293a94f
parent d3fc9866b98bb09102bddcd35106237419cf1398
Author: Simon Kornblith <simon@simonster.com>
Date:   Sat, 26 Aug 2006 21:57:02 +0000

ABC-CLIO fixes


Diffstat:
Mscrapers.sql | 30++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/scrapers.sql b/scrapers.sql @@ -1,4 +1,4 @@ --- 60 +-- 61 -- Set the following timestamp to the most recent scraper update date REPLACE INTO "version" VALUES ('repository', STRFTIME('%s', '2006-08-15 15:42:00')); @@ -3560,21 +3560,16 @@ REPLACE INTO "translators" VALUES ('a07bb62a-4d2d-4d43-ba08-d9679a0122f8', '2006 } } - // get cookie - var cookies = doc.cookie.split(/; */); - for each(var cookie in cookies) { - if(cookie.substr(0, 21) == "ABC-Clio-Serials_v4.1") { - var cookieName = cookie.substr(22); - } else { - throw("Could not get cookie name!"); - } - } - Scholar.Utilities.HTTP.doPost(url, postString, function(text) { Scholar.Utilities.HTTP.doPost(url, "_appname=serials&_defaultoperation=Download+Documents&_formname=download&download_format=citation&download_which=tagged&download_where=ris&mailto=&mailreplyto=&mailsubject=&mailmessage=", - function(text) { - Scholar.Utilities.HTTP.doGet("http://serials.abc-clio.com/active/resource/download/"+cookieName+".ris", - function(text) { + function(text) { + // get link + var linkRe = /<a\s+class="button"\s+href="([^"]+)"\s+id="resource_link"/i; + var m = linkRe.exec(text); + if(!m) { + throw("regular expression failed!"); + } + Scholar.Utilities.HTTP.doGet(m[1], function(text) { // load translator for RIS var translator = Scholar.loadTranslator("import"); translator.setTranslator("32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7"); @@ -3607,6 +3602,13 @@ REPLACE INTO "translators" VALUES ('a07bb62a-4d2d-4d43-ba08-d9679a0122f8', '2006 item.creators[i].firstName = item.creators[i].firstName.substr(0, nameLength-1); } } + for(var i in item.tags) { + var tagLength = item.tags[i].length; + + if(item.tags[i][tagLength-1] == ".") { + item.tags[i] = item.tags[i].substr(0, tagLength-1); + } + } // fix title item.title = Scholar.Utilities.superCleanString(item.title);