Created
May 27, 2017 19:25
-
-
Save vjk2005/cac56407219b1c4b49d6d0fb655796fe to your computer and use it in GitHub Desktop.
Load all pages of a search result on Arxiv! Death to pagination!
This file contains hidden or 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
var jq = document.createElement('script'); | |
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"; | |
document.getElementsByTagName('head')[0].appendChild(jq); | |
jQuery.noConflict(); | |
let main = () => { | |
let next = $($('a:contains("Next 25 results")').toArray().pop()).attr('href') | |
let process = data => { | |
$('body dl').append($(data).find('dl').html()) | |
next = $($(data).find('a:contains("Next 25 results")').toArray().pop()).attr('href') | |
if(next) fetch(next) | |
} | |
let fetch = url => $.get('https://arxiv.org' + url, process) | |
fetch(next) | |
} | |
// wait for jQuery to load | |
setTimeout(main, 2000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment