I was using Firefox and for some reason it deleted all downloads from the SD card.
I found an in-built app "Downloads" which has a list of all files downloaded to date, listing both Chrome and Firefox downloads.
Click Image to enlarge
How can I export a list of filenames (and their respective URLs, if possible) shown in this "Downloads" app?
Answer
The Downloads app has the name DownloadsProviderUI (com.android.providers.downloads.ui
). The entries shown by it are not handled by or stored inside its data directory. Instead, the app is just a front-end for DownloadsProvider (com.android.providers.downloads
).
The information you're seeking is stored inside
/data/data/com.android.providers.downloads/databases/downloads.db
Provided that your OEM has not messed up with the manifest of DownloadProvider, you should be able to backup the app using adb.
- Setup adb in PC and connect the device, with USB debugging enabled, into PC.
Launch a shell and execute the command
adb backup com.android.providers.downloads
Agree for the backup on the device. You should now be having a backup file named
backup.ab
.Follow any of the solution here to extract the content from the file. (I prefer Android Backup Extractor.)
You should now be having a file named
downloads.db
, possibly underapps/com.android.providers.downloads/db/
(inside the extracted content).You now have many options to open the database file. You can use GUI solutions like Sqliteman or DB Browser for SQLite. The former one can export the data into an HTML file.
Anyhow, inside the file, the table
downloads
has the relevant columns, namely:uri
,title
and_data
.If you've sqlite3 installed, you can do:
sqlite3 downloads.db
.mode line
.headers on
.out info.txt
select uri,title,_data from downloads
.quitYou should now be having a file
info.txt
. Open it and you would see a structure, such as:
uri = http://dl-xda.xposed.info/modules/biz.bokhorst.xprivacy_v471_8ba0b6.apk
title = XPrivacy
_data = /data/data/com.android.providers.downloads/cache/biz.bokhorst.xprivacy_v471_8ba0b6.apk
uri = non-dwnldmngr-download-dont-retry2download
title = ProcessMonitor.zip
_data = /storage/sdcard0/Download/ProcessMonitor.zipThere exists other modes for formatting. For e.g., change
.mode
tocsv
and.out
tofile.csv
and then keep the rest of the commands intact. Execute all the commands serially and you would end up with a CSV file.(You can use
PRAGMA table_info('downloads')
or.schema downloads
to know the name of all the columns inside the tabledownloads
.)If required, see this article on ZetCode to know what the aforesaid SQL commands does.
No comments:
Post a Comment