Ejemplo n.º 1
0
        public override string GetVideoUrl(string url)
        {
            CookieContainer cc = new CookieContainer();
            string first = WebCache.Instance.GetWebData(url, cookies: cc);
            string code = Regex.Match(first, @"name=""code""\svalue=""(?<value>[^""]+)""").Groups["value"].Value;
            string second = WebCache.Instance.GetWebData(url, "code=" + code, cc, url);
            Match n = Regex.Match(second, @"url:\s'(?<url>.*/get/[^']+)'");
            if (n.Success)
            {
                return n.Groups["url"].Value;
            }
            else
            {
                string hash = Regex.Match(second, @"name=""hash""\svalue=""(?<value>[^""]+)""").Groups["value"].Value;
                string hostname = Regex.Match(second, @"name=""hostname""\svalue=""(?<value>[^""]+)""").Groups["value"].Value;
                string filename = Regex.Match(second, @"name=""filename""\svalue=""(?<value>[^""]+)""").Groups["value"].Value;

				if (!string.IsNullOrEmpty(hash) && !string.IsNullOrEmpty(hostname) && !string.IsNullOrEmpty(filename))
				{
					var resultUrl = new OnlineVideos.MPUrlSourceFilter.HttpUrl("http://" + hostname + "/get/" + hash + "/" + filename);
					resultUrl.Referer = url;
					return resultUrl.ToString();
				}
            }
            return String.Empty;
        }
Ejemplo n.º 2
0
        public override string GetVideoUrl(string url)
        {
            CookieContainer cc     = new CookieContainer();
            string          first  = WebCache.Instance.GetWebData(url, cookies: cc);
            string          code   = Regex.Match(first, @"name=""code""\svalue=""(?<value>[^""]+)""").Groups["value"].Value;
            string          second = WebCache.Instance.GetWebData(url, "code=" + code, cc, url);
            Match           n      = Regex.Match(second, @"url:\s'(?<url>.*/get/[^']+)'");

            if (n.Success)
            {
                return(n.Groups["url"].Value);
            }
            else
            {
                string hash     = Regex.Match(second, @"name=""hash""\svalue=""(?<value>[^""]+)""").Groups["value"].Value;
                string hostname = Regex.Match(second, @"name=""hostname""\svalue=""(?<value>[^""]+)""").Groups["value"].Value;
                string filename = Regex.Match(second, @"name=""filename""\svalue=""(?<value>[^""]+)""").Groups["value"].Value;

                if (!string.IsNullOrEmpty(hash) && !string.IsNullOrEmpty(hostname) && !string.IsNullOrEmpty(filename))
                {
                    var resultUrl = new OnlineVideos.MPUrlSourceFilter.HttpUrl("http://" + hostname + "/get/" + hash + "/" + filename);
                    resultUrl.Referer = url;
                    return(resultUrl.ToString());
                }
            }
            return(String.Empty);
        }
Ejemplo n.º 3
0
        public override string GetVideoUrl(VideoInfo video)
        {
            string videoUrl = string.Empty;

            Video clip = video.Other as Video;

            if (clip == null)
            {
                clip        = apiSession.Get <Video>(video.VideoUrl);
                video.Other = clip;
            }
            else if (!string.IsNullOrEmpty(video.VideoUrl) && !video.VideoUrl.StartsWith("file://"))             // todo : test with favorites!
            {
                clip = apiSession.Get <Video>(video.VideoUrl);
            }

            NodeResult result = clip.Update();

            if (clip.State != NodeState.Complete)
            {
                return(videoUrl);
            }

            video.Length = clip.Duration.ToString();

            Dictionary <string, string> files = new Dictionary <string, string>();

            foreach (var file in clip.Files)
            {
                var uri = new OnlineVideos.MPUrlSourceFilter.HttpUrl(file.Value);
                uri.UserAgent = QuickTimeUserAgent;
                files[file.Key.ToTitleString()] = uri.ToString();
            }

            // no files
            if (files.Count == 0)
            {
                return(videoUrl);
            }

            if (AlwaysPlaybackPreferredQuality)
            {
                if (files.Count > 0 && !files.TryGetValue(PreferredVideoQuality.ToTitleString(), out videoUrl))
                {
                    video.PlaybackOptions = files;
                    videoUrl = files.Values.ToArray()[files.Count - 1];
                }
            }
            else
            {
                video.PlaybackOptions = files;
                if (files.Count > 0 && !files.TryGetValue(PreferredVideoQuality.ToTitleString(), out videoUrl))
                {
                    videoUrl = files.Values.ToArray()[files.Count - 1];
                }
            }

            return(videoUrl);
        }
Ejemplo n.º 4
0
        public override string GetVideoUrl(string url)
        {
            string page = WebCache.Instance.GetWebData(url);
            if (!string.IsNullOrEmpty(page))
            {
                Match n = Regex.Match(page, @"type=""video/divx""\ssrc=""(?<url>[^""]+)""");
                if (n.Success)
                {
					var resultUrl = new OnlineVideos.MPUrlSourceFilter.HttpUrl(n.Groups["url"].Value);
					resultUrl.Referer = url;
					return resultUrl.ToString();
                }
            }
            return String.Empty;
        }
Ejemplo n.º 5
0
        public override string GetVideoUrl(string url)
        {
            string page = WebCache.Instance.GetWebData(url);

            if (!string.IsNullOrEmpty(page))
            {
                Match n = Regex.Match(page, @"type=""video/divx""\ssrc=""(?<url>[^""]+)""");
                if (n.Success)
                {
                    var resultUrl = new OnlineVideos.MPUrlSourceFilter.HttpUrl(n.Groups["url"].Value);
                    resultUrl.Referer = url;
                    return(resultUrl.ToString());
                }
            }
            return(String.Empty);
        }
Ejemplo n.º 6
0
        public override string GetVideoUrl(string url)
        {
            string page = WebCache.Instance.GetWebData(url);
            if (!string.IsNullOrEmpty(page))
            {
                Match n = Regex.Match(page, @"src=""(?<url>[^""]+)""\smovietitle");
                if (n.Success)
                {
                    string referer = n.Groups["url"].Value;
                    string link = WebCache.Instance.GetRedirectedUrl(referer, url);
                    if (referer.CompareTo(link) != 0)
                    {
						var resultUrl = new OnlineVideos.MPUrlSourceFilter.HttpUrl(link);
						resultUrl.Referer = referer;
						return resultUrl.ToString();
                    }
                }
            }
            return String.Empty;
        }
Ejemplo n.º 7
0
        public override string GetVideoUrl(string url)
        {
            string page = WebCache.Instance.GetWebData(url);

            if (!string.IsNullOrEmpty(page))
            {
                Match n = Regex.Match(page, @"src=""(?<url>[^""]+)""\smovietitle");
                if (n.Success)
                {
                    string referer = n.Groups["url"].Value;
                    string link    = WebCache.Instance.GetRedirectedUrl(referer, url);
                    if (referer.CompareTo(link) != 0)
                    {
                        var resultUrl = new OnlineVideos.MPUrlSourceFilter.HttpUrl(link);
                        resultUrl.Referer = referer;
                        return(resultUrl.ToString());
                    }
                }
            }
            return(String.Empty);
        }
Ejemplo n.º 8
0
        public override string GetVideoUrl(string url)
        {
            string page = WebCache.Instance.GetWebData(url);
            if (!string.IsNullOrEmpty(page))
            {
                Match n = Regex.Match(page, @"embed src=""(?<url>[^""]+)""");
                if (n.Success)
                {
                    return Regex.Match(HttpUtility.UrlDecode(n.Groups["url"].Value), @"file=(?<url>[^&]+)&").Groups["url"].Value;
                }
                else
                {
                    n = Regex.Match(page, @"href=""(?<url>[^""]+)"">Download");
                    if (n.Success)
                    {
						var resultUrl = new OnlineVideos.MPUrlSourceFilter.HttpUrl(n.Groups["url"].Value);
						resultUrl.Referer = url;
						return resultUrl.ToString();
                    }
                }
            }
            return String.Empty;
        }
