blob: 7a71df2be294204f569529923895bb7b692d047e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
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)
|