mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-08-27 16:39:30 +02:00
Added release date support to APKMirror
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:html/parser.dart';
|
import 'package:html/parser.dart';
|
||||||
import 'package:http/http.dart';
|
import 'package:http/http.dart';
|
||||||
import 'package:obtainium/custom_errors.dart';
|
import 'package:obtainium/custom_errors.dart';
|
||||||
@@ -30,10 +32,16 @@ class APKMirror extends AppSource {
|
|||||||
) async {
|
) async {
|
||||||
Response res = await get(Uri.parse('$standardUrl/feed'));
|
Response res = await get(Uri.parse('$standardUrl/feed'));
|
||||||
if (res.statusCode == 200) {
|
if (res.statusCode == 200) {
|
||||||
String? titleString = parse(res.body)
|
var item = parse(res.body).querySelector('item');
|
||||||
.querySelector('item')
|
String? titleString = item?.querySelector('title')?.innerHtml;
|
||||||
?.querySelector('title')
|
String? dateString = item
|
||||||
?.innerHtml;
|
?.querySelector('pubDate')
|
||||||
|
?.innerHtml
|
||||||
|
.split(' ')
|
||||||
|
.sublist(0, 5)
|
||||||
|
.join(' ');
|
||||||
|
DateTime? releaseDate =
|
||||||
|
dateString != null ? HttpDate.parse('$dateString GMT') : null;
|
||||||
String? version = titleString
|
String? version = titleString
|
||||||
?.substring(RegExp('[0-9]').firstMatch(titleString)?.start ?? 0,
|
?.substring(RegExp('[0-9]').firstMatch(titleString)?.start ?? 0,
|
||||||
RegExp(' by ').firstMatch(titleString)?.start ?? 0)
|
RegExp(' by ').firstMatch(titleString)?.start ?? 0)
|
||||||
@@ -44,7 +52,8 @@ class APKMirror extends AppSource {
|
|||||||
if (version == null || version.isEmpty) {
|
if (version == null || version.isEmpty) {
|
||||||
throw NoVersionError();
|
throw NoVersionError();
|
||||||
}
|
}
|
||||||
return APKDetails(version, [], getAppNames(standardUrl));
|
return APKDetails(version, [], getAppNames(standardUrl),
|
||||||
|
releaseDate: releaseDate);
|
||||||
} else {
|
} else {
|
||||||
throw getObtainiumHttpError(res);
|
throw getObtainiumHttpError(res);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user