-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathmoz_places.py
39 lines (35 loc) · 1.04 KB
/
moz_places.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Mozilla places.sqlite to HTML
# (C) 2014 Adam Ziaja <[email protected]> http://adamziaja.com
import sqlite3
conn = sqlite3.connect('places.sqlite')
c = conn.cursor()
print '''<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<style type="text/css">
* {
font-family: Verdana, Geneva, sans-serif;
font-size: 12px;
}
</style>
</head>
<body>
<table cellpadding="5" cellspacing="0" border="1">
<tr><th>title</th><th>url</th><th>last_visit_date</th><tr>'''
for row in c.execute('SELECT title, url, datetime(last_visit_date/1000000,"unixepoch","localtime") FROM moz_places ORDER BY id DESC'):
title = row[0]
url = row[1]
datetime = row[2]
if title is None:
title = ''
if datetime is None:
datetime = ''
print ('<tr><td>' + title + '</td><td><a href="' + url
+ '" target="_blank" rel="noreferrer">' + url
+ '</a></td><td>' + datetime + '</td></tr>').encode('utf-8').strip()
print '''</table>
</body>
</html>'''