Skip to content

Instantly share code, notes, and snippets.

@vjk2005
Created May 27, 2017 19:25
Show Gist options
  • Save vjk2005/cac56407219b1c4b49d6d0fb655796fe to your computer and use it in GitHub Desktop.
Save vjk2005/cac56407219b1c4b49d6d0fb655796fe to your computer and use it in GitHub Desktop.
Load all pages of a search result on Arxiv! Death to pagination!
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