From df93cbde8f7aef0ce4b72e437a1bfb819da7662b Mon Sep 17 00:00:00 2001 From: Imran Remtulla Date: Fri, 6 Oct 2023 20:37:14 -0400 Subject: [PATCH] Fix UpToDown (#962) --- lib/app_sources/uptodown.dart | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/app_sources/uptodown.dart b/lib/app_sources/uptodown.dart index 7b36cc3..86b640c 100644 --- a/lib/app_sources/uptodown.dart +++ b/lib/app_sources/uptodown.dart @@ -80,4 +80,20 @@ class Uptodown extends AppSource { version, getApkUrlsFromUrls([apkUrl]), AppNames(author, appName), releaseDate: relDate); } + + @override + Future apkUrlPrefetchModifier( + String apkUrl, String standardUrl) async { + var res = await sourceRequest(apkUrl); + if (res.statusCode != 200) { + throw getObtainiumHttpError(res); + } + var html = parse(res.body); + var finalUrl = + (html.querySelector('.post-download')?.attributes['data-url']); + if (finalUrl == null) { + throw NoAPKError(); + } + return finalUrl; + } }