Skip to content

Instantly share code, notes, and snippets.

@cfg
Created June 7, 2013 16:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cfg/5730452 to your computer and use it in GitHub Desktop.
Save cfg/5730452 to your computer and use it in GitHub Desktop.
Download a Land Rover/Range Rover manual from Topix. Run on a page like: http://topix.landrover.jlrext.com/topix/service/document/225542 (iframe from the service manual page). Download links with cURL, assemble using Acrobat or similar.
links=[]; all=[];
function n(n){
return n > 9 ? "" + n: "0" + n;
}
jQuery('#treeroot a').each(function(ix, val){
e=jQuery(this);
h='http://topix.landrover.jlrext.com/topix/service/procedure/225542/PDF/' + e.attr('rel').split('#')[0] + '/en_GB';
t=e.find('nobr').text();
links.push(h);
all.push([t,h]);
});
all_json = JSON.stringify(all);
links_json = JSON.stringify(links);
for( x = 0; x < links.length; x++ ) {
console.log("curl -s -S %s > %s.pdf", links[x], n(x));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment