mirror of
https://github.com/FiorenMas/Revanced-And-Revanced-Extended-Non-Root.git
synced 2025-12-06 16:17:40 +00:00
Fix apkmirror
This commit is contained in:
@@ -21,6 +21,16 @@ fi
|
||||
|
||||
#################################################
|
||||
|
||||
# Download the htmlq for to get apk from APKMirror
|
||||
dl_htmlq() {
|
||||
req "https://github.com/mgdm/htmlq/releases/latest/download/htmlq-x86_64-linux.tar.gz" "./htmlq.tar.gz"
|
||||
tar -xf "./htmlq.tar.gz" -C "./"
|
||||
rm "./htmlq.tar.gz"
|
||||
HTMLQ="./htmlq"
|
||||
}
|
||||
|
||||
#################################################
|
||||
|
||||
# Download Github assets requirement:
|
||||
dl_gh() {
|
||||
for repo in $1 ; do
|
||||
@@ -64,9 +74,21 @@ get_ver() {
|
||||
#################################################
|
||||
|
||||
# Download apks files from APKMirror:
|
||||
req() {
|
||||
wget -nv -O "$2" -U "Mozilla/5.0 (X11; Linux x86_64; rv:111.0) Gecko/20100101 Firefox/111.0" "$1"
|
||||
|
||||
_req() {
|
||||
if [ "$2" = - ]; then
|
||||
wget -nv -O "$2" --header="$3" "$1"
|
||||
else
|
||||
local dlp
|
||||
dlp="$(dirname "$2")/$(basename "$2")"
|
||||
if [ -f "$dlp" ]; then
|
||||
while [ -f "$dlp" ]; do sleep 1; done
|
||||
return
|
||||
fi
|
||||
wget -nv -O "$dlp" --header="$3" "$1" || return 1
|
||||
fi
|
||||
}
|
||||
req() { _req "$1" "$2" "User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:108.0) Gecko/20100101 Firefox/108.0"; }
|
||||
|
||||
get_apk_vers() {
|
||||
req "$1" - | sed -n 's;.*Version:</span><span class="infoSlide-value">\(.*\) </span>.*;\1;p'
|
||||
@@ -81,11 +103,17 @@ get_largest_ver() {
|
||||
}
|
||||
|
||||
dl_apk() {
|
||||
local url=$1 regexp=$2 output=$3
|
||||
local url=$1 regexp=$2 output=$3 resp
|
||||
url="https://www.apkmirror.com$(req "$url" - | tr '\n' ' ' | sed -n "s/href=\"/@/g; s;.*${regexp}.*;\1;p")"
|
||||
echo "$url"
|
||||
url="https://www.apkmirror.com$(req "$url" - | tr '\n' ' ' | sed -n 's;.*href="\(.*key=[^"]*\)">.*;\1;p')"
|
||||
url="https://www.apkmirror.com$(req "$url" - | tr '\n' ' ' | sed -n 's;.*href="\(.*key=[^"]*\)">.*;\1;p')"
|
||||
url=$(req "$url" - | $HTMLQ --base https://www.apkmirror.com --attribute href "a.accent_bg.btn")
|
||||
resp=$(req "$url" - | $HTMLQ --base https://www.apkmirror.com --attribute href "span > a[rel = nofollow]")
|
||||
if [[ -z $resp ]]; then
|
||||
url=$(req "$url" - | $HTMLQ --base https://www.apkmirror.com --attribute href "a.accent_bg.btn")
|
||||
url=$(req "$url" - | $HTMLQ --base https://www.apkmirror.com --attribute href "span > a[rel = nofollow]")
|
||||
else
|
||||
url=$(req "$url" - | $HTMLQ --base https://www.apkmirror.com --attribute href "span > a[rel = nofollow]")
|
||||
fi
|
||||
req "$url" "$output"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user