soraxas / echo360

Commandline tool for automated downloads of echo360 videos hosted by university
https://cs.tinyiu.com/echo360
MIT License
262 stars 51 forks source link

does not work with echo360.org.uk #19

Closed Soneji closed 4 years ago

Soneji commented 4 years ago

Hi

I am trying to use your program to download some lectures from echo360.org.uk site. I get these errors:

./run.sh https://echo360.org.uk/section/571de44e-ecab-4a70-8ea5-e8833577dcee/home
=================================================================
Binary file of phantomjs not found, will initiate a download process now...
>> Downloading phantomjs binary file for "macosx"
100% [........................................................................] 17148816 / 17148816
>> Extracting archive file "phantomjs-2.1.1-macosx.zip"
Done!
=================================================================
>>> Download will use "PhantomJS" webdriver from LOCAL executable <<<
>> Logging into "https://echo360.org.uk/ess/portal/section/home"... INFO: No need to login :)
Done!
>> Retrieving echo360 Course Info... selenium cannot find given elements
Exception: Message: {"errorMessage":"Unable to find element with tag name 'pre'","request":{"headers":{"Accept":"application/json","Accept-Encoding":"identity","Content-Length":"90","Content-Type":"application/json;charset=UTF-8","Host":"127.0.0.1:56131","User-Agent":"selenium/3.141.0 (python mac)"},"httpVersion":"1.1","method":"POST","post":"{\"using\": \"tag name\", \"sessionId\": \"951cc890-9901-11ea-82fb-8b7ddc49c111\", \"value\": \"pre\"}","url":"/element","urlParsed":{"anchor":"","query":"","file":"element","directory":"/","path":"/element","relative":"/element","port":"","host":"","password":"","user":"","userInfo":"","authority":"","protocol":"","source":"/element","queryKey":{},"chunks":["element"]},"urlOriginal":"/session/951cc890-9901-11ea-82fb-8b7ddc49c111/element"}}
Screenshot: available via screen

It says I don't need a password but I'm pretty sure I do. When I run with chromedriver I get this error:

./run.sh https://echo360.org.uk/section/571de44e-ecab-4a70-8ea5-e8833577dcee/home --chrome --setup-credentials
>>> Download will use "ChromeDriver" webdriver from LOCAL executable <<<
> Type 'continue' and press [enter]
continue
>> Logging into "https://echo360.org.uk/ess/portal/section/home"... INFO: No need to login :)
Done!
>> Retrieving echo360 Course Info... selenium cannot find given elements
Exception: Message: no such element: Unable to locate element: {"method":"tag name","selector":"pre"}
  (Session info: chrome=81.0.4044.138)
  (Driver info: chromedriver=2.38.552518 (183d19265345f54ce39cbb94cf81ba5f15905011),platform=Mac OS X 10.15.4 x86_64)

When logged in the page looks like this: image And when logged out the page looks like this: image I can upload page source code as well if you need.

Any help would be appreciated. I have a little bit of programming experience. So if you could point me to which part of the code needs modifying I can give it a go

soraxas commented 4 years ago

Hi! Your issue is a duplicate of #1. However, with the latest PR #20 this module is now officially support echo360 cloud platform (echo360.org). Feel free to pull the latest master and try it out

Soneji commented 4 years ago

Thank you! This update has got me a lot further I managed to log in successfully and the script seems to have downloaded these 14 videos but I cant find them anywhere, and it also errors at the end. However I am still experiencing an issue

./run.sh https://echo360.org.uk/section/571de44e-ecab-4a70-8ea5-e8833577dcee/home
> Echo360 Cloud platform detected
> This implies setup_credential, and using web_driver
>> Please login with your SSO details and type continue when logged in.
-----------------------------------------------------------------
 >> After you finished logging into echo360 cloud, the window should be automatically redirected and continued. If it got stuck, please contact the author :)
>> I'm gonna assume you are responsible enough to had finished logged in by now ;)
>> Retrieving echo360 Course Info...  0/14 videos No audio+video m3u8 files found! Skipping...
This can either be (i) Credential failure? (ii) Logic error in the script. (iii) This lecture only provides audio?
This script is hard-coded to download audio+video. If this is your intended behaviour, please contact the author.
>> Retrieving echo360 Course Info...  14/14 videos Done!
Traceback (most recent call last):
  File "echo360.py", line 313, in <module>
    main()
  File "echo360.py", line 254, in main
    downloader.download_all()
  File "/Users/dhaval/git-clones/echo360/echo360/downloader.py", line 193, in download_all
    '{0}'.format(self._course.nice_name).strip())
  File "/Users/dhaval/git-clones/echo360/echo360/course.py", line 171, in nice_name
    return self.course_name
  File "/Users/dhaval/git-clones/echo360/echo360/course.py", line 165, in course_name
    candidate = self.course_data['data'][0]['lesson']['video']['published']['courseName']
KeyError: 'video'
soraxas commented 4 years ago

Would you be able to run it with the debug flag --debug and send me the result log file (under the same folder with a name like echo360Downloader.log) through mail? It would be helpful for me to debug it thanks!

Soneji commented 4 years ago

echo360Downloader.log here is log file

soraxas commented 4 years ago

Hi @overclockedllama thanks for your prompt response:)

The lastest commit should be able to successfully download your course.

Soneji commented 4 years ago

Thank you so much! It works. I was wondering whether it is possible to have a headless setup for this app, perhaps for a server deployment? Should I open another issue? I am happy to try add the headless support myself as I am a little familiar with python

soraxas commented 4 years ago

Awesome glad it helped! :)

Yeah that sounds great, it would be amazing if you can look into it. And yep a separate issue would be more appropriate

Soneji commented 4 years ago

Could you direct me to which part of the code starts the chromedriver session?

soraxas commented 4 years ago

EchoDownloader starts initialising at https://github.com/soraxas/echo360/blob/a3a675328bef1b9f84d3f2aa45fbd2b23bcaeecb/echo360/main.py#L242 and within it the webdrive was first set up at https://github.com/soraxas/echo360/blob/a3a675328bef1b9f84d3f2aa45fbd2b23bcaeecb/echo360/downloader.py#L72