From 4cf50feef9992a267cdaad758002f2b52417020e Mon Sep 17 00:00:00 2001 From: Matthieu Crapet Date: Fri, 20 May 2016 19:21:49 +0200 Subject: [PATCH] openload: fix anonymous download (upstream) Fixes #83. --- openload.sh | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/openload.sh b/openload.sh index e28f1878..2ac9d95a 100644 --- a/openload.sh +++ b/openload.sh @@ -105,7 +105,7 @@ openload_login() { # stdout: real file download link openload_download() { local -r URL=$2 - local PAGE WAIT FILE_URL FILE_NAME + local PAGE WAIT FILE_URL JS PAGE=$(curl -L "$URL") || return @@ -113,15 +113,32 @@ openload_download() { return $ERR_LINK_DEAD fi - WAIT=$(parse_tag 'id="secondsleft"' span <<< "$PAGE") || return + detect_javascript || return + WAIT=$(parse_tag 'id="secondsleft"' span <<< "$PAGE") || return wait $(($WAIT)) seconds || return - FILE_URL=$(parse_attr 'id="realdownload"' href <<< "$PAGE") - FILE_NAME=$(parse_tag 'id="filename"' span <<< "$PAGE") + # Obfuscated code with utf-8 variable names + JS=$(grep_script_by_order "$PAGE" 12) || return + JS=${JS#} + + FILE_URL=$(echo " +attr = function(name,value) { + if (typeof console === 'object' && typeof console.log === 'function') { + console.log(value); + } else { + print(value); + } +} +\$ = function(obj) { + return { + attr: attr + }; +} +$JS" | javascript) || return echo "$FILE_URL" - echo "$FILE_NAME" } # Static function. Check if a cookie doesn't expired.