2017-10-27 5 views
1

현재 아래 스크립트를 사용하여 Google 드라이브에서 일반 파일을 가져옵니다. 그것은 잘 작동하고 기본적으로 사용자 @ user115202 명성의 코드입니다.Google 드라이브에서 Whatsapp 백업 파일 받기

이제 정상적인 파일이 아닌 GoogleDrive의 "백업"아래에 저장된 Whatsapp Backups에서 작동해야합니다.

도구 WhatsApp Google 드라이브 추출기 (Google 드라이브 API)가 더 이상 작동하지 않는 것 같습니다.

다른 사람을 알고 있습니까?

import requests 

def download_file_from_google_drive(id, destination): 
    def get_confirm_token(response): 
     for key, value in response.cookies.items(): 
      if key.startswith('download_warning'): 
       return value 

     return None 

    def save_response_content(response, destination): 
     CHUNK_SIZE = 32768 

     with open(destination, "wb") as f: 
      for chunk in response.iter_content(CHUNK_SIZE): 
       if chunk: # filter out keep-alive new chunks 
        f.write(chunk) 

    URL = "https://docs.google.com/uc?export=download" 

    session = requests.Session() 

    response = session.get(URL, params = { 'id' : id }, stream = True) 
    token = get_confirm_token(response) 

    if token: 
     params = { 'id' : id, 'confirm' : token } 
     response = session.get(URL, params = params, stream = True) 

    save_response_content(response, destination)  


if __name__ == "__main__": 
    import sys 
    if len(sys.argv) is not 3: 
     print "Usage: python google_drive.py drive_file_id destination_file_path" 
    else: 
     # TAKE ID FROM SHAREABLE LINK 
     file_id = sys.argv[1] 
     # DESTINATION FILE ON YOUR DISK 
     destination = sys.argv[2] 
     download_file_from_google_drive(file_id, destination) 
+0

에서 사용할 수 있습니다. API를 해결하고 코드를 일부 변경했으며 현재 작동합니다. 코드는 https://github.com/EliteAndroidApps/WhatsApp-GD-Extractor/에서 사용할 수 있습니다. – Lango

답변