Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,6 @@ target/
# appp specific folders
bin/
default_out_path/

#
.vscode/
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,18 @@ Note: sometime it works better than phantomjs in some system
--chrome
```

### Use headless mode in echo360.org

Simply by supplying a username and password, your chromedriver session will be headless.
This means there will be no log in window and you can run this on a server for example.

```shell
>>> ./run.sh \
https://echo360.org.uk/section/534de63e-ecab-1a93-1ea8-e8225825dce/home \
-u [email protected]
-p password
```

# FAQ

### Is my university supported?
Expand Down
2 changes: 1 addition & 1 deletion echo360/downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def __init__(self,
if webdriver_to_use == 'chrome':
from selenium.webdriver.chrome.options import Options
opts = Options()
if not setup_credential:
if self._username!=None and self._password!=None:
opts.add_argument("--headless")
opts.add_argument("--window-size=1920x1080")
opts.add_argument("user-agent={}".format(self._useragent))
Expand Down
17 changes: 12 additions & 5 deletions echo360/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def cmd_exists(x):
binary_type, 'LOCAL'
if use_local_binary else 'GLOBAL'))
if setup_credential:
run_setup_credential(downloader._driver, course_hostname, echo360_cloud=True)
run_setup_credential(downloader._driver, course_hostname, username, password, echo360_cloud=True)
downloader._driver.set_window_size(0, 0)
downloader.download_all()

Expand All @@ -268,7 +268,7 @@ def start_download_binary(binary_downloader, binary_type, manual=False):
print('Done!')
print('=' * 65)

def run_setup_credential(webdriver, url, echo360_cloud=False):
def run_setup_credential(webdriver, url, username, password, echo360_cloud=False):
webdriver.get(url)
try:
# for making it compatiable with Python 2 & 3
Expand All @@ -277,9 +277,16 @@ def run_setup_credential(webdriver, url, echo360_cloud=False):
pass
try:
if echo360_cloud:
print(" >> After you finished logging into echo360 cloud, the window "
"should be automatically redirected and continued. If it got stuck, "
"please contact the author :)")
if username==None and password==None:
print(" >> After you finished logging into echo360 cloud, the window "
"should be automatically redirected and continued. If it got stuck, "
"please contact the author :)")
else:
webdriver.find_element_by_xpath('//*[@id="email"]').send_keys(username)
webdriver.find_element_by_xpath('//*[@id="submitBtn"]').click()

webdriver.find_element_by_xpath('//*[@id="password"]').send_keys(password)
webdriver.find_element_by_xpath('//*[@id="submitBtn"]').click()
while True:
if echo360_cloud:
# automatically wait for the Auth Token from webdriver
Expand Down