Ejemplo n.º 9
0
        public override string GetVideoUrl(string url)
        {
            string page = WebCache.Instance.GetWebData(url);

            if (!string.IsNullOrEmpty(page))
            {
                Match n = Regex.Match(page, @"embed src=""(?<url>[^""]+)""");
                if (n.Success)
                {
                    return(Regex.Match(HttpUtility.UrlDecode(n.Groups["url"].Value), @"file=(?<url>[^&]+)&").Groups["url"].Value);
                }
                else
                {
                    n = Regex.Match(page, @"href=""(?<url>[^""]+)"">Download");
                    if (n.Success)
                    {
                        var resultUrl = new OnlineVideos.MPUrlSourceFilter.HttpUrl(n.Groups["url"].Value);
                        resultUrl.Referer = url;
                        return(resultUrl.ToString());
                    }
                }
            }
            return(String.Empty);
        }
Ejemplo n.º 10
0
        public override string getUrl(VideoInfo video)
        {
            String baseWebData = GetWebData(video.VideoUrl, null, null, null, true);

            // select video url block
            int startIndex = baseWebData.IndexOf(CzTraileryUtil.videoBlockStart);
            if (startIndex >= 0)
            {
                int endIndex = baseWebData.IndexOf(CzTraileryUtil.videoBlockEnd, startIndex + CzTraileryUtil.videoBlockStart.Length);
                if (endIndex >= 0)
                {
                    baseWebData = baseWebData.Substring(startIndex, endIndex - startIndex);
                }
            }

            #region try first type url
            startIndex = baseWebData.IndexOf(CzTraileryUtil.videoUrlBlock1Start);
            if (startIndex >= 0)
            {
                // first type url
                int endIndex = baseWebData.IndexOf(CzTraileryUtil.videoUrlBlock1End, startIndex + CzTraileryUtil.videoUrlBlock1Start.Length);
                if (endIndex >= 0)
                {
                    String videoConfigUrlData = baseWebData.Substring(startIndex, endIndex - startIndex);
                    Match match = Regex.Match(videoConfigUrlData, CzTraileryUtil.videoConfigUrlRegex);

                    if (match.Success)
                    {
                        String subtitleUrl = String.Empty;
                        String videoUrl = String.Empty;

                        String videoConfigUrl = match.Groups["videoConfigUrl"].Value;

                        match = Regex.Match(videoConfigUrlData, CzTraileryUtil.videoSubtitleUrlRegex);
                        if (match.Success)
                        {
                            videoUrl = videoConfigUrl;
                            subtitleUrl = match.Groups["videoSubtitleUrl"].Value;
                        }

                        if (videoConfigUrl.Contains(".xml"))
                        {
                            String videoData = GetWebData(videoConfigUrl, null, null, null, true);

                            startIndex = videoData.IndexOf(CzTraileryUtil.subtitlesUrlBlockStart);
                            if (startIndex >= 0)
                            {
                                endIndex = videoData.IndexOf(CzTraileryUtil.subtitlesUrlBlockEnd, startIndex + CzTraileryUtil.subtitlesUrlBlockStart.Length);
                                if (endIndex >= 0)
                                {
                                    subtitleUrl = new OnlineVideos.MPUrlSourceFilter.HttpUrl(HttpUtility.UrlDecode(videoData.Substring(startIndex + CzTraileryUtil.subtitlesUrlBlockStart.Length, endIndex - startIndex - CzTraileryUtil.subtitlesUrlBlockStart.Length))).ToString();
                                }
                            }

                            startIndex = videoData.IndexOf(CzTraileryUtil.locationUrlBlockStart);
                            if (startIndex >= 0)
                            {
                                endIndex = videoData.IndexOf(CzTraileryUtil.locationUrlBlockEnd, startIndex + CzTraileryUtil.locationUrlBlockStart.Length);
                                if (endIndex >= 0)
                                {
                                    videoUrl = new OnlineVideos.MPUrlSourceFilter.HttpUrl(HttpUtility.UrlDecode(videoData.Substring(startIndex + CzTraileryUtil.locationUrlBlockStart.Length, endIndex - startIndex - CzTraileryUtil.locationUrlBlockStart.Length))).ToString();
                                }
                            }
                        }

                        if (videoConfigUrl.Contains("http://www.youtube.com"))
                        {
                            Dictionary<String, String> playbackOptions = Hoster.Base.HosterFactory.GetHoster("Youtube").getPlaybackOptions(videoConfigUrl);
                            if (playbackOptions != null)
                            {
                                video.PlaybackOptions = playbackOptions;
                            }
                        }

                        if (video.PlaybackOptions != null && video.PlaybackOptions.Count > 0)
                        {
                            var enumer = video.PlaybackOptions.GetEnumerator();
                            enumer.MoveNext();
                            return enumer.Current.Value;
                        }

                        video.SubtitleUrl = subtitleUrl;
                        return videoUrl;
                    }
                }
            }
            #endregion

            #region try second type url
            startIndex = baseWebData.IndexOf(CzTraileryUtil.videoUrlBlock2Start);
            if (startIndex >= 0)
            {
                // second type url
                int endIndex = baseWebData.IndexOf(CzTraileryUtil.videoUrlBlock2End, startIndex + CzTraileryUtil.videoUrlBlock2Start.Length);
                if (endIndex >= 0)
                {
                    String videoObjectUrlData = baseWebData.Substring(startIndex, endIndex - startIndex);
                    Match match = Regex.Match(videoObjectUrlData, CzTraileryUtil.videoObjectUrlRegex);

                    if (match.Success)
                    {
                        String videoUrl = String.Empty;
                        String videoConfigUrl = match.Groups["videoObjectUrl"].Value;

                        if (videoConfigUrl.Contains("http://www.youtube.com"))
                        {
                            Dictionary<String, String> playbackOptions = Hoster.Base.HosterFactory.GetHoster("Youtube").getPlaybackOptions(videoConfigUrl);
                            if (playbackOptions != null)
                            {
                                video.PlaybackOptions = playbackOptions;
                            }

                            if (video.PlaybackOptions != null && video.PlaybackOptions.Count > 0)
                            {
                                var enumer = video.PlaybackOptions.GetEnumerator();
                                enumer.MoveNext();
                                return enumer.Current.Value;
                            }

                            return String.Empty;
                        }

                        match = Regex.Match(videoConfigUrl, CzTraileryUtil.trailerAddictComUrlRegex);
                        if (match.Success)
                        {
                            String videoId = match.Groups["videoId"].Value;
                            String videoData = GetWebData(String.Format(CzTraileryUtil.trailerAddictComConfigVideoUrl, videoId), null, null, null, true);

                            startIndex = videoData.IndexOf(CzTraileryUtil.trailerAddictComFileUrlBlockStart);
                            if (startIndex >= 0)
                            {
                                endIndex = videoData.IndexOf(CzTraileryUtil.trailerAddictComFileUrlBlockEnd, startIndex + CzTraileryUtil.trailerAddictComFileUrlBlockStart.Length);
                                if (endIndex >= 0)
                                {
                                    videoUrl = new OnlineVideos.MPUrlSourceFilter.HttpUrl(HttpUtility.UrlDecode(videoData.Substring(startIndex + CzTraileryUtil.trailerAddictComFileUrlBlockStart.Length, endIndex - startIndex - CzTraileryUtil.trailerAddictComFileUrlBlockStart.Length))).ToString();
                                }
                            }
                        }

                        return videoUrl;
                    }
                }
            }
            #endregion

            #region try third type url
            startIndex = baseWebData.IndexOf(CzTraileryUtil.videoUrlBlock3Start);
            if (startIndex >= 0)
            {
                // second type url
                int endIndex = baseWebData.IndexOf(CzTraileryUtil.videoUrlBlock3End, startIndex);
                if (endIndex >= 0)
                {
                    String videoObjectData = baseWebData.Substring(startIndex, endIndex - startIndex);

                    String subtitleUrl = String.Empty;
                    String videoUrl = String.Empty;

                    startIndex = videoObjectData.IndexOf(CzTraileryUtil.subtitlesUrlBlock3Start);
                    if (startIndex >= 0)
                    {
                        endIndex = videoObjectData.IndexOf(CzTraileryUtil.subtitlesUrlBlock3End, startIndex + CzTraileryUtil.subtitlesUrlBlock3Start.Length);
                        if (endIndex >= 0)
                        {
                            subtitleUrl = new OnlineVideos.MPUrlSourceFilter.HttpUrl(HttpUtility.UrlDecode(videoObjectData.Substring(startIndex + CzTraileryUtil.subtitlesUrlBlock3Start.Length, endIndex - startIndex - CzTraileryUtil.subtitlesUrlBlock3Start.Length))).ToString();
                        }
                    }

                    startIndex = videoObjectData.IndexOf(CzTraileryUtil.locationUrlBlock3Start);
                    if (startIndex >= 0)
                    {
                        endIndex = videoObjectData.IndexOf(CzTraileryUtil.locationUrlBlock3End, startIndex + CzTraileryUtil.locationUrlBlock3Start.Length);
                        if (endIndex >= 0)
                        {
                            videoUrl = new OnlineVideos.MPUrlSourceFilter.HttpUrl(HttpUtility.UrlDecode(videoObjectData.Substring(startIndex + CzTraileryUtil.locationUrlBlock3Start.Length, endIndex - startIndex - CzTraileryUtil.locationUrlBlock3Start.Length))).ToString();
                        }
                    }

                    video.SubtitleUrl = subtitleUrl;
                    return videoUrl;
                }
            }
            #endregion

            return String.Empty;
        }
