Last active
August 29, 2015 14:06
-
-
Save tomayac/c2358b1cbee764b679e9 to your computer and use it in GitHub Desktop.
TwitPic backup script
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
// Browse through your photo collection page-by-page, | |
// each time pasting the script in the console. | |
// Then save images one-by-one, or just "Save as" > "Web page complete". | |
// The alt attribute contains the original tweet text. | |
// License: CC0. Author: Thomas Steiner (tomayac). | |
var images = []; | |
Array.prototype.forEach.call(document.querySelectorAll('div[class~="user-photo"] a img'), function(img, i) { | |
img.src = /.*?\/thumb\/.*?/g.test(img.src) ? img.src.replace('/thumb/', '/large/') : img.src; | |
images[i] = '<img src="' + img.src + '" alt="' + img.alt.replace(/"/g, '"')+ '"/>'; | |
}); | |
document.write(images.join()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Perhaps
img.alt.replace(/"/g, '"')
for safety?