Fix apkmirror

This commit is contained in:
siritami
2023-07-30 19:38:32 +07:00
parent cb328f8069
commit 4af1ee2945
4 changed files with 37 additions and 6 deletions

View File

@@ -12,6 +12,7 @@ checker "kitadai31/revanced-patches-android6-7" "revanced-extended-android-6-7"
# Download requirement patches
dl_gh "revanced-patches-android6-7 revanced-integrations" "kitadai31" "latest"
dl_gh "revanced-cli" "inotia00" "latest"
dl_htmlq
#################################################

View File

@@ -9,8 +9,9 @@ checker "inotia00/revanced-patches" "revanced-extended"
#################################################
# Download requirement patches
# Download requirements
dl_gh "revanced-patches revanced-cli revanced-integrations" "inotia00" "latest"
dl_htmlq
#################################################

View File

@@ -11,6 +11,7 @@ checker "revanced/revanced-patches" "revanced"
# Download requirement patches
dl_gh "revanced-patches revanced-cli revanced-integrations" "revanced" "latest"
dl_htmlq
#################################################

View File

@@ -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"
}