Forked from pberry/NYT-LexisnexisBookmarklet.js
Last active
September 25, 2015 15:38
-
-
Save erinrwhite/944809 to your computer and use it in GitHub Desktop.
Bookmarklets for accessing content behind the New York Times paywall using library subscriptions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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."); | |
} | |
} | |
) | |
(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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."); | |
} | |
} | |
) | |
(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment