Skip to content

Instantly share code, notes, and snippets.

@dolohow
Created February 24, 2023 11:33
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 dolohow/ce746e77ba4fc511b87ccbcc5ce1832f to your computer and use it in GitHub Desktop.
Save dolohow/ce746e77ba4fc511b87ccbcc5ce1832f to your computer and use it in GitHub Desktop.
Script that allows you to export image links from soon to be closed photoblog.pl
import { JSDOM } from 'jsdom';
const username = '...';
const number_of_pages = 1
async function parse(url) {
let response = await fetch(url)
let text = await response.text()
const dom = new JSDOM(text)
return dom.window;
}
for (let i = 1; i < number_of_pages + 1; i++) {
let url = `https://www.photoblog.pl/${username}/archiwum/strona/${i}`;
let page = await parse(url)
let photos = page.document.querySelectorAll('.arch_single > a');
photos.forEach(async p => {
let photoView = await parse(p.href)
let query = photoView.document.querySelector('#show_pic > img')
if (query) {
console.log(query.src.replace('w640', 'w1024'))
} else {
console.log('error', p.href)
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment