Extend youtube regexp.
Cheesebot can now recognize youtube urls formatted like this: - http://www.youtube.com - https://www.youtube.com - http://youtube.com - www.youtube.com - youtu.be
This commit is contained in:
parent
0f095addec
commit
53e3b146f5
|
@ -14,12 +14,13 @@ Http_client.Convenience.configure_pipeline
|
|||
|
||||
(* Regexp required here *)
|
||||
let is_youtube_url url =
|
||||
let regexp = Str.regexp "https://www.youtube.com/.+" in
|
||||
let regexp = Str.regexp "\\(https?\\://\\)?\\(www\\.\\)?\\(youtube\\.com\\)\\|\\(youtu\\.be\\)/.+" in
|
||||
Str.string_match regexp url 0
|
||||
|
||||
|
||||
let get_body url =
|
||||
try Http_client.Convenience.http_get url with
|
||||
| Http_client.Http_error e -> "http error /o\\"
|
||||
| Failure f -> "http fail lol"
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue