From 315108e7d1c8b3177e3aee296a83f28a9895ef77 Mon Sep 17 00:00:00 2001 From: jaskaranSM Date: Tue, 5 May 2020 10:51:55 +0530 Subject: [PATCH] patch regex for more links --- bot/helper/mirror_utils/upload_utils/gdriveTools.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bot/helper/mirror_utils/upload_utils/gdriveTools.py b/bot/helper/mirror_utils/upload_utils/gdriveTools.py index 9d74da8..480ddc3 100644 --- a/bot/helper/mirror_utils/upload_utils/gdriveTools.py +++ b/bot/helper/mirror_utils/upload_utils/gdriveTools.py @@ -68,11 +68,11 @@ class GoogleDriveHelper: @staticmethod def getIdFromUrl(link: str): if "folders" in link or "file" in link: - regex = r"https://drive\.google\.com/(drive)?/?u?/\d?/?mobile?/?(file)?(folders)?/?d?/([-\w]+)[?+]?/?(w+)?" + regex = r"https://drive\.google\.com/(drive)?/?u?/?\d?/?(mobile)?/?(file)?(folders)?/?d?/([-\w]+)[?+]?/?(w+)?" res = re.search(regex,link) if res is None: raise IndexError("GDrive ID not found.") - return res.group(4) + return res.group(5) parsed = urlparse.urlparse(link) return parse_qs(parsed.query)['id'][0]