This commit is contained in:
parent
bfc29ab8ee
commit
99162297ee
@ -4,7 +4,7 @@ RUN apt-get update && \
|
||||
apt-get install -y \
|
||||
vim p7zip* git rsync ncftp speedtest-cli rename wget curl procps psmisc \
|
||||
openssh-client transmission-cli \
|
||||
python3-requests python3-bs4 python3-charset-normalizer && \
|
||||
python3-bs4 python3-charset-normalizer python3-requests python3-transmissionrpc && \
|
||||
apt-get install -y --no-install-recommends yt-dlp && \
|
||||
rm -rf /var/lib/apt/lists/* && \
|
||||
curl -sSL https://raw.githubusercontent.com/MatanZ/tremc/main/tremc -o /usr/local/bin/tremc && \
|
||||
|
43
commands/nyaa-404.py
Normal file
43
commands/nyaa-404.py
Normal file
@ -0,0 +1,43 @@
|
||||
from argparse import ArgumentParser
|
||||
from logging import INFO, StreamHandler
|
||||
from os import path
|
||||
from sys import stdout
|
||||
from time import sleep
|
||||
|
||||
from requests import head
|
||||
from transmissionrpc import Client, DefaultHTTPHandler, LOGGER
|
||||
|
||||
|
||||
parser = ArgumentParser()
|
||||
parser.add_argument('-u', '--username', required=True)
|
||||
parser.add_argument('-p', '--password', required=True)
|
||||
args = parser.parse_args()
|
||||
|
||||
LOGGER.setLevel(INFO)
|
||||
LOGGER.addHandler(StreamHandler(stdout))
|
||||
|
||||
|
||||
class CustomHTTPHandler(DefaultHTTPHandler):
|
||||
def request(self, url, query, headers, timeout):
|
||||
headers[
|
||||
"User-Agent"
|
||||
] = "Mozilla/5.0 (X11; Linux x86_64; rv:111.0) Gecko/20100101 Firefox/111.0"
|
||||
return super().request(url, query, headers, timeout)
|
||||
|
||||
|
||||
client = Client(
|
||||
"https://torrent.crystalyx.net/transmission/rpc",
|
||||
port=443,
|
||||
user=args.username,
|
||||
password=args.password,
|
||||
http_handler=CustomHTTPHandler(),
|
||||
)
|
||||
|
||||
for torrent in client.get_torrents():
|
||||
if "nyaa" in torrent.comment:
|
||||
response = head(torrent.comment)
|
||||
if response.status_code != 200:
|
||||
print(
|
||||
f"{response.status_code} - {path.join(torrent.downloadDir, torrent.name)}"
|
||||
)
|
||||
sleep(1)
|
Loading…
Reference in New Issue
Block a user