Skip to content

Instantly share code, notes, and snippets.

@lingsamuel
Last active May 20, 2023 05:46
Show Gist options
  • Save lingsamuel/e7d8ba15369024a3ada829693ad0902d to your computer and use it in GitHub Desktop.
Save lingsamuel/e7d8ba15369024a3ada829693ad0902d to your computer and use it in GitHub Desktop.
How to download Twitter images in batches(Chrome)
// 0. Press F12, open network panel, select img filter
// 1. Open media page in Twitter(https://twitter.com/user_name/media)
// 2. Hold page down to get a loooots of images, you can see that in network panel
// 3. Right click a filename and select 'Copy=>Copy all as HAR'
// 4. Using JavaScript to extract image URLs.
let har = [ /*paste*/ ];
function getURL(harsObj, mimeArray) {
let results = [];
harsObj[0].log.entries.forEach(entry => {
if(mimeArray.includes(entry.response.content.mimeType)){
results.push(entry.request.url);
}
});
return results;
}
let results = getURL(har, ["image/jpeg", "image/png"]);
console.log(results.join('\n'));
// 5. Copy and paste result to a text file.
// 6. wget -i filename.txt -e use_proxy=yes -e https_proxy=127.0.0.1:1080
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment