mirror of
https://github.com/ArchiveBox/ArchiveBox
synced 2024-11-21 19:53:06 +00:00
Update export_browser_history.sh
Add tags to export of Firefox bookmarks. Ignore invalid bookmarks such as 'javascript:' or 'place:'
This commit is contained in:
parent
081ba7e81b
commit
aa5533b80f
1 changed files with 18 additions and 1 deletions
|
@ -44,7 +44,24 @@ if [[ "$1" == "--firefox" ]]; then
|
|||
fi
|
||||
|
||||
sqlite3 "$OUTPUT_DIR/firefox_history.db.tmp" "SELECT \"[\" || group_concat(json_object('timestamp', last_visit_date, 'description', title, 'href', url)) || \"]\" FROM moz_places;" > "$OUTPUT_DIR/firefox_history.json"
|
||||
sqlite3 "$OUTPUT_DIR/firefox_history.db.tmp" "SELECT \"[\" || group_concat(json_object('timestamp', b.dateAdded, 'description', b.title, 'href', f.url)) || \"]\" FROM moz_bookmarks AS b JOIN moz_places AS f ON f.id = b.fk" > "$OUTPUT_DIR/firefox_bookmarks.json"
|
||||
|
||||
sqlite3 "$OUTPUT_DIR/firefox_history.db.tmp" "
|
||||
with recursive tags AS (
|
||||
select id, title, '' AS tags
|
||||
FROM moz_bookmarks
|
||||
where parent == 0
|
||||
UNION ALL
|
||||
select c.id, p.title, c.title || ',' || tags AS tags
|
||||
from moz_bookmarks AS c
|
||||
JOIN tags AS p
|
||||
ON c.parent = p.id
|
||||
)
|
||||
|
||||
SELECT '[' || group_concat(json_object('timestamp', b.dateAdded, 'description', b.title, 'href', f.url, 'tags', tags.tags)) || ']'
|
||||
FROM moz_bookmarks AS b
|
||||
JOIN moz_places AS f ON f.id = b.fk
|
||||
JOIN tags ON tags.id = b.parent
|
||||
WHERE f.url LIKE '%://%';" > "$OUTPUT_DIR/firefox_bookmarks.json"
|
||||
|
||||
rm "$OUTPUT_DIR"/firefox_history.db.*
|
||||
echo "Firefox history exported to:"
|
||||
|
|
Loading…
Reference in a new issue