mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-08-05 23:00:16 +02:00
APKPure bugfix: Correctly extract APKs that are multi-arch but not universal
This commit is contained in:
@@ -68,11 +68,6 @@ class APKPure extends AppSource {
|
|||||||
'customLinkFilterRegex': '$standardUrl/download/[^/]+\$'
|
'customLinkFilterRegex': '$standardUrl/download/[^/]+\$'
|
||||||
});
|
});
|
||||||
|
|
||||||
// if (versionLinks.length > 7) {
|
|
||||||
// // Returns up to 30 which is too much - would take too long and possibly get blocked/rate-limited
|
|
||||||
// versionLinks = versionLinks.sublist(0, 7);
|
|
||||||
// }
|
|
||||||
|
|
||||||
var supportedArchs = (await DeviceInfoPlugin().androidInfo).supportedAbis;
|
var supportedArchs = (await DeviceInfoPlugin().androidInfo).supportedAbis;
|
||||||
|
|
||||||
if (additionalSettings['autoApkFilterByArch'] != true) {
|
if (additionalSettings['autoApkFilterByArch'] != true) {
|
||||||
@@ -94,11 +89,15 @@ class APKPure extends AppSource {
|
|||||||
var apkUrls = apksDiv
|
var apkUrls = apksDiv
|
||||||
?.querySelectorAll('div.group-title')
|
?.querySelectorAll('div.group-title')
|
||||||
.map((e) {
|
.map((e) {
|
||||||
String architecture = e.text.trim();
|
String architectureString = e.text.trim();
|
||||||
if (architecture.toLowerCase() == 'unlimited' ||
|
if (architectureString.toLowerCase() == 'unlimited' ||
|
||||||
architecture.toLowerCase() == 'universal') {
|
architectureString.toLowerCase() == 'universal') {
|
||||||
architecture = '';
|
architectureString = '';
|
||||||
}
|
}
|
||||||
|
List<String> architectures = architectureString
|
||||||
|
.split(',')
|
||||||
|
.map((e) => e.trim())
|
||||||
|
.toList();
|
||||||
// Only take the first APK for each architecture, ignore others for now, for simplicity
|
// Only take the first APK for each architecture, ignore others for now, for simplicity
|
||||||
// Unclear why there can even be multiple APKs for the same version and arch
|
// Unclear why there can even be multiple APKs for the same version and arch
|
||||||
var apkInfo = e.nextElementSibling?.querySelector('div.info');
|
var apkInfo = e.nextElementSibling?.querySelector('div.info');
|
||||||
@@ -121,14 +120,16 @@ class APKPure extends AppSource {
|
|||||||
DateTime? releaseDate =
|
DateTime? releaseDate =
|
||||||
parseDateTimeMMMddCommayyyy(dateString);
|
parseDateTimeMMMddCommayyyy(dateString);
|
||||||
if (additionalSettings['autoApkFilterByArch'] == true &&
|
if (additionalSettings['autoApkFilterByArch'] == true &&
|
||||||
architecture.isNotEmpty &&
|
architectures.isNotEmpty &&
|
||||||
!supportedArchs.contains(architecture)) {
|
architectures
|
||||||
|
.where((a) => supportedArchs.contains(a))
|
||||||
|
.isEmpty) {
|
||||||
return const MapEntry('', '');
|
return const MapEntry('', '');
|
||||||
}
|
}
|
||||||
topReleaseDate ??=
|
topReleaseDate ??=
|
||||||
releaseDate; // Just use the release date of the first APK in the list as the release date for this version
|
releaseDate; // Just use the release date of the first APK in the list as the release date for this version
|
||||||
return MapEntry(
|
return MapEntry(
|
||||||
'$appId-$versionCode-$architecture.${type.toLowerCase()}',
|
'$appId-$versionCode-$architectureString.${type.toLowerCase()}',
|
||||||
'https://d.${hosts.contains(host) ? 'cdnpure.com' : host}/b/$type/$appId?versionCode=$versionCode');
|
'https://d.${hosts.contains(host) ? 'cdnpure.com' : host}/b/$type/$appId?versionCode=$versionCode');
|
||||||
})
|
})
|
||||||
.where((e) => e.key.isNotEmpty)
|
.where((e) => e.key.isNotEmpty)
|
||||||
|
Reference in New Issue
Block a user