diff options
-rw-r--r-- | README.md | 5 | ||||
-rwxr-xr-x | arte.tv-dl.py | 43 | ||||
-rw-r--r-- | arte/__init__.py | 0 | ||||
-rwxr-xr-x | arte/__main__.py | 48 | ||||
-rw-r--r-- | setup.cfg | 39 | ||||
-rw-r--r-- | setup.py | 7 |
6 files changed, 97 insertions, 45 deletions
@@ -7,13 +7,14 @@ This little script can download a video from arte.tv website. Juste run the following command for install requirements on your system: ``` -pip install -r requirements.txt +pip install pbr +pip install . ``` ## Usage ``` -./arte.tv-dl.sh <arte.tv_link> +arte_tv ``` ## Licence diff --git a/arte.tv-dl.py b/arte.tv-dl.py deleted file mode 100755 index bc61bdf..0000000 --- a/arte.tv-dl.py +++ /dev/null @@ -1,43 +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 - -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) diff --git a/arte/__init__.py b/arte/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/arte/__init__.py diff --git a/arte/__main__.py b/arte/__main__.py new file mode 100755 index 0000000..a9e30df --- /dev/null +++ b/arte/__main__.py @@ -0,0 +1,48 @@ +#!/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() diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..14ef91d --- /dev/null +++ b/setup.cfg @@ -0,0 +1,39 @@ +[metadata] +name = arte +home-page = https://git.neodarz.net/neodarz/scripts/arte.tv-dl.git +summary = Download videos from arte.tv +description-file = + README.md +author = NeodarZ +author-email = neodarz@neodarz.net +licence = GPL3 +classifier = + Development Status :: 5 - Production/Stable + Intended Audience :: Information Technology + License :: OSI Approved :: GNU General Public License v3 (GPLv3) + Operating System :: POSIX + Programming Language :: Python + Programming Language :: Python :: 2 + Programming Language :: Python :: 2.7 + Programming Language :: Python :: 3 + Programming Language :: Python :: 3.4 + Programming Language :: Python :: 3.5 + Programming Language :: Python :: 3.6 + +[files] +packages = + arte + +[extras] +devel= + fixtures + pbr + tox + bandit + +[entry_points] +console_scripts = + arte = arte.__main__:main + +[wheel] +universal = 1 diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..78c57ea --- /dev/null +++ b/setup.py @@ -0,0 +1,7 @@ +from setuptools import setup + +setup( + requires=['pbd'], + pbr=True, + long_description_content_type="text/markdown", +) |