Skip to content

Instantly share code, notes, and snippets.

@iratqq
Created November 2, 2008 01:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iratqq/21612 to your computer and use it in GitHub Desktop.
Save iratqq/21612 to your computer and use it in GitHub Desktop.
(* ocamlfind ocamlc -linkpkg -package "json-static json-wheel netclient" -o wassr_get wassr_get.ml *)
open Json_type
open Http_client.Convenience
type json wassr_json =
<
favorites: string array;
?user_login_id: string;
?areacode: string = "";
?photo_thumbnail_url: string = "";
?html: string = "";
text: string;
?reply_status_url: string = "";
user: <
?profile_image_url: string = "";
protected: bool;
screen_name: string
>;
id: string;
link: string;
epoch: string;
rid: string;
?photo_url: string = "";
?reply_message: string = "";
?reply_user_nick: string = "";
?slurl: string = "";
?areaname: string = ""
>
and timeline = wassr_json array
let get_and_print url =
let s = http_get url in
let j = Json_io.json_of_string ~big_int_mode:true s in
let json = timeline_of_json j in
Array.iter (fun s -> Printf.printf "%s says '%s'\n" s#user_login_id s#text) json;
flush stdout
;;
get_and_print "http://api.wassr.jp/statuses/friends_timeline.json?id=iratqq"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment