Giter Club home page Giter Club logo

iviewdl's Introduction

iviewdl

The fancy package has been replaced by a single script! new_iviewdl.py

Depends on ffmpeg and youtube-dl

Old readme

A Python program to download videos from ABC iView. Requires ffmpeg installed

Usage

  • pip install git+https://github.com/blha303/iviewdl
  • iviewdl micallef
    • If there is more than one result, it will return a list, re-run the command with --selection [n] to pick
  • Pass --filename=[fn] to set the filename

Contributing

Open iviewdl/iviewdl.py, have a look, it's pretty straightforward. I don't want to be the only person that knows how the site works, there needs to be clients in more languages than Python. If there's a bug to fix or more features to add, please submit an issue or a pull request.

Forks

bobri/iviewdl - Adds feature to batch download from a list of urls in a file (#7)

iviewdl's People

Contributors

alwinius avatar blha303 avatar gurok avatar jschultz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

iviewdl's Issues

Go further back than 4 shows?

I can't seem to find anything more than 4 episodes back, because of the selection options, yet when I look on iview, I can see the episodes.

HTTP error 400 Bad Request

Fresh install of Ubuntu 16.04 on Virtualbox. I can see the episodes (although not all the episodes listed on iView) but when I select one for download:

[http @ 0x16c1d20] HTTP error 400 Bad Request
http://iviewum-vh.akamaihd.net/i/playback/_definst_/_video/cat/catalyst_17_07_20180122172128_,650000,500000,220000,.mp4.csmil/master.m3u8?hdneast=1519030278~exp=1519040277~acl=/*~hmac=878d5bea27b0391d0e4f4701d6e9e0fe4733f70dbc81f8c33c25e30f2114ea73: Server returned 400 Bad Request

Help

How exactly do I get this to work?

KeyError: '_embedded'

Hi,

Thanks for making this project, it's great. It mostly works, however sometimes I get: KeyError: '_embedded'

$ /usr/local/bin/new_iviewdl.py https://iview.abc.net.au/show/300-years-of-french-and-saunders
Traceback (most recent call last):
File "/usr/local/bin/new_iviewdl.py", line 27, in
main()
File "/usr/local/bin/new_iviewdl.py", line 23, in main
download_url_list([ep["shareUrl"] for ep in data["page"]["pageData"]["_embedded"]["selectedSeries"]["_embedded"]["videoEpisodes"]])
KeyError: '_embedded'

Some URLs will work, some will not, in the same session. I have tried waiting a few days but the URLs that don't work continue to not work until they expire. All other usage conditions are identical.

Running on macOS Sierra, Python 2.7, youtube-dl is installed and working. This error seems to affect about 25% of the URLs I try on iview. Grateful for any assistance you can provide.

FYI. There is a warning about crypto version being slow

I noticed a warning about the crypto version on my machine (linux mint 18) potentially being out of date and slow

The version was 1.2.3

However, after upgrading to the latest version of the cryptography lib for Python (2.7) there were other warnings, which required OpenSSL to be installed and after both were installed, unfortunately iviewdl.py had problems, which seemed to be related to ascii encoding of the responses (probably to URL requests)

So my only option was to rollback the changes, which in the end required me to re-install python

I'm going to retest on Linux Mint 19 Mate, to confirm its stable with whatever version of Python cypto is installed by default in Linux Mint

I'll update this issue when I can confirm its OK in Linux Mint 19 (and see what version of cryptography is installed)

Select from multiple choices

Hi Steven,
I installed using pip3..
pip3 install git+https://github.com/blha303/iviewdl

Using; $ iviewdl micallef
gives;
0: Shaun Micallef's MAD AS HELL Series 7 Ep 5
1: Shaun Micallef's MAD AS HELL Series 7 Ep 4
2: Shaun Micallef's MAD AS HELL Series 7 Ep 3

but I can't figure out how to download No2.
I've tried every variation of;
$ iviewdl micallef --selection 2
that I can think of to no avail.

Pretty sure I'm missing something simple, but I'd appreciate any help .

Regards
Denis

Problems with setuptools on some systems

The Readme should probably be updated note that python setuptools are not installed by default on some systems.

My old version of Linux Mate had them installed but the latest version doesn't

So I had to install them via pip

pip install setuptools

However also, on the latest Linux Mate, the path to the the installer doesn't seem to make iviewdl available from the console.

I ended up cloning the repo to my hone directory and now run python, passing iviewdl and the search string as arguments

i.e

python iviewdl news

"--selection 0" reprints episode list instead of downloading first episode

Hi,
I notice the --selection arguement not working as it should be, specifically "--selection 0" just reprints the episode list instead of downloading the first episode in the list.

I believe the issue lies at line 70 in iviewdl.py.
The parser.add_argument is adding --selection as an argument, regardless of if the user specifies that argument or not.

So if a user does not specify --selection [n], it's actually set to the python null value "None".

Consequently on line 70 if not args.selection does not work correctly because it has been set, just to "None".

I believe line 70 should be something like the following which works for me:

if args.selection is None:

Existing code excerpt for reference:

def main():
    from argparse import ArgumentParser
    import subprocess
    parser = ArgumentParser()
    parser.add_argument("search")
    parser.add_argument("--selection", help="Number of video to get", type=int)
    parser.add_argument("--filename")
    args = parser.parse_args()
    results = search(args.search)
    if len(results) > 1:
        if not args.selection:
   ..........

I can do a pull request if you like but as it's just one line...

TypeError: string argument without an encoding

I've got the latest release, and while the search function works fine, I can't actually download a video:

$ iviewdl Tonightly
0: Tonightly With Tom Ballard The Best Ever
1: Tonightly With Tom Ballard 6/9/2018
2: Tonightly With Tom Ballard 5/9/2018
enter your choice: 2
Downloading Tonightly With Tom Ballard 5/9/2018
Traceback (most recent call last):
File "/usr/local/bin/iviewdl", line 11, in
sys.exit(main())
File "/usr/local/lib/python3.7/site-packages/iviewdl/iviewdl.py", line 129, in main
data = get_stream_urls(requests.get("http://iview.abc.net.au/api/" + result["href"]).json())
File "/usr/local/lib/python3.7/site-packages/iviewdl/iviewdl.py", line 62, in get_stream_urls
out["rating"] = p["hls-plus"] + generate_secret(data["episodeHouseNumber"])
File "/usr/local/lib/python3.7/site-packages/iviewdl/iviewdl.py", line 39, in generate_secret
message = bytes(urlparam)
TypeError: string argument without an encoding

Fix for ffmpeg thread queue size warning

Hi

I noticed that I was getting warnings when downloading some programs, because the ffmpeg thread_queue_size seemed to be too low

So, after some messing around, I think a possible fix is to add the

-thread_queue_size as the first argument to ffmpeg and set the value to 512

I tried values like 64 and 256 but still got the warning, but setting it to 512 seemed to get rid of the warnings.

def get_download_cmd(urls, filename=None):
    out = ["ffmpeg"]
    out += ["-thread_queue_size" , "512"]
... etc

BTW. I tied putting this option a bit further down the list of arguments, but ffmpeg gave an error saying that this option needed to be put before the input stream to which it related, hence I just put it as the first argument

Incomplete episode list

When I run iviewdl Killing, I see:

    0: Killing Eve Series 1 Ep 2 I'll Deal With Him Later
    1: Killing Eve Series 1 Ep 5 I Have A Thing About Bathrooms
    2: Killing Eve Series 1 Ep 7 I Don't Want To Be Free

This is what am offered by the iView app on my crappy set top box. But, on the ABC website, episodes 1 through to 8 are all available. The episodes that are offered above all download perfectly, it's just that I can't find a way to access the other 5 episodes.

Is there any chance that there might be a simple fix to get the rest?

How do I install the dependancies

Can you explain on more detail how you install ffmpeg and youtube-dl to me compatible with this

I've got both of these installed already on my machine, but I'm still getting the error about youtube-dl

HTTP error 403 forbidden

16:57 | <-->> | lolok ([email protected]) has joined #blha303
16:58 | | fix iviewdl pls :)
17:00 | <<--> | lolok ([email protected]) has quit (Client Quit)
Don't report bugs like this. There's an issue tracker.

Getting access denied on previously-working urls. Attempt to fix is below, doesn't work, more work needed

 diff --git a/iviewdl/iviewdl.py b/iviewdl/iviewdl.py
index 09c7f60..be53164 100644
--- a/iviewdl/iviewdl.py
+++ b/iviewdl/iviewdl.py
@@ -30,7 +30,7 @@ def vtt_to_srt(url):
         return temp.name
 
 def fix_stream_url(url):
-    return url.replace("iviewhls-i.akamaihd", "iviewum-vh.akamaihd") + "?hdnea" + TOKEN
+    return url + "?hdcore=true&hdnea=" + TOKEN
 
 def get_stream_urls(data):
     if data["playlist"]:
@@ -49,8 +49,9 @@ def get_stream_urls(data):
     else:
         raise Exception("No playlist data")
 
-def get_download_cmd(urls, filename=None):
+def get_download_cmd(urls, filename=None, result=None):
     out = ["ffmpeg"]
+    out += ["-headers", "Referer: http://iview.abc.net.au/" + result["href"] + "\r\nX-Requested-With: ShockwaveFlash/28.0.0.126\r\nUser-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.108 Safari/537.36\r\n"]
     out += ["-i", urls["program"]]
     if "subs" in urls:
         out += ["-i", urls["subs"]]
@@ -97,7 +98,7 @@ def main():
         result = results[0]
     print("Downloading {seriesTitle} {title}".format(**result), file=sys.stdout)
     data = get_stream_urls(requests.get("http://iview.abc.net.au/api/" + result["href"]).json())
-    process = subprocess.Popen(get_download_cmd(data, filename=args.filename), stdout=subprocess.PIPE)
+    process = subprocess.Popen(get_download_cmd(data, filename=args.filename, result=result), stdout=subprocess.PIPE)
     process.wait()
     return process.returncode
 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.