mirror of
https://github.com/lifegpc/eh_downloader_flutter.git
synced 2026-07-08 01:30:28 +08:00
Update task manager
This commit is contained in:
16
lib/utils/parse_url.dart
Normal file
16
lib/utils/parse_url.dart
Normal file
@@ -0,0 +1,16 @@
|
||||
final _galleryRegex = RegExp(r"(g|mpv)/(\d+)/([^/]+)");
|
||||
|
||||
(int, String)? parseGalleryUrl(String url) {
|
||||
final uri = Uri.tryParse(url);
|
||||
if (uri == null) {
|
||||
return null;
|
||||
}
|
||||
final path = uri.path;
|
||||
final match = _galleryRegex.firstMatch(path);
|
||||
if (match == null) {
|
||||
return null;
|
||||
}
|
||||
final gid = int.parse(match.group(2)!);
|
||||
final token = match.group(3)!;
|
||||
return (gid, token);
|
||||
}
|
||||
Reference in New Issue
Block a user