Пример #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);
        }
Пример #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;
        }
Пример #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);
        }
Пример #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;
        }
Пример #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);
        }
Пример #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;
        }
Пример #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);
        }
Пример #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;
        }
Пример #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);
        }
Пример #10
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;
		}