Added google drive downloader (#359)

This commit is contained in:
Nikhil Badyal
2023-08-31 11:46:23 +05:30
committed by GitHub
parent e2983d5b39
commit 6c0da4e45b
7 changed files with 48 additions and 4 deletions
+31
View File
@@ -0,0 +1,31 @@
"""Google Drive downloader Class."""
from typing import Any, Self, Tuple
import gdown
from src.app import APP
from src.downloader.download import Downloader
class GoogleDrive(Downloader):
"""Google Driver downloader."""
def specific_version(self: Self, app: APP, version: str) -> Tuple[str, str]:
"""Function to download the specified version of app from apkmirror.
:param app: Name of the application
:param version: Version of the application to download
:return: Version of downloaded apk
"""
return self.latest_version(app)
def latest_version(self: Self, app: APP, **kwargs: Any) -> Tuple[str, str]:
"""Function to download whatever the latest version of app from Google Driver.
:param app: Name of the application
:return: Version of downloaded apk
"""
url = app.download_source
file_name = f"{self.config.temp_folder_name}/{app.app_name}.apk"
_, download_url = gdown.download(url, quiet=False, use_cookies=False, output=file_name)
return file_name, download_url