public override string GetVideoUrl(VideoInfo video) { CookieContainer cc = new CookieContainer(); string postData = "url=" + HttpUtility.UrlEncode(video.VideoUrl); string webData = GetWebData(@"http://www.telewizjada.net/set_cookie.php", postData, cc); var jData = GetWebData<JObject>(@"http://www.telewizjada.net/get_channel_url.php", "cid=" + video.Other.ToString(), cc); var webData2 = jData.Value<string>("url"); string m3u = GetWebData(webData2, null, cc); Match m = Regex.Match(m3u, @"(?<ch>chu.*)"); if (m.Success) { HttpUrl httpUrl = new HttpUrl(FormatDecodeAbsolutifyUrl(webData2, m.Groups["ch"].Value, "{0}", UrlDecoding.None)); httpUrl.LiveStream = true; foreach (Cookie cookie in cc.GetCookies(new Uri(@"http://www.telewizjada.net"))) httpUrl.Cookies.Add(cookie); return httpUrl.ToString(); } return String.Empty; }
public override List<VideoInfo> GetVideos(Category category) { String webData = GetWebData(((RssLink)category).Url, forceUTF8: true); XmlDocument doc = new XmlDocument(); doc.LoadXml(webData); List<VideoInfo> result = new List<VideoInfo>(); foreach (XmlNode vidNode in doc.SelectNodes("//resp/VoDs/vod")) { VideoInfo video = new VideoInfo(); video.Title = vidNode.Attributes["title"].Value; video.Airdate = epoch.AddSeconds(float.Parse(vidNode.Attributes["timestamp"].Value)).ToString(); video.Length = Helpers.TimeUtils.TimeFromSeconds(vidNode.Attributes["dur"].Value); video.Thumb = getThumb(vidNode); video.PlaybackOptions = new Dictionary<string, string>(); foreach (XmlNode urlNode in vidNode.SelectNodes("srcreq[@drmtype=\"0\" and @format!=\"2\"]")) { string url = urlNode.Attributes["url"].Value; string quality = urlNode.Attributes["quality"].Value; string key = qualities.ContainsKey(quality) ? qualities[quality] : "quality " + quality; string format = urlNode.Attributes["format"].Value; if (formats.ContainsKey(format)) key = key + " " + formats[format]; else key = key + " format: " + format; if (!video.PlaybackOptions.ContainsKey(key)) { HttpUrl httpUtl = new HttpUrl(url) { UserAgent = "this is no useragent" }; video.PlaybackOptions.Add(key, httpUtl.ToString()); } } if (video.PlaybackOptions.Count > 0) result.Add(video); } return result; }
public override string GetVideoUrl(string url) { CookieContainer cc = new CookieContainer(); if (url.Contains("embed") || url.Contains(@"/f/")) { string page = WebCache.Instance.GetWebData(url); if (!string.IsNullOrEmpty(page)) { Match n = Regex.Match(page, @"file:\s'(?<url>[^']*)'"); if (n.Success) { HttpUrl httpurl = new HttpUrl(n.Groups["url"].Value); httpurl.UserAgent = @"Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko"; return httpurl.ToString(); } } } else { string page = WebCache.Instance.GetWebData(url, cookies: cc); if (!string.IsNullOrEmpty(page)) { string op = Regex.Match(page, @"<input\stype=""hidden""\sname=""op""\svalue=""(?<value>[^""]+)"">").Groups["value"].Value; string id = Regex.Match(page, @"<input\stype=""hidden""\sname=""id""\svalue=""(?<value>[^""]+)"">").Groups["value"].Value; string rand = Regex.Match(page, @"<input\stype=""hidden""\sname=""rand""\svalue=""(?<value>[^""]+)"">").Groups["value"].Value; string referer = Regex.Match(page, @"<input\stype=""hidden""\sname=""referer""\svalue=""(?<value>[^""]+)"">").Groups["value"].Value; string method_free = Regex.Match(page, @"<input\stype=""submit""\sname=""method_free""\svalue=""(?<value>[^""]+)"">").Groups["value"].Value; //string method_premium = Regex.Match(page, @"<input\stype=""submit""\sname=""method_premium""\svalue=""(?<value>[^""]+)"">").Groups["value"].Value; //string timeToWait = Regex.Match(page, @"<span\sid=""countdown_str"">[^>]*>[^>]*>[^>]*>(?<time>[^<]+)</span>").Groups["time"].Value; //if (Convert.ToInt32(timeToWait) < 10) { string postdata = "op=" + op + "&id=" + id + "&rand=" + rand + "&referer=" + referer + "&method_free=" + HttpUtility.UrlEncode(method_free) + //"&method_premium=" + method_premium + "&down_direct=1"; //System.Threading.Thread.Sleep(Convert.ToInt32(timeToWait) * 1001); string page2 = WebCache.Instance.GetWebData(url, postdata, cc, url); if (!string.IsNullOrEmpty(page2)) { string packed = null; int i = page2.LastIndexOf(@"return p}"); if (i >= 0) { int j = page2.IndexOf(@"</script>", i); if (j >= 0) packed = page2.Substring(i + 9, j - i - 9); } string resUrl; if (!String.IsNullOrEmpty(packed)) { packed = packed.Replace(@"\'", @"'"); string unpacked = Helpers.StringUtils.UnPack(packed); string res = Helpers.StringUtils.GetSubString(unpacked, @"'file','", @"'"); if (!String.IsNullOrEmpty(res)) resUrl = res; else resUrl = Helpers.StringUtils.GetSubString(unpacked, @"name=""src""value=""", @""""); } else resUrl = Helpers.StringUtils.GetSubString(page2, @"addVariable('file','", @"'"); resUrl = resUrl.Replace("[", "%5b").Replace("]", "%5d"); return resUrl; } } } } return String.Empty; }
public override string GetVideoUrl(string url) { string webData = WebCache.Instance.GetWebData(url); webData = GetFromPost(url, webData); if (!string.IsNullOrEmpty(webData)) { string packed = null; int i = webData.LastIndexOf(@"return p}"); if (i >= 0) { int j = webData.IndexOf(@"</script>", i); if (j >= 0) packed = webData.Substring(i + 9, j - i - 9); } if (!String.IsNullOrEmpty(packed)) { packed = packed.Replace(@"\'", @"'"); string unpacked = Helpers.StringUtils.UnPack(packed); return Helpers.StringUtils.GetSubString(unpacked, @"name=""src""value=""", @""""); } return String.Empty; } Match m = Regex.Match(webData, @"var\slnk1\s=\s'(?<url>[^']*)'"); if (m.Success) { HttpUrl httpUrl = new HttpUrl(m.Groups["url"].Value); httpUrl.UserAgent = OnlineVideoSettings.Instance.UserAgent; return httpUrl.ToString(); } return String.Empty; }
public override string GetVideoUrl(string url) { string webData = WebCache.Instance.GetWebData(url); webData = GetFromPost(url, webData); Match m = Regex.Match(webData, @"var\slnk1\s=\s'(?<url>[^']*)'"); if (m.Success) { HttpUrl httpUrl = new HttpUrl(m.Groups["url"].Value); httpUrl.UserAgent = OnlineVideoSettings.Instance.UserAgent; return httpUrl.ToString(); } return String.Empty; }
public override string GetVideoUrl(VideoInfo video) { if ("livestream".Equals(video.Other)) { string data = GetWebData(video.VideoUrl); Match m2 = Regex.Match(data, @"<param\sname=""flashvars""\svalue=""assetID=(?<assetid>[^_]*)_"); if (m2.Success) { data = GetWebData(String.Format(@"http://www.rtve.es/api/videos/{0}/config/portada.json", m2.Groups["assetid"].Value)); m2 = Regex.Match(data, @"""file"":""(?<url>[^""]*)"""); if (m2.Success) { RtmpUrl rtmpUrl = new RtmpUrl(m2.Groups["url"].Value) { Live = true, SwfUrl = @"http://www.rtve.es/swf/4.0.32/RTVEPlayerVideo.swf" }; return rtmpUrl.ToString(); } } return null; } //source: http://code.google.com/p/xbmc-tvalacarta/source/browse/trunk/tvalacarta/servers/rtve.py: // thanks to aabilio and tvalacarta string[] parts = video.VideoUrl.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); string data2 = GetWebData(String.Format(@"http://www.rtve.es/ztnr/movil/thumbnail/anubis/videos/{0}.png", parts[parts.Length - 1]), referer: @"http://www.rtve.es"); data2 = Encoding.ASCII.GetString(Convert.FromBase64String(data2)); Match mm = Regex.Match(data2, ".*tEXt(?<cypher>.*)#[\x00]*(?<key>[0-9]*).*"); if (mm.Success) { string cypher = mm.Groups["cypher"].Value; string key = mm.Groups["key"].Value; string int_cypher = ""; int inc = 1; int ti = 0; while (ti < cypher.Length) { ti = ti + inc; if (ti > 0 && ti <= cypher.Length) int_cypher += cypher[ti - 1]; inc++; if (inc == 5) inc = 1; } string plaintext = ""; int key_ind = 0; inc = 4; while (key_ind < key.Length) { key_ind++; ti = ((byte)key[key_ind - 1] - 48) * 10; key_ind += inc; if (key_ind <= key.Length) ti += (byte)key[key_ind - 1] - 48; ti++; inc++; if (inc == 5) inc = 1; if (ti > 0 && ti <= int_cypher.Length) plaintext += int_cypher[ti - 1]; } int p = plaintext.IndexOf("/resources"); string url = @"http://flash.akamaihd.multimedia.cdn.rtve.es/auth" + plaintext.Substring(p) + "?v=2.6.8&fp=WIN%2016,0,0,305&r=TDBDO&g=UZEYDOLYKFLY"; string data = GetWebData(url); p = data.IndexOf('?'); string finalUrl = plaintext.Substring(0, p) + data.Substring(0, p); finalUrl = Regex.Replace(finalUrl, @"(//.*?.rtve.es)", @"//mvod.lvlt.rtve.es"); HttpUrl res = new HttpUrl(finalUrl); res.Cookies.Add(new Cookie("odin", "odin=banebdyede")); return res.ToString(); } return null; }
public override string GetVideoUrl(VideoInfo video) { Match m = Regex.Match(video.VideoUrl, @"/(?<id>sm\d*)", defaultRegexOptions); if (m.Success) { string id = m.Groups["id"].Value; CookieContainer tmpCc = new CookieContainer(); tmpCc.Add(cc.GetCookies(new Uri(baseUrl))); GetWebData(String.Format(@"http://www.nicovideo.jp/watch/{0}", id), cookies: tmpCc);// for getting cookies fileUrlPostString = "v=" + id; string oldUrl = video.VideoUrl; video.VideoUrl = @"http://flapi.nicovideo.jp/api/getflv"; string res = HttpUtility.UrlDecode(base.GetVideoUrl(video)); video.VideoUrl = oldUrl; HttpUrl result = new HttpUrl(res); CookieCollection ccol = tmpCc.GetCookies(new Uri(baseUrl)); result.Cookies.Add(ccol); return result.ToString(); } return String.Empty; }