Assorted shell and Python scripts
at main 1.3 kB view raw
1#!/usr/bin/env -S uv run --script 2# /// script 3# dependencies = [ 4# "requests", 5# "docopt", 6# ] 7# /// 8 9"""fetch_combined_trackers_list.py 10 11Description: 12This script fetches a combined list of tracker URLs from plaintext lists hosted 13on the web and writes them to a file in the current working directory. 14 15Usage: 16 fetch_combined_trackers_list.py 17 fetch_combined_trackers_list.py -h 18 19Options: 20 -h, --help show this help message and exit 21""" 22 23from pathlib import Path 24 25import requests 26from docopt import docopt 27 28if __name__ == "__main__": 29 args = docopt(__doc__) # type: ignore 30 31 live_trackers_list_urls = [ 32 "https://newtrackon.com/api/stable", 33 "https://trackerslist.com/best.txt", 34 "https://trackerslist.com/http.txt", 35 "https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_best.txt", 36 ] 37 38 combined_trackers_urls = [] 39 for url in live_trackers_list_urls: 40 response = requests.get(url, timeout=60) 41 tracker_urls = [x for x in response.text.splitlines() if x != ""] 42 combined_trackers_urls.extend(tracker_urls) 43 44 tracker_urls_filename = Path.cwd().joinpath("tracker_urls.txt") 45 with open(tracker_urls_filename, "w") as tf: 46 for url in combined_trackers_urls: 47 tf.write(f"{url}\n")