Last active
November 14, 2020 13:27
-
-
Save MCOfficer/1cd9afcd370694c9a054c2a3a69e75e2 to your computer and use it in GitHub Desktop.
OpenDirectoryDownloader batch scanning
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
# Reads URLs from to_scan.txt, one URL per line. | |
# Outputs the reddit-formatted results to results.txt | |
import subprocess | |
import os | |
with open("to_scan.txt", "r") as f: | |
urls = [line.strip() for line in f.readlines()] | |
print("Scanning %s URLs" % len(urls)) | |
print("Removing History.log") | |
os.remove("History.log") | |
print("Clearing results.txt") | |
os.remove("results.txt") | |
for url in urls: | |
subprocess.run(["./OpenDirectoryDownloader", "-u", url, "-l", "-s", "-q"]) | |
with open("History.log", "r") as f: | |
lines = "" | |
for line in f.readlines(): | |
if line.startswith("|") or line.startswith("\n"): | |
lines += line | |
lines += "\n^(Created by [KoalaBear84's OpenDirectory Indexer](https://github.com/KoalaBear84/OpenDirectoryDownloader/))" | |
with open("results.txt", "a") as f: | |
f.write(lines) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment