get static method
Implementation
static Future<List<DGDirectLinkModel>> get(String url) async {
final List<DGDirectLinkModel> links = [];
final Completer<List<DGDirectLinkModel>> c =
Completer<List<DGDirectLinkModel>>();
String rUrl = url;
url = rUrl
.replaceAll('/file/d/', '/u/1/uc?id=')
.replaceAll('/view?usp=share_link', '&export=download')
.replaceAll('/view', '&export=download');
DGHubWebScrapper.getFromWebView(
url,
onDownloadStart: (controller, downloadStartRequest) {
links.add(DGDirectLinkModel(
quality: 'Normal', link: downloadStartRequest.url.toString()));
if (kDebugMode) {
print('GoogleDriveDirectLink: ${downloadStartRequest.url}');
}
c.complete(links);
},
onLoaded: (controller, gurl) async {
await controller.evaluateJavascript(
source: '''document.querySelector('#uc-download-link').click()''');
},
).then((value) {}).onError((error, stackTrace) {
// print(error.toString());
// print(stackTrace.toString());
});
return c.future;
}