Skip to content

Commit

Permalink
mediafire (download): fix recaptcha
Browse files Browse the repository at this point in the history
Probably fixes mcrapet#80.
  • Loading branch information
Raziel-23 committed May 17, 2016
1 parent bd93a24 commit eb033ee
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions mediafire.sh
Original file line number Diff line number Diff line change
Expand Up @@ -257,15 +257,15 @@ mediafire_download() {

# handle captcha (reCaptcha or SolveMedia) if there is one
if match '<form[^>]*form_captcha' "$PAGE"; then
local FORM_CAPTCHA PUBKEY CHALLENGE ID RESP CAPTCHA_DATA
local FORM_CAPTCHA PUBKEY CHALLENGE ID RESP CAPTCHA_DATA SECURITY_CODE

FORM_CAPTCHA=$(grep_form_by_name "$PAGE" 'form_captcha') || return

if match 'recaptcha/api' "$FORM_CAPTCHA"; then
if match 'class="g-recaptcha"' "$FORM_CAPTCHA"; then
log_debug 'reCaptcha found'

local WORD
PUBKEY='6LextQUAAAAAALlQv0DSHOYxqF3DftRZxA5yebEe'
PUBKEY='6LeGuMUSAAAAACGl-wDE9NNLuUZygPg7iNvMGtXD'
RESP=$(recaptcha_process $PUBKEY) || return
{ read WORD; read CHALLENGE; read ID; } <<< "$RESP"

Expand All @@ -287,8 +287,11 @@ mediafire_download() {

log_debug "Captcha data: $CAPTCHA_DATA"

SECURITY_CODE=$(parse 'security' 'name="security" value="\([^"]*\)' \
<<< "$FORM_CAPTCHA") || return

PAGE=$(curl --location -b "$COOKIE_FILE" --referer "$URL" \
$CAPTCHA_DATA "$BASE_URL/?$FILE_ID") || return
-d "security=$SECURITY_CODE" $CAPTCHA_DATA "$BASE_URL/?$FILE_ID") || return

# Your entry was incorrect, please try again!
if match 'Your entry was incorrect' "$PAGE"; then
Expand Down

0 comments on commit eb033ee

Please sign in to comment.