Created
April 21, 2014 18:58
-
-
Save kingkool68/11152740 to your computer and use it in GitHub Desktop.
Download the URL, title, and date for all of the posts on a given archive page URL such as http://www.pewresearch.org/category/publications/fact-tank/project/u-s-politics/2014/pages/all/ Copy and paste this into the Console of the developer tools.
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
jQuery( document ).ready( function($) { | |
var csv = "data:text/csv;charset=utf-8,"; | |
var csvData = []; | |
$('#content .post').each(function() { | |
$this = $(this); | |
csvData.push( [this.href, $this.find('h2').text(), $this.find('.meta span:last-of-type').text() ] ); | |
}); | |
for( i=0; i < csvData.length; i++ ) { | |
var row = '"' + csvData[i].join('","') + '"'; | |
if( i < csvData.length ){ | |
row += "\n"; | |
} | |
csv += row; | |
} | |
window.open( encodeURI(csv) ); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this is handy ....