Analyzing Your Browser History Using Python and Pandas
11–20 of 42 posts
Re: Analyzing Your Browser History Using Python and Pandas
#12 sqlite3 ~/.mozilla/firefox/$YOUR_PROFILE_ID/places.sqlite "SELECT datetime(visit_date/1000000,'unixepoch'),url FROM moz_historyvisits JOIN moz_places ON place_id=moz_places.id ORDER BY visit_date DESC" > hist.txt
(Looks like the timestamp is in UTC here.)----
Does the original post's code perhaps count two visits to the same URL as one? Something like
SELECT datetime(visit_time/1000000-11644473600,'unixepoch'),urls.url
FROM visits JOIN urls ON visits.url=urls.id
ORDER BY visit_time DESC;
might be worth a try.Re: Analyzing Your Browser History Using Python and Pandas
#13 raw_data = [line.split('|', 1) for line in [x.strip() for x in content]]
can be simplified to a single loop: raw_data = [line.strip().split('|', 1) for line in content]
Using str.replace here is also non-idiomatic: plt.title('Top $n Sites Visited'.replace('$n', str(topN)))
How about using str.format instead: plt.title('Top {n} Sites Visited'.format(n=topN))Re: Analyzing Your Browser History Using Python and Pandas
#14I'm learning Python currently and this is the sorta stuff that's neat to see! I haven't had any reason to use pandas yet so it'll be a good excuse. It's a project that's not very long, requires data everyone has and gives a cool insight at the end. Nice!
I haven’t made it very far yet, but so far it seems worth recommending.
Re: Analyzing Your Browser History Using Python and Pandas
#15Re: Analyzing Your Browser History Using Python and Pandas
#16These two loops: raw_data = [line.split('|', 1) for line in [x.strip() for x in content]] can be simplified to a single loop: raw_data = [line.strip().split('|', 1) for line in content] Using str.replace here is also non-idiomatic: plt.title('Top $n Sites Visited'.replace('$n', str(topN))) How about using str.format instead: plt.title('Top {n} Sites Visited'.format(n=topN))
f"Top {topN} Sites Visited"Re: Analyzing Your Browser History Using Python and Pandas
#17Vivaldi does this for me in the history page itself. Pretty weird to use Python just to see a distribution of what sites you visited. Iirc stock chrome also has a way to view this.
Author of the post here. The main purpose of the post was to demonstrate collection and cleaning of data and give an overview of it through a basic visualization. In the future, I'd like to show how this data is a gold mine of information, using it to predict browsing trends, create a profile of interests, and more. Mainly to show why ad tracking/selling of user browser history is bad, but also to teach some data sci…
Re: Analyzing Your Browser History Using Python and Pandas
#18Neat. As a Firefox user, it appears that this does the trick: sqlite3 ~/.mozilla/firefox/$YOUR_PROFILE_ID/places.sqlite "SELECT datetime(visit_date/1000000,'unixepoch'),url FROM moz_historyvisits JOIN moz_places ON place_id=moz_places.id ORDER BY visit_date DESC" > hist.txt (Looks like the timestamp is in UTC here.) ---- Does the original post's code perhaps count two visits to the same URL as one? Something like SEL…
Re: Analyzing Your Browser History Using Python and Pandas
#19Neat. As a Firefox user, it appears that this does the trick: sqlite3 ~/.mozilla/firefox/$YOUR_PROFILE_ID/places.sqlite "SELECT datetime(visit_date/1000000,'unixepoch'),url FROM moz_historyvisits JOIN moz_places ON place_id=moz_places.id ORDER BY visit_date DESC" > hist.txt (Looks like the timestamp is in UTC here.) ---- Does the original post's code perhaps count two visits to the same URL as one? Something like SEL…
Re: Analyzing Your Browser History Using Python and Pandas
#20 pd.read_csv('hist.txt', sep='|', header=None)