extractPrivateToken($url); return new VideoRef( platform: Platform::RUTUBE, id: $id, query: $query, ); } // Numeric embed id: rutube.ru/video/embed/6722881 — requires a // play/options lookup to resolve the 32-hex `effective_video`. if (preg_match('#/embed/(\d+)#i', $url, $m)) { return new VideoRef( platform: Platform::RUTUBE, id: $m[1], type: 'embed_numeric', ); } throw new ParseFailedException("URL does not look like a Rutube video: {$url}"); } /** * @return array */ private function extractPrivateToken(string $url): array { $queryStr = (string) parse_url($url, PHP_URL_QUERY); if ($queryStr === '') { return []; } parse_str($queryStr, $query); if (isset($query['p']) && is_string($query['p'])) { return ['p' => $query['p']]; } return []; } }