@@ -369,44 +369,44 @@ get_uptodown_resp() {
369
369
get_uptodown_vers () { $HTMLQ --text " .version" <<< " $__UPTODOWN_RESP__" ; }
370
370
dl_uptodown () {
371
371
local uptodown_dlurl=$1 version=$2 output=$3 arch=$4 _dpi=$5
372
+ local apparch
372
373
if [ " $arch " = " arm-v7a" ]; then arch=" armeabi-v7a" ; fi
374
+ if [ " $arch " = all ]; then
375
+ apparch=(' arm64-v8a, armeabi-v7a, x86, x86_64' ' arm64-v8a, armeabi-v7a' )
376
+ else apparch=(" $arch " ' arm64-v8a, armeabi-v7a, x86, x86_64' ' arm64-v8a, armeabi-v7a' ); fi
377
+
373
378
local op resp data_code
374
379
data_code=$( $HTMLQ " #detail-app-name" --attribute data-code <<< " $__UPTODOWN_RESP__" )
375
380
local versionURL=" "
376
- local might_be_bundle =false
381
+ local is_bundle =false
377
382
for i in {1..5}; do
378
383
resp=$( req " ${uptodown_dlurl} /apps/${data_code} /versions/${i} " -)
379
384
if ! op=$( jq -e -r " .data | map(select(.version == \" ${version} \" )) | .[0]" <<< " $resp" ) ; then
380
385
continue
381
386
fi
382
- if [ $( jq -e -r " .kindFile" <<< " $op" ) = " xapk" ]; then might_be_bundle =true; fi
387
+ if [ " $( jq -e -r " .kindFile" <<< " $op" ) " = " xapk" ]; then is_bundle =true; fi
383
388
if versionURL=$( jq -e -r ' .versionURL' <<< " $op" ) ; then break ; else return 1; fi
384
389
done
385
390
if [ -z " $versionURL " ]; then return 1; fi
386
391
resp=$( req " $versionURL " -) || return 1
387
- if [ " $arch " != all ] ; then
388
- local data_version files node_arch data_file_id
389
- data_version=$( $HTMLQ ' .button.variants' --attribute data-version <<< " $resp" ) || return 1
390
- files=$( req " ${uptodown_dlurl%/* } /app/${data_code} /version/${data_version} /files" - | jq -e -r .content) || return 1
391
- for (( n = 1 ; n < 12 ; n += 2 )) ; do
392
- node_arch=$( $HTMLQ " .content > p:nth-child($n )" --text <<< " $files" | xargs) || return 1
393
- if [ -z " $node_arch " ]; then return 1; fi
394
- if [ " $node_arch " != " $arch " ] ; then continue ; fi
395
- data_file_id=$( $HTMLQ " div.variant:nth-child($(( n + 1 )) ) > .v-report" --attribute data-file-id <<< " $files" ) || return 1
396
- resp=$( req " ${uptodown_dlurl} /download/${data_file_id} " -)
397
- break
398
- done
399
- fi
392
+
393
+ local data_version files node_arch data_file_id
394
+ data_version=$( $HTMLQ ' .button.variants' --attribute data-version <<< " $resp" ) || return 1
395
+ files=$( req " ${uptodown_dlurl%/* } /app/${data_code} /version/${data_version} /files" - | jq -e -r .content) || return 1
396
+ for (( n = 1 ; n < 12 ; n += 2 )) ; do
397
+ node_arch=$( $HTMLQ " .content > p:nth-child($n )" --text <<< " $files" | xargs) || return 1
398
+ if [ -z " $node_arch " ]; then return 1; fi
399
+ if ! isoneof " $node_arch " " ${apparch[@]} " ; then continue ; fi
400
+ data_file_id=$( $HTMLQ " div.variant:nth-child($(( n + 1 )) ) > .v-report" --attribute data-file-id <<< " $files" ) || return 1
401
+ resp=$( req " ${uptodown_dlurl} /download/${data_file_id} -x " -)
402
+ break
403
+ done
404
+
400
405
local data_url
401
406
data_url=$( $HTMLQ " #detail-download-button" --attribute data-url <<< " $resp" ) || return 1
402
-
403
- if [ $might_be_bundle = true ]; then
407
+ if [ $is_bundle = true ]; then
404
408
req " https://dw.uptodown.com/dwn/${data_url} " " $output .apkm" || return 1
405
- if grep -qF " AndroidManifest.xml" <<< $( unzip -l " $output .apkm" ); then
406
- mv -f " ${output} .apkm" " ${output} "
407
- else
408
- merge_splits " ${output} .apkm" " ${output} "
409
- fi
409
+ merge_splits " ${output} .apkm" " ${output} "
410
410
else
411
411
req " https://dw.uptodown.com/dwn/${data_url} " " $output "
412
412
fi
0 commit comments