Skip to content

Commit

Permalink
sources.browser_new: initial work on using HPI + seanbreckenridge/bro…
Browse files Browse the repository at this point in the history
…wserexport

later will rename to browser, and implement defensive fallback onto browser_old

adapted from https://github.com/seanbreckenridge/promnesia/blob/master/promnesia_sean/sources/browsing.py

related: #339

Old vs new modules produce almost identical results (tested on various chrome & firefox databases)
There are some minor differences vs the old module:

- old database timestamps end with +00:00 UTC, new ones with +00:00 -- likely because browserexport is using timezone.utc instead of pytz
- previously locator was pointing at the database file, now it's pointing at the URL

  I guess it's not necessarily in the 'spirit' of locator field, but on the other hand, not that it's very useful to point to an sqlite file either.
  Perhaps later it could be in some sort of extra debug field instead.
  • Loading branch information
karlicoss committed Feb 5, 2023
1 parent c1c65d8 commit ef803be
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/promnesia/sources/browser_new.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from typing import Optional

from promnesia.common import Results, Visit, Loc, Second


def index() -> Results:
from . import hpi
from my.browser.all import history

for v in history():
desc: Optional[str] = None
duration: Optional[Second] = None
metadata = v.metadata
if metadata is not None:
desc = metadata.title
duration = metadata.duration
yield Visit(
url=v.url,
dt=v.dt,
locator=Loc(title=desc or v.url, href=v.url),
duration=duration,
)

0 comments on commit ef803be

Please sign in to comment.