diff options
Diffstat (limited to 'arte')
-rw-r--r-- | arte/__init__.py | 0 | ||||
-rwxr-xr-x | arte/__main__.py | 48 |
2 files changed, 0 insertions, 48 deletions
diff --git a/arte/__init__.py b/arte/__init__.py deleted file mode 100644 index e69de29..0000000 --- a/arte/__init__.py +++ /dev/null diff --git a/arte/__main__.py b/arte/__main__.py deleted file mode 100755 index a9e30df..0000000 --- a/arte/__main__.py +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/python - -"""A download a video from arte.tv website.""" - -from bs4 import BeautifulSoup -from urllib.request import urlopen, unquote, urlretrieve -import re, json, sys - -def main(): - if len(sys.argv) != 2: - print("Usage:") - print(" "+sys.argv[0]+" <arte.tv_link>") - print("Example:") - print(" "+sys.argv[0]+" https://www.arte.tv/fr/videos/051868-000-A/liberte-egalite-indemnites-vers-un-revenu-universel/") - sys.exit(0) - - url = sys.argv[1] - - content = urlopen(url) - - soup = BeautifulSoup(content, "lxml") - - iframes = soup.find_all("iframe") - - url = "" - - for iframe in iframes: - url = unquote(iframe['src']) - - url = re.split("url=",url)[1] - url = re.split("\?autostart", url)[0] - - content = urlopen(url) - json = json.loads(content.read().decode()) - name = json['videoJsonPlayer']['VTI'] - url = json['videoJsonPlayer']['VSR']['HTTPS_SQ_1']['url'] - - name=name+".mp4" - try: - print("Downloading '"+name+"'...") - urlretrieve(url, name) - print("\nDownload completed") - except Exception as e: - print(e) - - -if __name__ == "__main__": - main() |