Last active
January 30, 2022 04:09
-
-
Save matchaxnb/a55515590362fc39f21577a9fdc1ede3 to your computer and use it in GitHub Desktop.
Tools to generate public torrents. Very useful when releasing open source distros or open source big works
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
#!/usr/bin/env python | |
""" | |
fetch-public-trackers.py: generate a list of public trackers | |
use this to release open source software to public trackers. | |
uses bs4 and requests | |
""" | |
from bs4 import BeautifulSoup | |
import requests | |
TRACKER_URL = "https://techspree.net/torrent-tracker-list-updated/" | |
FIND_PATTERN=dict(selector="pre.techspreeprint") | |
def main(): | |
h = requests.get(TRACKER_URL) | |
soup = BeautifulSoup(h.content) | |
try: | |
data = soup.select(**FIND_PATTERN)[0] | |
except IndexError: | |
raise RuntimeError("broken selector, please check fetch-public-trackers.py") | |
trackers = [f.strip() for f in data.string.replace('\r\n', '\n').split('\n') if f.strip()] | |
return trackers | |
if __name__ == '__main__': | |
print('\n'.join(main())) |
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
#!/bin/sh | |
# depends on dottorrent-cli. current version is broken, we're considering forking it. | |
TRACKERS=$(python fetch-public-trackers.py | awk '{ printf(" --tracker %s", $0)}; END { print ""}') | |
TORRENT_DIR=./public-torrents/ | |
DIRECTORY=$1 | |
SUBDIR=$2 | |
mkdir -p $TORRENT_DIR/$SUBDIR | |
dottorrent -v -p --source macha $TRACKERS "$DIRECTORY" "$TORRENT_DIR/$SUBDIR" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment