Skip to content

Commit

Permalink
openload: Grab fid from URL if we use embed link
Browse files Browse the repository at this point in the history
  • Loading branch information
kidburglar committed Apr 15, 2017
1 parent 5f4af74 commit 0e5e72f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions openload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,14 @@ openload_download() {
local FILE_ID FILE_NAME FILE_URL
local DL_TICKET CAPTCHA_URL

PAGE=$(curl -L "$URL") || return
FILE_ID=$(parse 'fid=' '"\(.*\)"' <<< "$PAGE") || return
# Take FILE_ID from URL if we use embed link
if match 'embed' "$URL" ; then
log_debug 'Grab FILE_ID from URL because we use embed link that must finish with /'
FILE_ID=$(parse '.' 'embed/\(.*\)/' <<< "$URL") || return
else
PAGE=$(curl -L "$URL") || return
FILE_ID=$(parse 'fid=' '"\(.*\)"' <<< "$PAGE") || return
fi
log_debug "FILE_ID: $FILE_ID"

# Request a download ticket
Expand Down

0 comments on commit 0e5e72f

Please sign in to comment.