Skip to content

Commit a4e1788

Browse files
authored
docs: add a quickstart for using the browser source (#378)
* docs: add a quickstart for using the browser source
1 parent 443a60f commit a4e1788

File tree

1 file changed

+52
-1
lines changed

1 file changed

+52
-1
lines changed

doc/SOURCES.org

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
This file is an overview of available sources along with descriptions and some guidance.
22

3+
See [[#instructions][instructions]] below for additional information.
4+
35
* Extra dependencies
46
Some sources require additional dependencies, which you can install if needed.
57

@@ -181,7 +183,56 @@ for f in sorted((src / 'promnesia/sources').rglob('*.py')):
181183

182184
:end:
183185

184-
186+
* Instructions
187+
** browser
188+
189+
The browser source here uses [[https://github.com/karlicoss/HPI][HPI]], which uses
190+
[[https://github.com/seanbreckenridge/browserexport][browserexport]] to
191+
save/parse browser history. Since browsers remove old history after your
192+
history database has grown to a certain size, this saves the raw database files to
193+
a directory you specify. =browserexport= supports many browsers, including any
194+
Chromium/Firefox based browsers (e.g. Brave, Vivaldi, Waterfox). For more
195+
instructions on backing up databases, see
196+
[[https://github.com/seanbreckenridge/browserexport#usage][here]], but as
197+
a quickstart, after setting up =HPI=, run:
198+
#+BEGIN_SRC sh
199+
hpi module install my.browser.export
200+
#+END_SRC
201+
202+
Then, to save your browser history, run a command like:
203+
#+BEGIN_SRC sh
204+
browserexport save -b firefox --to ~/data/browser_history
205+
browserexport save -b chrome --to ~/data/browser_history
206+
browserexport save -b safari --to ~/data/browser_history
207+
#+END_SRC
208+
209+
This will save your browser history to a directory, which you can then point
210+
HPI at, in your
211+
[[https://github.com/karlicoss/HPI/blob/master/doc/MODULES.org#mybrowser][HPI
212+
config]]:
213+
#+BEGIN_SRC python
214+
class browser:
215+
class export:
216+
# path[s]/glob to your backed up browser history sqlite files
217+
export_path: Paths = "~/data/browsing/*.sqlite"
218+
219+
class active_browser:
220+
# paths to sqlite database files which you use actively
221+
# to read from. For example:
222+
# from browserexport.browsers.all import Firefox
223+
# export_path = Firefox.locate_database()
224+
export_path: Paths
225+
#+END_SRC
226+
227+
Finally, you can add the browser source to =promnesia=, in your =config.py=:
228+
#+BEGIN_SRC python
229+
from promnesia.sources import browser
230+
231+
SOURCES = [
232+
browser,
233+
...
234+
]
235+
#+END_SRC
185236
* Extending
186237
Adding your own data sources is very easy!
187238
One day I'll add some proper documentation, but the easiest at the moment is to use existing simple modules as a reference, for example:

0 commit comments

Comments
 (0)