| 1 | <?php namespace Arcanedev\EmbedVideo\Parsers; |
||
| 9 | class YoutubeParser extends AbstractParser |
||
| 10 | { |
||
| 11 | /* ----------------------------------------------------------------- |
||
| 12 | | Properties |
||
| 13 | | ----------------------------------------------------------------- |
||
| 14 | */ |
||
| 15 | /** |
||
| 16 | * Timestamp pattern and param. |
||
| 17 | * |
||
| 18 | * @var array |
||
| 19 | */ |
||
| 20 | protected $timestamp = [ |
||
| 21 | 'pattern' => '^(?:https?://)?(?:www\.)?(?:youtu\.be/|youtube\.com/)(?:\S+)?(?:(?:\S+)?(?:\?|&)t=(?:([0-9]+)h)?(?:([0-9]+)m)?(?:([0-9]+)s)?)$', |
||
| 22 | 'param' => 'start', |
||
| 23 | ]; |
||
| 24 | |||
| 25 | /* ----------------------------------------------------------------- |
||
| 26 | | Getters & Setters |
||
| 27 | | ----------------------------------------------------------------- |
||
| 28 | */ |
||
| 29 | /** |
||
| 30 | * Get the video id from cached matches. |
||
| 31 | * |
||
| 32 | * @return string |
||
| 33 | */ |
||
| 34 | 30 | public function videoId() |
|
| 38 | |||
| 39 | /** |
||
| 40 | * Get the default URL queries. |
||
| 41 | * |
||
| 42 | * @return array |
||
| 43 | */ |
||
| 44 | 45 | protected function defaultQueries() |
|
| 51 | |||
| 52 | /** |
||
| 53 | * Get the iframe pattern. |
||
| 54 | * |
||
| 55 | * @return string |
||
| 56 | */ |
||
| 57 | 24 | protected function getIframePattern() |
|
| 61 | |||
| 62 | /** |
||
| 63 | * Get the iframe replace. |
||
| 64 | * |
||
| 65 | * @return array |
||
| 66 | */ |
||
| 67 | 24 | protected function getIframeReplacer() |
|
| 74 | |||
| 75 | /** |
||
| 76 | * Get the info URL. |
||
| 77 | * |
||
| 78 | * @return string |
||
| 79 | */ |
||
| 80 | 3 | public function getInfoUrl() |
|
| 84 | } |
||
| 85 |