Ejemplo n.º 11
0
        public override string getUrl(VideoInfo video)
        {
            String baseWebData = GetWebData(video.VideoUrl, null, null, null, true);

            // select video url block
            int startIndex = baseWebData.IndexOf(CzTraileryUtil.videoBlockStart);

            if (startIndex >= 0)
            {
                int endIndex = baseWebData.IndexOf(CzTraileryUtil.videoBlockEnd, startIndex + CzTraileryUtil.videoBlockStart.Length);
                if (endIndex >= 0)
                {
                    baseWebData = baseWebData.Substring(startIndex, endIndex - startIndex);
                }
            }

            #region try first type url
            startIndex = baseWebData.IndexOf(CzTraileryUtil.videoUrlBlock1Start);
            if (startIndex >= 0)
            {
                // first type url
                int endIndex = baseWebData.IndexOf(CzTraileryUtil.videoUrlBlock1End, startIndex + CzTraileryUtil.videoUrlBlock1Start.Length);
                if (endIndex >= 0)
                {
                    String videoConfigUrlData = baseWebData.Substring(startIndex, endIndex - startIndex);
                    Match  match = Regex.Match(videoConfigUrlData, CzTraileryUtil.videoConfigUrlRegex);

                    if (match.Success)
                    {
                        String subtitleUrl = String.Empty;
                        String videoUrl    = String.Empty;

                        String videoConfigUrl = match.Groups["videoConfigUrl"].Value;

                        match = Regex.Match(videoConfigUrlData, CzTraileryUtil.videoSubtitleUrlRegex);
                        if (match.Success)
                        {
                            videoUrl    = videoConfigUrl;
                            subtitleUrl = match.Groups["videoSubtitleUrl"].Value;
                        }

                        if (videoConfigUrl.Contains(".xml"))
                        {
                            String videoData = GetWebData(videoConfigUrl, null, null, null, true);

                            startIndex = videoData.IndexOf(CzTraileryUtil.subtitlesUrlBlockStart);
                            if (startIndex >= 0)
                            {
                                endIndex = videoData.IndexOf(CzTraileryUtil.subtitlesUrlBlockEnd, startIndex + CzTraileryUtil.subtitlesUrlBlockStart.Length);
                                if (endIndex >= 0)
                                {
                                    subtitleUrl = new OnlineVideos.MPUrlSourceFilter.HttpUrl(HttpUtility.UrlDecode(videoData.Substring(startIndex + CzTraileryUtil.subtitlesUrlBlockStart.Length, endIndex - startIndex - CzTraileryUtil.subtitlesUrlBlockStart.Length))).ToString();
                                }
                            }

                            startIndex = videoData.IndexOf(CzTraileryUtil.locationUrlBlockStart);
                            if (startIndex >= 0)
                            {
                                endIndex = videoData.IndexOf(CzTraileryUtil.locationUrlBlockEnd, startIndex + CzTraileryUtil.locationUrlBlockStart.Length);
                                if (endIndex >= 0)
                                {
                                    videoUrl = new OnlineVideos.MPUrlSourceFilter.HttpUrl(HttpUtility.UrlDecode(videoData.Substring(startIndex + CzTraileryUtil.locationUrlBlockStart.Length, endIndex - startIndex - CzTraileryUtil.locationUrlBlockStart.Length))).ToString();
                                }
                            }
                        }

                        if (videoConfigUrl.Contains("http://www.youtube.com"))
                        {
                            Dictionary <String, String> playbackOptions = Hoster.Base.HosterFactory.GetHoster("Youtube").getPlaybackOptions(videoConfigUrl);
                            if (playbackOptions != null)
                            {
                                video.PlaybackOptions = playbackOptions;
                            }
                        }

                        if (video.PlaybackOptions != null && video.PlaybackOptions.Count > 0)
                        {
                            var enumer = video.PlaybackOptions.GetEnumerator();
                            enumer.MoveNext();
                            return(enumer.Current.Value);
                        }

                        video.SubtitleUrl = subtitleUrl;
                        return(videoUrl);
                    }
                }
            }
            #endregion

            #region try second type url
            startIndex = baseWebData.IndexOf(CzTraileryUtil.videoUrlBlock2Start);
            if (startIndex >= 0)
            {
                // second type url
                int endIndex = baseWebData.IndexOf(CzTraileryUtil.videoUrlBlock2End, startIndex + CzTraileryUtil.videoUrlBlock2Start.Length);
                if (endIndex >= 0)
                {
                    String videoObjectUrlData = baseWebData.Substring(startIndex, endIndex - startIndex);
                    Match  match = Regex.Match(videoObjectUrlData, CzTraileryUtil.videoObjectUrlRegex);

                    if (match.Success)
                    {
                        String videoUrl       = String.Empty;
                        String videoConfigUrl = match.Groups["videoObjectUrl"].Value;

                        if (videoConfigUrl.Contains("http://www.youtube.com"))
                        {
                            Dictionary <String, String> playbackOptions = Hoster.Base.HosterFactory.GetHoster("Youtube").getPlaybackOptions(videoConfigUrl);
                            if (playbackOptions != null)
                            {
                                video.PlaybackOptions = playbackOptions;
                            }

                            if (video.PlaybackOptions != null && video.PlaybackOptions.Count > 0)
                            {
                                var enumer = video.PlaybackOptions.GetEnumerator();
                                enumer.MoveNext();
                                return(enumer.Current.Value);
                            }

                            return(String.Empty);
                        }

                        match = Regex.Match(videoConfigUrl, CzTraileryUtil.trailerAddictComUrlRegex);
                        if (match.Success)
                        {
                            String videoId   = match.Groups["videoId"].Value;
                            String videoData = GetWebData(String.Format(CzTraileryUtil.trailerAddictComConfigVideoUrl, videoId), null, null, null, true);

                            startIndex = videoData.IndexOf(CzTraileryUtil.trailerAddictComFileUrlBlockStart);
                            if (startIndex >= 0)
                            {
                                endIndex = videoData.IndexOf(CzTraileryUtil.trailerAddictComFileUrlBlockEnd, startIndex + CzTraileryUtil.trailerAddictComFileUrlBlockStart.Length);
                                if (endIndex >= 0)
                                {
                                    videoUrl = new OnlineVideos.MPUrlSourceFilter.HttpUrl(HttpUtility.UrlDecode(videoData.Substring(startIndex + CzTraileryUtil.trailerAddictComFileUrlBlockStart.Length, endIndex - startIndex - CzTraileryUtil.trailerAddictComFileUrlBlockStart.Length))).ToString();
                                }
                            }
                        }

                        return(videoUrl);
                    }
                }
            }
            #endregion

            #region try third type url
            startIndex = baseWebData.IndexOf(CzTraileryUtil.videoUrlBlock3Start);
            if (startIndex >= 0)
            {
                // second type url
                int endIndex = baseWebData.IndexOf(CzTraileryUtil.videoUrlBlock3End, startIndex);
                if (endIndex >= 0)
                {
                    String videoObjectData = baseWebData.Substring(startIndex, endIndex - startIndex);

                    String subtitleUrl = String.Empty;
                    String videoUrl    = String.Empty;

                    startIndex = videoObjectData.IndexOf(CzTraileryUtil.subtitlesUrlBlock3Start);
                    if (startIndex >= 0)
                    {
                        endIndex = videoObjectData.IndexOf(CzTraileryUtil.subtitlesUrlBlock3End, startIndex + CzTraileryUtil.subtitlesUrlBlock3Start.Length);
                        if (endIndex >= 0)
                        {
                            subtitleUrl = new OnlineVideos.MPUrlSourceFilter.HttpUrl(HttpUtility.UrlDecode(videoObjectData.Substring(startIndex + CzTraileryUtil.subtitlesUrlBlock3Start.Length, endIndex - startIndex - CzTraileryUtil.subtitlesUrlBlock3Start.Length))).ToString();
                        }
                    }

                    startIndex = videoObjectData.IndexOf(CzTraileryUtil.locationUrlBlock3Start);
                    if (startIndex >= 0)
                    {
                        endIndex = videoObjectData.IndexOf(CzTraileryUtil.locationUrlBlock3End, startIndex + CzTraileryUtil.locationUrlBlock3Start.Length);
                        if (endIndex >= 0)
                        {
                            videoUrl = new OnlineVideos.MPUrlSourceFilter.HttpUrl(HttpUtility.UrlDecode(videoObjectData.Substring(startIndex + CzTraileryUtil.locationUrlBlock3Start.Length, endIndex - startIndex - CzTraileryUtil.locationUrlBlock3Start.Length))).ToString();
                        }
                    }

                    video.SubtitleUrl = subtitleUrl;
                    return(videoUrl);
                }
            }
            #endregion

            return(String.Empty);
        }
Ejemplo n.º 12
0
		public override string GetVideoUrl(VideoInfo video) {
			string videoUrl = string.Empty;

			Video clip = video.Other as Video;
			if (clip == null)
			{
				clip = apiSession.Get<Video>(video.VideoUrl);
				video.Other = clip;
			}
			else if (!string.IsNullOrEmpty(video.VideoUrl) && !video.VideoUrl.StartsWith("file://")) // todo : test with favorites!
			{
				clip = apiSession.Get<Video>(video.VideoUrl);
			}

			NodeResult result = clip.Update();
			if (clip.State != NodeState.Complete)
			{
				return videoUrl;
			}

			video.Length = clip.Duration.ToString();

			Dictionary<string, string> files = new Dictionary<string, string>();

			foreach (var file in clip.Files) {
				var uri = new OnlineVideos.MPUrlSourceFilter.HttpUrl(file.Value);
				uri.UserAgent = QuickTimeUserAgent;
				files[file.Key.ToTitleString()] = uri.ToString();
			}

			// no files
			if (files.Count == 0)
				return videoUrl;

			if (AlwaysPlaybackPreferredQuality) {
				if (files.Count > 0 && !files.TryGetValue(PreferredVideoQuality.ToTitleString(), out videoUrl))
				{
					video.PlaybackOptions = files;
					videoUrl = files.Values.ToArray()[files.Count - 1];
				}
			}
			else {
				video.PlaybackOptions = files;
				if (files.Count > 0 && !files.TryGetValue(PreferredVideoQuality.ToTitleString(), out videoUrl)) {
					videoUrl = files.Values.ToArray()[files.Count - 1];
				}
			}

			return videoUrl;
		}