render talk feed as %api speeches

This commit is contained in:
Anton Dyudin 2016-03-31 16:15:10 -07:00
parent 6ff26fc0b6
commit 8844933178
3 changed files with 34 additions and 7 deletions

View File

@ -47,6 +47,11 @@
?. =(u p.i.b) ~|(mismatch+[u p.i.b] !!)
[q.i.b $(a t.a, b t.b)]
::
++ interpolate-url :: XX friendlier url format #717
|= {a/tape b/(list (pair term knot))} ^- purl
=+ url=`purl`(scan a auri:epur)
url(q.q (interpolate-path q.q.url b))
::
++ valve :: produce request
|= {med/?($get $post) pax/path quy/quay}
^- hiss
@ -74,10 +79,20 @@
::
|%
++ render :: response printers
=+ args:reqs
|%
++ mean
|= {msg/@t num/@ud} ^- tank
rose+[": " `~]^~[leaf+"Error {<num>}" leaf+(trip msg)]
::
++ user-url
|= a/scr ^- purl
(interpolate-url "https://twitter.com/:scr" scr+a ~)
::
++ post-url
|= {a/scr b/tid} ^- purl
%+ interpolate-url "https://twitter.com/:scr/status/:tid"
~[scr+a tid+(tid:print b)]
--
++ parse :: json reparsers
|%

View File

@ -3,7 +3,7 @@
:::: /hoon/cred/twit/mar
::
/- plan-acct
/+ httr-to-json
/+ httr-to-json, twitter
|_ {acc/plan-acct raw/json}
++ grab
|%
@ -12,12 +12,11 @@
++ json
|= jon/^json ^- {plan-acct ^json}
=+ usr=(need ((ot 'screen_name'^so ~):jo jon))
=+ url=(scan "https://twitter.com/FIXME" aurf:epur)
=. q.q.p.url /[usr] :: XX friendlier url format #717
[[usr (some url)] jon]
=+ url=(user-url:render:twitter usr)
[[usr (some [url ~])] jon]
--
++ grow
|%
++ tank >[+<]<
++ tank >[+<.+]<
--
--

View File

@ -2,8 +2,9 @@
::
:::: /hoon/feed/twit/mar
::
/- talk
/+ twitter, httr-to-json
|_ (list post:twitter)
|_ fed/(list post:twitter)
++ grab
|%
++ noun (list post:twitter)
@ -12,6 +13,18 @@
--
++ grow
|%
++ tank >[+<]<
++ tank >[fed]<
++ talk-speeches
=+ r=render:twitter
%+ turn fed
|= a/post:twitter ^- speech:talk
:* %api %twitter
who.a
(user-url.r who.a)
txt.a
txt.a
(post-url.r who.a id.a)
(joba now+(jode now.a))
==
--
--