mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-11-04 23:33:29 +01:00
Multi-host support + add '.net' host to APKPure source (#1250)
This commit is contained in:
@@ -5,18 +5,18 @@ import 'package:obtainium/providers/source_provider.dart';
|
||||
|
||||
class NeutronCode extends AppSource {
|
||||
NeutronCode() {
|
||||
host = 'neutroncode.com';
|
||||
hosts = ['neutroncode.com'];
|
||||
}
|
||||
|
||||
@override
|
||||
String sourceSpecificStandardizeURL(String url) {
|
||||
RegExp standardUrlRegEx =
|
||||
RegExp('^https?://(www\\.)?$host/downloads/file/[^/]+');
|
||||
RegExp standardUrlRegEx = RegExp(
|
||||
'^https?://(www\\.)?${getSourceRegex(hosts)}/downloads/file/[^/]+');
|
||||
RegExpMatch? match = standardUrlRegEx.firstMatch(url.toLowerCase());
|
||||
if (match == null) {
|
||||
throw InvalidURLError(name);
|
||||
}
|
||||
return url.substring(0, match.end);
|
||||
return match.group(0)!;
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -92,7 +92,7 @@ class NeutronCode extends AppSource {
|
||||
if (version == null) {
|
||||
throw NoVersionError();
|
||||
}
|
||||
String? apkUrl = 'https://$host/download/$filename';
|
||||
String? apkUrl = 'https://${hosts[0]}/download/$filename';
|
||||
var dateStringOriginal =
|
||||
http.querySelector('.pd-date-txt')?.nextElementSibling?.innerHtml;
|
||||
var dateString = dateStringOriginal != null
|
||||
|
||||
Reference in New Issue
Block a user