Commits

UENISHI Kota  committed d892d1b

refactor & replaced deprecated &.

  • Participants
  • Parent commits 5a0c2a5

Comments (0)

Files changed (1)

 
 exception Bad_tumblr_xml;;
 
-let api_url_base username = 
-  Printf.sprintf "http://%s.tumblr.com/api/read" username;;
-
 let get_tagged_and_attr_child node tagname attrname attrvalue=
   let rec pup list = 
     match list with
       |[] -> raise Bad_tumblr_xml;
       |child::remain->
-	if (Xml.tag child)=tagname & (Xml.attrib child attrname)=attrvalue
-	then 
-(*	  print_endline (Xml.to_string_fmt child); *)
-	  Xml.pcdata (List.nth (Xml.children child) 0)
+	if (Xml.tag child)=tagname && (Xml.attrib child attrname)=attrvalue
+	then Xml.pcdata (List.nth (Xml.children child) 0)
 	else pup remain 
   in
     pup (Xml.children node) 
     (id, url)::list ;;
 
 let query username offset = 
-  let url_base = api_url_base username in
+  let url_base = Printf.sprintf "http://%s.tumblr.com/api/read" username in
   let get_req = Printf.sprintf "?start=%d&num=50&type=photo" offset in
   let url = url_base ^ get_req in
   let posts_xml = List.nth (Xml.children (Xml.parse_string (http_get url))) 1 in