Skip to content

Commit

Permalink
Merge pull request #4 from jonasjaguar/master
Browse files Browse the repository at this point in the history
Add folder prefix
  • Loading branch information
Giuseppe committed Oct 29, 2018
2 parents 06cac27 + 81c0acd commit 6714ac6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ By default the script works with Firefox. If you want to use Chrome: open the so
# Description
**openload-dl** is a script written in Python to automate the download of videos from openload.co with a simple command-line interface

openload-dl URL
openload-dl URL [FOLDER]

or with a list of urls

openload-dl FILE
openload-dl FILE [FOLDER]

Example

Expand All @@ -59,3 +59,10 @@ Example
On Windows

python openload-dl 'https://openload.co/f/UqAeeBcR1-o/myvideo.mp4'


To set a folder everything sould be downloaded to, specify the folder as second argument.

Example

./openload-dl 'https://openload.co/f/UqAeeBcR1-o/myvideo.mp4' '~/Videos/myvids/'
10 changes: 8 additions & 2 deletions openload-dl
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,19 @@ from selenium import webdriver
#We need these to avoid bot blocking by openload
mozilla_header={'User-Agent':'Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0'}

#Reading command argument
#Reading command arguments
if sys.argv[1].split('.')[-1]=='txt':
with open(sys.argv[1],'r') as urlfile:
links = urlfile.read().splitlines()
print('Download in sequence of '+str(len(links))+' files of the list '+sys.argv[1])
else:
links=[sys.argv[1]]
folder_prefix = ""
if len(sys.argv) == 3:
if sys.argv[2].endswith("/"):
folder_prefix = sys.argv[2]
else:
folder_prefix = sys.argv[2] + "/"


#Setting headless browser option
Expand All @@ -32,7 +38,7 @@ for url in links:

#Extracting file name
button=browser.find_element_by_css_selector('.other-title-bold')
filename=button.text
filename=folder_prefix + button.text
print("Extracting download link for "+filename)

#We search the button we have to click for the download
Expand Down

0 comments on commit 6714ac6

Please sign in to comment.