@@ 117-126 (lines=10) @@ | ||
114 | * |
|
115 | * @return mixed |
|
116 | */ |
|
117 | public function isolateVimeoVideoCode($link) |
|
118 | { |
|
119 | try { |
|
120 | if (preg_match("/(https?:\/\/)?(www\.)?(player\.)?vimeo\.com\/([a-z]*\/)*([0-9]{6,11})[?]?.*/", $link, $output_array)) { |
|
121 | return $output_array[5]; |
|
122 | } |
|
123 | } catch (\Exception $e) { |
|
124 | throw new VideoException("can't match vimeo code in given url", $e); |
|
125 | } |
|
126 | } |
|
127 | ||
128 | /** |
|
129 | * @param $link |
|
@@ 135-144 (lines=10) @@ | ||
132 | * |
|
133 | * @return mixed |
|
134 | */ |
|
135 | public function isolateYoutubeVideoCode($link) |
|
136 | { |
|
137 | try { |
|
138 | if (preg_match("#(?<=v=)[a-zA-Z0-9-]+(?=&)|(?<=v\/)[^&\n]+(?=\?)|(?<=v=)[^&\n]+|(?<=youtu.be/)[^&\n]+#", $link, $matches)) { |
|
139 | return $matches[0]; |
|
140 | } |
|
141 | } catch (\Exception $e) { |
|
142 | throw new VideoException("can't match youtube code in given url", $e); |
|
143 | } |
|
144 | } |
|
145 | ||
146 | /** |
|
147 | * @param $link |