Page MenuHomePhabricator

how to extract the reading history from the Wikipedia Android App?
Closed, DeclinedPublic

Description

Hello Devs!

The Wikipedia Android App is great. I've used it to read hundreds of articles.

Now, I would like to extract my reading history on the app, all the articles that I've read using it.

When I read Wikipedia in my browser (Firefox), that's easy, I simply query the places.sqlite file. But how to do this with the app?

How to extract the reading history from the Wikipedia Android App?

Thanks! --Martin

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJul 16 2019, 9:19 AM
Charlotte removed the point value for this task.

Thanks for the question @martin.monperrus - and we're very glad you like the app. There is not a way to export your reading history from the app. We store the tabs you currently have open (up to 99), but we don't store the full history of everything you've read, or enable exporting the tab names to a list.

Charlotte closed this task as Declined.Jul 16 2019, 4:28 PM

Hi Charlotte,

Thanks a lot for your answer. The history is stored somewhere since I can see it in the "History"
view of the app.

Maybe I can parse it on my own.

In which file is it stored on the device?

Dbrant added a subscriber: Dbrant.Jul 17 2019, 1:40 PM

Your browsing history, along with most of the other app data, is stored in this database file:

/data/data/org.wikipedia/databases/wikipedia.db

Have fun!

Thanks! I guess it's sqlite? is the schema documented somewhere?

I guess it's sqlite?

Yes.

is the schema documented somewhere?

No. If you browse the database contents, it should be self-explanatory.

perfect, I have everything to make a proof-of-concept extraction :-)

Thanks a lot!

Works as a charm as follows

  1. download the wikipedia app data (credit)

adb backup -noapk org.wikipedia (this creates a local file backup.ab)

  1. extract the backup file (credit)

( printf "\x1f\x8b\x08\x00\x00\x00\x00\x00" ; tail -c +25 backup.ab ) | tar xfvz -

  1. extract the history table as CSV file (credit)
sqlite3 apps/org.wikipedia/db/wikipedia.db
  sqlite> .mode csv
  sqlite> .output history.csv
  sqlite> select * from history;
  1. browse the output
cat history.csv
1,fr.wikipedia.org,"Bataille_d'Azincourt",1545756348148,1,,fr,738
...
5,fr.wikipedia.org,Empire_romain,1546553764638,4,,fr,1398
...
11,en.wikipedia.org,Great_Belt_Bridge_rail_accident,1546552199914,16,,en,80