mirror of
https://github.com/Zetaphor/browser-recall.git
synced 2025-12-06 10:29:38 +00:00
Initial commit
This commit is contained in:
18
app/browser.py
Normal file
18
app/browser.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from datetime import datetime
|
||||
from typing import List, Tuple
|
||||
from browser_history import get_history, get_bookmarks
|
||||
from urllib.parse import urlparse
|
||||
|
||||
class BrowserHistoryCollector:
|
||||
@staticmethod
|
||||
def get_domain(url: str) -> str:
|
||||
return urlparse(url).netloc
|
||||
|
||||
def fetch_history(self) -> List[Tuple[datetime, str, str]]:
|
||||
outputs = get_history()
|
||||
# Returns list of tuples containing (datetime, url, title)
|
||||
return [(entry[0], entry[1], entry[2]) for entry in outputs.histories]
|
||||
|
||||
def fetch_bookmarks(self) -> List[Tuple[datetime, str, str, str]]:
|
||||
outputs = get_bookmarks()
|
||||
return outputs.bookmarks
|
||||
Reference in New Issue
Block a user