summaryrefslogtreecommitdiffstats
path: root/skripti
diff options
context:
space:
mode:
authorAnton Luka Šijanec <anton@sijanec.eu>2023-02-19 13:46:21 +0100
committerAnton Luka Šijanec <anton@sijanec.eu>2023-02-19 13:46:21 +0100
commit860f9f30a5ffabd04389bd295483bcc3cec1f1ae (patch)
treebad99aa030bbc9ee59213e06a8b28a73d56dbe2c /skripti
parentkonc (diff)
downloadr-860f9f30a5ffabd04389bd295483bcc3cec1f1ae.tar
r-860f9f30a5ffabd04389bd295483bcc3cec1f1ae.tar.gz
r-860f9f30a5ffabd04389bd295483bcc3cec1f1ae.tar.bz2
r-860f9f30a5ffabd04389bd295483bcc3cec1f1ae.tar.lz
r-860f9f30a5ffabd04389bd295483bcc3cec1f1ae.tar.xz
r-860f9f30a5ffabd04389bd295483bcc3cec1f1ae.tar.zst
r-860f9f30a5ffabd04389bd295483bcc3cec1f1ae.zip
Diffstat (limited to 'skripti')
-rwxr-xr-xskripti/4chan-thread-dl.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/skripti/4chan-thread-dl.py b/skripti/4chan-thread-dl.py
new file mode 100755
index 0000000..7a71df2
--- /dev/null
+++ b/skripti/4chan-thread-dl.py
@@ -0,0 +1,11 @@
+#!/usr/bin/python3
+from bs4 import BeautifulSoup
+from requests import get
+from sys import argv
+if len(argv) != 3:
+ raise Exception("prvi arg je url do threada, drugi arg je končnica, recimo .webm")
+s = BeautifulSoup(get(argv[1]).content, "html.parser")
+for a in s.find_all("a"):
+ if a.attrs["href"].endswith(argv[2]) and "title" in a.attrs and "/" not in a.attrs["title"]:
+ print(a.attrs["title"])
+ open(a.attrs["title"], "wb").write(get("http:" + a.attrs["href"]).content)