James, AWESOME idea. I'm excited to share with my library.
For those of you who are getting NYT through LexisNexis I've modified the
code below - just throw in your proxy URL and library name.
I also fixed the first regex to work with non-article items as well
(op-eds, etc).
javascript:
(
function()
{ var source = document.documentElement.innerHTML;
var regex1 = /appeared in print on
((January|February|March|April|May|June|July|August|September|October|November|December)
([1-2][0-9]|3[0-1]|0?[1-9]), ((19|20)[0-9][0-9])), on page (\w+) of the
New York edition with the headline:(.*)</g;
var match = regex1.exec(source);
if (match)
{
var articleDate = new Date(match[2] + ' ' + match[3] + ', '
+ match[4]);
var articleYear = articleDate.getFullYear();
var articleMonth = articleDate.getMonth()+1;
var articleDay = articleDate.getDate();
var regex2 = /([A-Z]+)(\d+)/g;
var pageMatch = regex2.exec(match[6]);
var articleURL =
'http://www.lexisnexis.com/us/lnacademic/api/version1/sr?shr=t&csi=6742&sr=HLEAD%28'
+ match[7] + '%29+AND+DATE+IS+' + articleMonth + '%2F' + articleDay +
'%2F' + articleYear;
window.open('http://proxy.library.vcu.edu/login?url=' +
articleURL);
}
else
{
alert("This article hasn't been published in the print
version of the NY Times and isn't accessible through VCU Libraries.");
}
}
)
();
--
Erin White
Web Applications Developer, VCU Libraries
804-827-3552 | [log in to unmask] | http://library.vcu.edu/
From:
Jonathan Rochkind <[log in to unmask]>
To:
[log in to unmask]
Date:
04/27/2011 10:13 AM
Subject:
Re: [CODE4LIB] NY Times Bookmarklet
Sent by:
Code for Libraries <[log in to unmask]>
This is a great idea, thanks for sharing.
On 4/27/2011 9:10 AM, Van Mil, James (vanmiljf) wrote:
> Hi everyone! (first post!)
>
> We've been getting lots of feedback at my library about the problem with
the NY Times paywall and the lack of institutional access to their
website, but we do have a subscription to a Proquest database which
includes all current content that is included in the print addition.
>
> However, every article at the web version of the NY Times that was also
published in the print version includes a reference to the article from
the print edition, including date, page number, and print version title
(information which is all still accessible in the page source when the
paywall blocks access). Additionally, the Proquest database has very clear
search syntax.
>
> So, I wrote a bookmarklet to check whether the article was published in
print and to open a new browser window to search for the article at
Proquest. (I know that there are other work-arounds to the paywall, but
I'm interested in one that our library could ethically promote.)
>
> The code for the bookmarklet is short, so I've included it below. I'd
like to add the option to search the headline in Google News for any
articles that aren't available in the print version, and I need to write
some title-string sanitization to deal with some funky punctuation in the
occasional headline. If anyone has any other feedback, I'd love to hear
it. (And I apologize both for the lack of commenting (bookmarklets don't
seem to have room for this) and for the lack of style (I started learned
Javascript yesterday).)
>
> Thanks!
> James
>
> James Van Mil
> Collections& Electronic Resources Librarian
> Electronic Resources Department
> University of Cincinnati Libraries
> PO Box 210033
> Cincinnati OH 45221-0033
> Telephone: (513) 556-1410
> [log in to unmask]<mailto:[log in to unmask]>
>
>
>
> javascript:
> (
> function()
> { var source = document.documentElement.innerHTML;
> var regex1 = /A version of this article appeared in print on
((January|February|March|April|May|June|July|August|September|October|November|December)
([1-2][0-9]|3[0-1]|0?[1-9]), ((19|20)[0-9][0-9])), on page (\w+) of the
New York edition with the headline:(.*)</g;
> var match = regex1.exec(source);
> if (match)
> {
> var articleDate = new Date(match[2] + ' ' + match[3] + ',
' + match[4]);
> var articleYear = articleDate.getFullYear();
> var articleMonth = articleDate.getMonth()+1;
> var articleDay = articleDate.getDate();
> var regex2 = /([A-Z]+)(\d+)/g;
> var pageMatch = regex2.exec(match[6]);
>
window.open('https://proxy.libraries.uc.edu/login?url=http://proquest.umi.com/pqdweb?RQT=305&SQ=issn%2803624331%29%20and%20ti%28'
+ match[7] + '%29%20and%20pdn%28' + articleMonth + '%2F' + articleDay +
'%2F' + articleYear + '%29%20and%20startpage%28' + pageMatch[1] + '.' +
pageMatch[2] + '%29');
> }
> else
> {
> alert("This article hasn't been published in the print
version of the NY Times and isn't accessible through the UC Libraries.");
> }
> }
>
> )
> ();
>
|