browser: parse browser history using browserexport (#216)
* browser: parse browser history using browserexport
from seanbreckenridge/HPI module:
1fba8ccf2f/my/browser/export.py
This commit is contained in:
parent
059c4ae791
commit
9e5cd60ff2
7 changed files with 198 additions and 24 deletions
35
my/browser/all.py
Normal file
35
my/browser/all.py
Normal file
|
@ -0,0 +1,35 @@
|
|||
from typing import Iterator
|
||||
|
||||
from my.core import Stats
|
||||
from my.core.source import import_source
|
||||
from browserexport.merge import merge_visits, Visit
|
||||
|
||||
|
||||
src_export = import_source(module_name="my.browser.export")
|
||||
src_active = import_source(module_name="my.browser.active_browser")
|
||||
|
||||
|
||||
@src_export
|
||||
def _visits_export() -> Iterator[Visit]:
|
||||
from . import export
|
||||
return export.history()
|
||||
|
||||
|
||||
@src_active
|
||||
def _visits_active() -> Iterator[Visit]:
|
||||
from . import active_browser
|
||||
return active_browser.history()
|
||||
|
||||
|
||||
# NOTE: you can comment out the sources you don't need
|
||||
def history() -> Iterator[Visit]:
|
||||
yield from merge_visits([
|
||||
_visits_active(),
|
||||
_visits_export(),
|
||||
])
|
||||
|
||||
|
||||
def stats() -> Stats:
|
||||
from my.core import stat
|
||||
|
||||
return {**stat(history)}
|
Loading…
Add table
Add a link
Reference in a new issue