Skip to content

Commit

Permalink
Add dogsheep source for Hacker News
Browse files Browse the repository at this point in the history
Would also consider renaming this to hackernews
  • Loading branch information
telotortium committed Apr 9, 2022
1 parent ba333c7 commit fc6254e
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/promnesia/sources/dogsheep.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
'''
Uses [[https://github.com/karlicoss/HPI][HPI]] dogsheep module
'''

from promnesia.common import Visit, Loc, Results


def index() -> Results:
from . import hpi
from my.hackernews import dogsheep

for item in dogsheep.items():
hn_url = "https://news.ycombinator.com/item?id={item.id}"
title = "hackernews"
if item.title:
title = item.title
elif item.text_html:
title = item.text_html
if len(title) > 79:
title = f"{title[:79]}…"
loc = Loc.make(
title=title, href=(item.url or hn_url))
yield Visit(
url=hn_url,
dt=item.created,
locator=loc,
context=title,
)

0 comments on commit fc6254e

Please sign in to comment.