Skip to content

Commit

Permalink
Merge pull request #1774 from ImranR98/dev
Browse files Browse the repository at this point in the history
- Fix bug introduced in v1.1.16: APKPure fails to find universal APKs
- Fix bugs found in APKPure URL matching
  • Loading branch information
ImranR98 authored Aug 6, 2024
2 parents 25bd61f + 25d19d2 commit f00758c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ Currently supported App sources:
- [APKPure](https://apkpure.net/)
- [Aptoide](https://aptoide.com/)
- [Uptodown](https://uptodown.com/)
- [APKMirror](https://apkmirror.com/) (Track-Only)
- [Huawei AppGallery](https://appgallery.huawei.com/)
- Jenkins Jobs
- [APKMirror](https://apkmirror.com/) (Track-Only)
- Open Source - App-Specific:
- [Signal](https://signal.org/)
- [VLC](https://videolan.org/)
Expand Down
14 changes: 10 additions & 4 deletions lib/app_sources/apkpure.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,15 @@ class APKPure extends AppSource {
@override
String sourceSpecificStandardizeURL(String url) {
RegExp standardUrlRegExB = RegExp(
'^https?://m.${getSourceRegex(hosts)}/+[^/]+/+[^/]+(/+[^/]+)?',
'^https?://m.${getSourceRegex(hosts)}(/+[^/]{2})?/+[^/]+/+[^/]+',
caseSensitive: false);
RegExpMatch? match = standardUrlRegExB.firstMatch(url);
if (match != null) {
url = 'https://${getSourceRegex(hosts)}${Uri.parse(url).path}';
var uri = Uri.parse(url);
url = 'https://${uri.host.substring(2)}${uri.path}';
}
RegExp standardUrlRegExA = RegExp(
'^https?://(www\\.)?${getSourceRegex(hosts)}/+[^/]+/+[^/]+(/+[^/]+)?',
'^https?://(www\\.)?${getSourceRegex(hosts)}(/+[^/]{2})?/+[^/]+/+[^/]+',
caseSensitive: false);
match = standardUrlRegExA.firstMatch(url);
if (match == null) {
Expand Down Expand Up @@ -93,7 +94,11 @@ class APKPure extends AppSource {
var apkUrls = apksDiv
?.querySelectorAll('div.group-title')
.map((e) {
String? architecture = e.text.trim();
String architecture = e.text.trim();
if (architecture.toLowerCase() == 'unlimited' ||
architecture.toLowerCase() == 'universal') {
architecture = '';
}
// 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
var apkInfo = e.nextElementSibling?.querySelector('div.info');
Expand All @@ -116,6 +121,7 @@ class APKPure extends AppSource {
DateTime? releaseDate =
parseDateTimeMMMddCommayyyy(dateString);
if (additionalSettings['autoApkFilterByArch'] == true &&
architecture.isNotEmpty &&
!supportedArchs.contains(architecture)) {
return const MapEntry('', '');
}
Expand Down
2 changes: 1 addition & 1 deletion lib/providers/source_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -763,9 +763,9 @@ class SourceProvider {
APKPure(),
Aptoide(),
Uptodown(),
APKMirror(),
HuaweiAppGallery(),
Jenkins(),
APKMirror(),
Signal(),
VLC(),
WhatsApp(),
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.1.16+2273
version: 1.1.17+2274

environment:
sdk: '>=3.0.0 <4.0.0'
Expand Down

0 comments on commit f00758c

Please sign in to comment.