Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add features url for photo post for next update? #31

Open
jackingpanda opened this issue Jan 3, 2025 · 1 comment
Open

Add features url for photo post for next update? #31

jackingpanda opened this issue Jan 3, 2025 · 1 comment

Comments

@jackingpanda
Copy link

Hello, your project is so useful for my Tiktok HD Downloader project. But can you add more feature like photo url? Like this one?


image

Cause my project could support photo download too. It's so useful if you could add those features. Thank you!

@dinoosauro
Copy link
Owner

Hello! If you need to save those images now you can try opening those photos URL and pasting this script in the command line:

(async () => {
	let [title, id] = [document.querySelector(".css-1tgwhqp-H1PhotoTitle")?.textContent, window.location.href.substring(window.location.href.lastIndexOf("/") + 1)];
	if (id.indexOf("?") !== -1) id = id.substring(0, id.indexOf("?"));
	const images = Array.from(new Set(Array.from(document.querySelectorAll(".swiper-slide.swiper-slide-duplicate > img")).map(item => item.src)));
	const wait = (ms) => new Promise(res => setTimeout(res, ms));
	const getRandom = (max, min) => Math.random() * (max - min) + min
	for (let i = 0; i < images.length; i++) {
		const req = await fetch(images[i]);
		const res = await req.blob();
		Object.assign(document.createElement("a"), {
			href: URL.createObjectURL(res),
			target: "_blank",
			download: `[${i+1}] ${title} [${id}].jpeg`
		}).click();
		await wait(getRandom(50, 400)); // Change here the time the script should wait between downloads (in this case it's a random number between 50 and 400 ms)
	}
})()

Even if I think that you would like to do that programmatically. I could do something with Puppeteer, but developing that in a good way could take some time (and unfortunately I don't have a lot of free time in these days). I'll start writing this script here so that you can use it, and when I'll have done the script in Node.JS for automation I'll publish it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants