Use regexp to check if youtube url.

- Add basic build command.
master
Fabien Freling 2013-12-08 17:07:53 +01:00
parent 642c6aa94a
commit a3488cb554
2 changed files with 6 additions and 3 deletions

1
ocaml/build.sh Executable file
View File

@ -0,0 +1 @@
ocamlfind ocamlc -package netclient str.cma main.ml -o cheesebot

View File

@ -1,8 +1,10 @@
open Http_client
open Str
(* Regexp required here *) (* Regexp required here *)
let is_youtube_url url = let is_youtube_url url =
match url with let regexp = Str.regexp "http://www.youtube.com/.+" in
| "http://www.youtube.com/" -> true Str.string_match regexp url 0;;
| _ -> false;;
(* Maybe have a list of functions and (* Maybe have a list of functions and
* iter on all the items in the list *) * iter on all the items in the list *)