/- spider, jon=twatter-json /+ strandio, sr=sortug, w2=web2, lib=twatter =, strand=strand:spider =, dejs-soft:format =, strand-fail=strand-fail:libstrand:spider =< run |% ++ get-body |= res=client-response:iris ^- @t ?. ?=(%finished -.res) '' ?~ full-file.res '' q.data.u.full-file.res ++ coki-to-string |= t=twatter-creds:w2 ^- cord =/ at (trip auth-token.t) =/ ct0 (trip ct0.t) =/ kdt (trip kdt.t) =/ twid (trip twid.t) %- crip "auth_token={at};ct0={ct0};kdt={kdt};twid={twid};" :: ++ run ^- thread:spider |= arg=vase ~& > arg=arg =/ m (strand vase) ^- form:m =/ coki muh:w2 =/ csrf ct0.coki =/ coki-string (coki-to-string coki) =/ headers (logged-headers:lib coki-string csrf) |^ :: =/ req !<(twatter-action:w2 arg) =/ req=twatter-action:w2 [%user 'spandrell4'] ?+ -.req (pure:m !>(%bad)) %user (fetch-tw-user +.req) == ++ fetch-tw-user |= username=@t =/ vars (build-variables:lib ~[['screen_name' %s username]]) =/ url %- crip (weld (burl:lib user-by-name:urls:lib) "?variables={vars}&features={features:lib}") =/ req1 [%'GET' url headers ~] ;< ~ bind:m (send-request:strandio req1) ;< res1=client-response:iris bind:m take-client-response:strandio =/ body1=@t (get-body res1) :: ~& >> body1 =/ j (de:json:html body1) ?~ j (pure:m !>(%bad-js)) =/ dejs (username:jon u.j) ?~ dejs (pure:m !>(%bad-js)) =/ user-id=@t u.dejs =/ url2 %- crip (weld (burl:lib user-tweets:urls:lib) (userid-params:lib user-id)) =/ req2 [%'GET' url2 headers ~] ;< ~ bind:m (send-request:strandio req2) ;< res2=client-response:iris bind:m take-client-response:strandio =/ body2 (get-body res2) =/ jon (de:json:html body2) ?~ jon (pure:m !>(%bad-json)) (pure:m !>(u.jon)) -- --