Last active
November 3, 2025 12:58
-
-
Save NecRaul/4fc3bd564b64c39cfd144ed8405972db to your computer and use it in GitHub Desktop.
Archive
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
| #!/usr/bin/env python | |
| import requests | |
| import time | |
| import os | |
| with open("urls", "r") as f_urls, open("titles", "r") as f_titles: | |
| urls = f_urls.read().splitlines() | |
| titles = f_titles.read().splitlines() | |
| if len(urls) != len(titles): | |
| print("Error: The number of urls and titles do not match.") | |
| exit(1) | |
| def download_file(url, filename): | |
| response = requests.get(url, stream=True) | |
| if response.status_code == 200: | |
| with open(filename, "wb") as f: | |
| for chunk in response.iter_content(1024): | |
| f.write(chunk) | |
| print(f"Downloaded: {filename}") | |
| time.sleep(3) | |
| else: | |
| print(f"Failed to download ({response.status_code}): {url}") | |
| for url, title in zip(urls, titles): | |
| epoch = os.path.basename(url).split(".")[0] | |
| filename = f"{epoch} {title}" | |
| download_file(url, filename) |
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
| const filenames = []; | |
| const fileElements = document.getElementsByClassName("post_file_filename"); | |
| for (let i = 0; i < fileElements.length; i++) { | |
| const title = fileElements[i].getAttribute("title"); | |
| filenames.push(title ? title : fileElements[i].textContent); | |
| } | |
| const imagelinks = []; | |
| const linkElements = document.getElementsByClassName("thread_image_link"); | |
| for (let i = 0; i < linkElements.length; i++) { | |
| imagelinks.push(linkElements[i].href); | |
| } | |
| function download(filename, text) { | |
| const blob = new Blob([text], { type: "text/plain" }); | |
| const url = URL.createObjectURL(blob); | |
| const a = document.createElement("a"); | |
| a.href = url; | |
| a.download = filename; | |
| a.click(); | |
| URL.revokeObjectURL(url); | |
| } | |
| download("titles", filenames.join("\n")); | |
| download("urls", imagelinks.join("\n")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment