Created
February 24, 2023 11:33
-
-
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
This file contains 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
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