-
Notifications
You must be signed in to change notification settings - Fork 72
/
instapaper.py
32 lines (28 loc) · 969 Bytes
/
instapaper.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
'''
Uses HPI [[https://github.com/karlicoss/HPI/blob/master/doc/MODULES.org#myinstapaper][instapaper]] module
'''
from ..common import Results, logger, Visit, Loc
def index() -> Results:
from . import hpi
import my.instapaper as ip
for p in ip.pages():
bm = p.bookmark
hls = p.highlights
if len(hls) == 0:
yield Visit(
url=bm.url,
dt=bm.dt,
context=None,
locator=Loc.make(title='instapaper', href=bm.instapaper_link),
)
else:
for hl in p.highlights:
cparts = [hl.text]
if hl.note is not None:
cparts.append('comment: ' + hl.note)
yield Visit(
url=bm.url,
dt=hl.dt,
context='\n'.join(cparts),
locator=Loc.make(title='instapaper', href=hl.instapaper_link),
)