fabianonline / telegram_backup

Java app to download all your telegram data.
GNU General Public License v3.0
447 stars 91 forks source link

Downloading media fails with 403 on geo message #92

Closed wesleym closed 6 years ago

wesleym commented 6 years ago

My Telegram backup fails without any option to skip forward when it reaches what I assume is a message where I shared my location.

$ java -jar telegram_backup.jar --account +14154846749
Telegram_Backup version 1.1.0, Copyright (C) 2016, 2017 Fabian Schlenz

Telegram_Backup comes with ABSOLUTELY NO WARRANTY. This is free software, and you are
welcome to redistribute it under certain conditions; run it with '--license' for details.

Base directory for files: /Users/wesley/.telegram_backup
Opening database...
Database version: 8
Database is ready.
You are logged in as [my real name] ([my user name])
Downloading most recent dialogs... 
Top message ID is 704385
Top message ID in database is 704385
No new messages to download.
Checking message database for completeness...
Checking and downloading media.
Legend:
'V' - Video         'P' - Photo         'D' - Document
'S' - Sticker       'A' - Audio         'G' - Geolocation
'.' - Previously downloaded file        'e' - Empty file
' ' - Ignored media type (weblinks or contacts, for example)
'x' - File skipped because of timeout errors
113571 Files to check / download
................  ........ ........ .....   ..  ..................... ............ .. .............. - 100/113571
...... ............ .  . ..... .. ..  java.io.IOException: Server returned HTTP response code: 403 for URL: https://maps.googleapis.com/maps/api/staticmap?center=37.78185667495461,-122.44776659007384&zoom=14&size=300x150&scale=2&format=png&key=AIzaSyBEtUDhCQKEH6i2Mn1GAiQ9M_tLN0vxHIs
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1839)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1440)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
    at org.apache.commons.io.FileUtils.copyURLToFile(FileUtils.java:1489)
    at de.fabianonline.telegram_backup.DownloadManager.downloadExternalFile(DownloadManager.java:468)
    at de.fabianonline.telegram_backup.mediafilemanager.GeoFileManager.download(GeoFileManager.java:76)
    at de.fabianonline.telegram_backup.DownloadManager._downloadMedia(DownloadManager.java:341)
    at de.fabianonline.telegram_backup.DownloadManager.downloadMedia(DownloadManager.java:294)
    at de.fabianonline.telegram_backup.CommandLineController.<init>(CommandLineController.java:151)
    at de.fabianonline.telegram_backup.CommandLineRunner.main(CommandLineRunner.java:41)

----- EXIT -----

When I visit the URL manually, I see a message directing me to g.co/staticmaperror/billing: https://maps.googleapis.com/maps/api/staticmap?center=37.78185667495461,-122.44776659007384&zoom=14&size=300x150&scale=2&format=png&key=AIzaSyBEtUDhCQKEH6i2Mn1GAiQ9M_tLN0vxHIs

Replacing the Google API key in Config.kt with one I provisioned myself allows downloading to continue.

--snip--
................  ........ ........ .....   ..  ..................... ............ .. .............. - 100/115031
...... ............ .  . ..... .. ..  G . P...PPSPPP PS..S PSSSS.PSSSD....P.PPSSSSSSSSS.SPPPPSSSSS.S - 200/115031
--snip--

There should be a way to skip failing geo posts so backup can continue, or maybe there should be instructions and a simple way to provision your own key and set it without checking out the source and building it.

Terrydaktal commented 6 years ago

Fabian is aware of this issue and it has been fixed in the new update, join the telegram group to find the new .jar file, alternatively, rename dud .pngs to the names of the geo files in the database.

arthurkazaryants commented 6 years ago

Found temporary solution: I tried to start with --trace-telegram flag and it goes well! Then after several minutes I break execution and start without flags. It works!)

fabianonline commented 6 years ago

I'm pretty sure that's just a conincidence... Anyway, version 1.1.1 is out and contains a new API key. It may take up to 24 hours, but then the Location download feature should be working reliably again.