Use regexp to check if youtube url.
- Add basic build command.
This commit is contained in:
		
							parent
							
								
									642c6aa94a
								
							
						
					
					
						commit
						a3488cb554
					
				
					 2 changed files with 6 additions and 3 deletions
				
			
		
							
								
								
									
										1
									
								
								ocaml/build.sh
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										1
									
								
								ocaml/build.sh
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
ocamlfind ocamlc -package netclient str.cma main.ml -o cheesebot
 | 
			
		||||
| 
						 | 
				
			
			@ -1,8 +1,10 @@
 | 
			
		|||
open Http_client
 | 
			
		||||
open Str
 | 
			
		||||
 | 
			
		||||
(* Regexp required here *)
 | 
			
		||||
let is_youtube_url url =
 | 
			
		||||
  match url with
 | 
			
		||||
  | "http://www.youtube.com/" -> true
 | 
			
		||||
  | _ -> false;;
 | 
			
		||||
  let regexp = Str.regexp "http://www.youtube.com/.+" in
 | 
			
		||||
  Str.string_match regexp url 0;;
 | 
			
		||||
 | 
			
		||||
(* Maybe have a list of functions and
 | 
			
		||||
 * iter on all the items in the list *)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue