Spaces:
Running
Running
Fix Google Drive direct video downloads
Browse files305 unmodified lines3063073083093103119 unmodified lines321322323324325326327248 unmodified lines576577578579580581582305 unmodified linesreturn next(group for group in match.groups() if group)def drive_file_name(content_disposition, file_id):message = Message()if content_disposition:9 unmodified linesasync def download_drive_file(link, destination):file_id = drive_file_id(link)url = f"https://drive.google.com/uc?export=download&confirm=t&id={file_id}"total = 0async with httpx.AsyncClient(follow_redirects=True, timeout=300) as client:async with client.stream("GET", url) as response:248 unmodified linesresult = {"link": str(link)}try:file_id = drive_file_id(str(link))with httpx.stream("GET", f"https://drive.google.com/uc?export=download&confirm=t&id={file_id}", follow_redirects=True, timeout=30) as response:content_type = response.headers.get("content-type", "")content_disposition = response.headers.get("content-disposition", "")size = int(response.headers.get("content-length", "0") or 0)305 unmodified lines3063073083093103113123133143159 unmodified lines325326327328329330331248 unmodified lines580581582583584585586305 unmodified linesreturn next(group for group in match.groups() if group)def drive_download_url(file_id):return f"https://drive.usercontent.google.com/download?id={file_id}&export=download&confirm=t"def drive_file_name(content_disposition, file_id):message = Message()if content_disposition:9 unmodified linesasync def download_drive_file(link, destination):file_id = drive_file_id(link)url = drive_download_url(file_id)total = 0async with httpx.AsyncClient(follow_redirects=True, timeout=300) as client:async with client.stream("GET", url) as response:248 unmodified linesresult = {"link": str(link)}try:file_id = drive_file_id(str(link))with httpx.stream("GET", drive_download_url(file_id), follow_redirects=True, timeout=30) as response:content_type = response.headers.get("content-type", "")content_disposition = response.headers.get("content-disposition", "")size = int(response.headers.get("content-length", "0") or 0)
app.py+6-2