private List <VideoInfo> GetPageVideos(String pageUrl) { List <VideoInfo> pageVideos = new List <VideoInfo>(); if (!String.IsNullOrEmpty(pageUrl)) { this.nextPageUrl = String.Empty; String baseWebData = GetWebData(pageUrl); XmlDocument document = new XmlDocument(); document.LoadXml(baseWebData); XmlNamespaceManager namespaceManager = new XmlNamespaceManager(document.NameTable); namespaceManager.AddNamespace("media", "http://search.yahoo.com/mrss/"); namespaceManager.AddNamespace("jwplayer", "http://developer.longtailvideo.com/trac/wiki/FlashFormats"); XmlNodeList media = document.SelectNodes("//media:content", namespaceManager); XmlNode url = document.SelectSingleNode("//jwplayer:streamer", namespaceManager); if ((media != null) && (url != null) && (media.Count != 0)) { String rtmpUrl = url.InnerText; String tcUrl = rtmpUrl; String app = rtmpUrl.Substring(rtmpUrl.IndexOf("/", rtmpUrl.IndexOf("//") + 2) + 1); String playPath = "ockoHQ3"; String resultUrl = new OnlineVideos.MPUrlSourceFilter.RtmpUrl(rtmpUrl) { LiveStream = true, TcUrl = tcUrl, App = app, PlayPath = playPath, PageUrl = OckoTvUtil.baseUrl, Live = true }.ToString(); VideoInfo videoInfo = new VideoInfo() { Title = "Live", Thumb = "http://ocko.tv/public/templates/default/img/drop-logo.png", VideoUrl = resultUrl }; pageVideos.Add(videoInfo); } this.nextPageUrl = String.Empty; } return(pageVideos); }
public override string getUrl(VideoInfo video) { String baseWebData = GetWebData(video.VideoUrl, null, null, null, true); Match videoId = Regex.Match(baseWebData, JojUtil.videoIdRegex); video.PlaybackOptions = new Dictionary <string, string>(); if (videoId.Success) { String safeVideoId = videoId.Groups["videoId"].Value.Replace("-", "%2D"); String servicesUrl = String.Format(JojUtil.servicesUrlWithoutPageIdFormat, safeVideoId); servicesUrl = Utils.FormatAbsoluteUrl(servicesUrl, video.VideoUrl); XmlDocument videoData = new XmlDocument(); videoData.LoadXml(GetWebData(servicesUrl)); XmlNodeList files = videoData.SelectNodes("//file[@type=\"rtmp-archiv\"]"); foreach (XmlNode file in files) { String videoQualityUrl = "rtmp://n15.joj.sk/" + file.Attributes["path"].Value; string host = videoQualityUrl.Substring(videoQualityUrl.IndexOf(":") + 3, videoQualityUrl.IndexOf("/", videoQualityUrl.IndexOf(":") + 3) - (videoQualityUrl.IndexOf(":") + 3)); string app = ""; string tcUrl = "rtmp://" + host; string playPath = videoQualityUrl.Substring(videoQualityUrl.IndexOf(tcUrl) + tcUrl.Length + 1); string resultUrl = new OnlineVideos.MPUrlSourceFilter.RtmpUrl(videoQualityUrl) { TcUrl = tcUrl, App = app, PlayPath = playPath }.ToString(); video.PlaybackOptions.Add(file.Attributes["label"].Value, resultUrl); } } if (video.PlaybackOptions != null && video.PlaybackOptions.Count > 0) { var enumer = video.PlaybackOptions.GetEnumerator(); enumer.MoveNext(); return(enumer.Current.Value); } return(String.Empty); }
public override List <string> getMultipleVideoUrls(VideoInfo video, bool inPlaylist = false) { List <String> videoUrls = new List <string>(); if (!video.VideoUrl.Contains("voyo")) { #region Old Doma archive String showEpisodesId = video.VideoUrl.Substring(video.VideoUrl.LastIndexOf("/") + 1); String configUrl = String.Format(DomaUtil.showEpisodePlaylistUrlFormat, showEpisodesId); String baseWebData = GetWebData(configUrl); int start = baseWebData.IndexOf(DomaUtil.showEpisodePlaylistStart); if (start > 0) { int end = baseWebData.IndexOf(DomaUtil.showEpisodePlaylistEnd, start); if (end > 0) { String showEpisodePlaylist = baseWebData.Substring(start, end - start); MatchCollection matches = Regex.Matches(showEpisodePlaylist, DomaUtil.showVideoUrlsRegex); foreach (Match tempMatch in matches) { videoUrls.Add(tempMatch.Groups["showVideosUrl"].Value); } } } #endregion } else { #region VOYO String baseWebData = GetWebData(video.VideoUrl, null, null, null, true); int startIndex = baseWebData.IndexOf(DomaUtil.showVoyoParamsStart); if (startIndex >= 0) { int endIndex = baseWebData.IndexOf(DomaUtil.showVoyoParamsEnd, startIndex + DomaUtil.showVoyoParamsStart.Length); if (endIndex >= 0) { baseWebData = baseWebData.Substring(startIndex, endIndex - startIndex); String prod = String.Empty; String unit = String.Empty; String media = String.Empty; String site = String.Empty; String section = String.Empty; String subsite = String.Empty; String width = String.Empty; String height = String.Empty; Match match = Regex.Match(baseWebData, DomaUtil.showVoyoSiteParamRegex); if (match.Success) { site = match.Groups["site"].Value; } match = Regex.Match(baseWebData, DomaUtil.showVoyoSectionParamRegex); if (match.Success) { section = match.Groups["section"].Value; } match = Regex.Match(baseWebData, DomaUtil.showVoyoSubsiteParamRegex); if (match.Success) { subsite = match.Groups["subsite"].Value; } match = Regex.Match(baseWebData, DomaUtil.showVoyoWidthParamRegex); if (match.Success) { width = match.Groups["width"].Value; } match = Regex.Match(baseWebData, DomaUtil.showVoyoHeightParamRegex); if (match.Success) { height = match.Groups["height"].Value; } match = Regex.Match(baseWebData, DomaUtil.showVoyoProdUnitMediaRegex); if (match.Success) { prod = match.Groups["prod"].Value; unit = match.Groups["unit"].Value; media = match.Groups["media"].Value; } String showParamsUrl = String.Format(DomaUtil.showVoyoVideoUrlFormat, prod, unit, media, site, section, subsite, site, width, height, new Random().NextDouble()); String showParamsData = GetWebData(showParamsUrl, null, null, null, true); Newtonsoft.Json.Linq.JObject jObject = (Newtonsoft.Json.Linq.JObject)Newtonsoft.Json.JsonConvert.DeserializeObject(showParamsData); String decodedPage = (String)((Newtonsoft.Json.Linq.JValue)((Newtonsoft.Json.Linq.JProperty)jObject.First).Value); String base64EncodedParameters = String.Empty; String showVoyoUrlParamStart = String.Format(DomaUtil.showVoyoUrlParamStartFormat, media); startIndex = decodedPage.IndexOf(showVoyoUrlParamStart); if (startIndex >= 0) { endIndex = decodedPage.IndexOf(DomaUtil.showVoyoUrlParamEnd, startIndex + showVoyoUrlParamStart.Length); if (endIndex >= 0) { base64EncodedParameters = decodedPage.Substring(startIndex + showVoyoUrlParamStart.Length, endIndex - startIndex - showVoyoUrlParamStart.Length); } } if (!String.IsNullOrEmpty(base64EncodedParameters)) { String decodedParams = HttpUtility.HtmlDecode(Flowplayer.Commercial.V3_1_5_17_002.Aes.Decrypt(base64EncodedParameters, Flowplayer.Commercial.V3_1_5_17_002.Aes.Key, Flowplayer.Commercial.V3_1_5_17_002.Aes.KeyType.Key128)); String host = String.Empty; String fileName = String.Empty; match = Regex.Match(decodedParams, DomaUtil.showVoyoHostRegex); if (match.Success) { jObject = (Newtonsoft.Json.Linq.JObject)Newtonsoft.Json.JsonConvert.DeserializeObject("{ \"host\": \"" + match.Groups["host"].Value + "\" }"); host = (String)((Newtonsoft.Json.Linq.JValue)((Newtonsoft.Json.Linq.JProperty)jObject.First).Value); } match = Regex.Match(decodedParams, DomaUtil.showVoyoFileNameRegex); if (match.Success) { jObject = (Newtonsoft.Json.Linq.JObject)Newtonsoft.Json.JsonConvert.DeserializeObject("{ \"filename\": \"" + match.Groups["fileName"].Value + "\" }"); fileName = (String)((Newtonsoft.Json.Linq.JValue)((Newtonsoft.Json.Linq.JProperty)jObject.First).Value); } if (!(String.IsNullOrEmpty(host) || String.IsNullOrEmpty(fileName))) { String playPath = String.Format("mp4:{0}-1.mp4", fileName); String resultUrl = new OnlineVideos.MPUrlSourceFilter.RtmpUrl(host) { TcUrl = host, PlayPath = playPath }.ToString(); videoUrls.Add(resultUrl); } } } } return(videoUrls); #endregion } return(videoUrls); }
private List<VideoInfo> GetPageVideos(String pageUrl) { List<VideoInfo> pageVideos = new List<VideoInfo>(); if (!String.IsNullOrEmpty(pageUrl)) { this.nextPageUrl = String.Empty; String baseWebData = GetWebData(pageUrl); XmlDocument document = new XmlDocument(); document.LoadXml(baseWebData); XmlNamespaceManager namespaceManager = new XmlNamespaceManager(document.NameTable); namespaceManager.AddNamespace("media", "http://search.yahoo.com/mrss/"); namespaceManager.AddNamespace("jwplayer", "http://developer.longtailvideo.com/trac/wiki/FlashFormats"); XmlNodeList media = document.SelectNodes("//media:content", namespaceManager); XmlNode url = document.SelectSingleNode("//jwplayer:streamer", namespaceManager); if ((media != null) && (url != null) && (media.Count != 0)) { String rtmpUrl = url.InnerText; String tcUrl = rtmpUrl; String app = rtmpUrl.Substring(rtmpUrl.IndexOf("/", rtmpUrl.IndexOf("//") + 2) + 1); String playPath = "ockoHQ3"; String resultUrl = new OnlineVideos.MPUrlSourceFilter.RtmpUrl(rtmpUrl) { LiveStream = true, TcUrl = tcUrl, App = app, PlayPath = playPath, PageUrl = OckoTvUtil.baseUrl, Live = true }.ToString(); VideoInfo videoInfo = new VideoInfo() { Title = "Live", Thumb = "http://ocko.tv/public/templates/default/img/drop-logo.png", VideoUrl = resultUrl }; pageVideos.Add(videoInfo); } this.nextPageUrl = String.Empty; } return pageVideos; }
public override string getUrl(VideoInfo video) { String baseWebData = GetWebData(video.VideoUrl, null, null, null, true); String playerJs = GetWebData(SlovenskaTeleviziaUtil.playerJsUrl, null, video.VideoUrl, null, true); video.PlaybackOptions = new Dictionary <string, string>(); int startIndex = baseWebData.IndexOf(SlovenskaTeleviziaUtil.videoStart); if (startIndex >= 0) { int endIndex = baseWebData.IndexOf(SlovenskaTeleviziaUtil.videoEnd, startIndex); if (endIndex >= 0) { String videoData = baseWebData.Substring(startIndex, endIndex - startIndex); Match match = Regex.Match(videoData, SlovenskaTeleviziaUtil.videoStreamRegex); if (match.Success) { String streamId = match.Groups["streamId"].Value; startIndex = playerJs.IndexOf(SlovenskaTeleviziaUtil.videoUrlFormatStart); if (startIndex >= 0) { endIndex = playerJs.IndexOf(SlovenskaTeleviziaUtil.videoUrlFormatEnd, startIndex); if (endIndex >= 0) { String playerData = playerJs.Substring(startIndex, endIndex - startIndex); match = Regex.Match(playerData, SlovenskaTeleviziaUtil.videoUrlFormatRegex); if (match.Success) { String videoUrlPart1 = match.Groups["videoUrlPart1"].Value; String videoUrlPart2 = match.Groups["videoUrlPart2"].Value; String rtmpUrl = videoUrlPart1 + streamId + videoUrlPart2; String streamPart = "mp4:" + streamId; String playPath = rtmpUrl.Substring(rtmpUrl.IndexOf(streamPart)); String tcUrl = rtmpUrl.Remove(rtmpUrl.IndexOf(streamPart) - 1, streamPart.Length + 1); String app = tcUrl.Substring(tcUrl.IndexOf("/", tcUrl.IndexOf("/") + 2) + 1); String resultUrl = new OnlineVideos.MPUrlSourceFilter.RtmpUrl(rtmpUrl) { TcUrl = tcUrl, App = app, PlayPath = playPath }.ToString(); video.PlaybackOptions.Add(video.Title, resultUrl); } } } } } } //Match match = Regex.Match(baseWebData, SlovenskaTeleviziaUtil.flashVarsRegex); //if (match.Success) //{ // baseWebData = GetWebData(match.Groups["playListFile"].Value.Replace("%26", "&"), null, null, null, true).Replace("xmlns=\"http://xspf.org/ns/0/\"", ""); // XmlDocument movieData = new XmlDocument(); // movieData.LoadXml(baseWebData); // XmlNode location = movieData.SelectSingleNode("//location"); // XmlNode stream = movieData.SelectSingleNode("//meta[@rel = \"streamer\"]"); // if ((location != null) && (stream != null)) // { // String movieUrl = stream.InnerText + "/" + location.InnerText; // string host = String.Empty; // string port = "1935"; // string firstSlash = movieUrl.Substring(movieUrl.IndexOf(":") + 3, movieUrl.IndexOf("/", movieUrl.IndexOf(":") + 3) - (movieUrl.IndexOf(":") + 3)); // String[] parts = firstSlash.Split(':'); // if (parts.Length == 2) // { // // host name and port // host = parts[0]; // port = parts[1]; // } // else // { // host = firstSlash; // } // string app = movieUrl.Substring(movieUrl.IndexOf("/", host.Length) + 1, movieUrl.IndexOf("/", movieUrl.IndexOf("/", host.Length) + 1) - movieUrl.IndexOf("/", host.Length) - 1); // string tcUrl = "rtmp://" + host + "/" + app; // string playPath = "mp4:" + movieUrl.Substring(movieUrl.IndexOf(app) + app.Length + 1); // string resultUrl = new OnlineVideos.MPUrlSourceFilter.RtmpUrl(movieUrl) { TcUrl = tcUrl, App = app, PlayPath = playPath }.ToString(); // video.PlaybackOptions.Add(video.Title, resultUrl); // } //} if (video.PlaybackOptions != null && video.PlaybackOptions.Count > 0) { var enumer = video.PlaybackOptions.GetEnumerator(); enumer.MoveNext(); return(enumer.Current.Value); } return(""); }
public override string getUrl(VideoInfo video) { String baseWebData = GetWebData(video.VideoUrl, null, null, null, true); Match mediaIdMatch = Regex.Match(baseWebData, NovaUtil.mediaIdRegex); if (mediaIdMatch.Success) { video.PlaybackOptions = new Dictionary<string, string>(); String mediaId = mediaIdMatch.Groups["mediaId"].Value; String time = DateTime.Now.ToString("yyyyMMddHHmmss"); String signature = String.Format("nova-vod|{0}|{1}|bae8ca04b7d23ab2d62968d2ea54", mediaId, time); String encodedHash = String.Empty; using (MD5 md5 = MD5.Create()) { Byte[] md5hash = md5.ComputeHash(Encoding.Default.GetBytes(signature)); encodedHash = Convert.ToBase64String(md5hash); } String videoPlaylistUrl = String.Format("http://master-ng.nacevi.cz/cdn.server/PlayerLink.ashx?t={1}&c=nova-vod|{0}&h=0&d=1&s={2}&tm=nova", mediaId, time, encodedHash); String videoPlaylistWebData = GetWebData(videoPlaylistUrl); XmlDocument videoPlaylist = new XmlDocument(); videoPlaylist.LoadXml(videoPlaylistWebData); if (videoPlaylist.SelectSingleNode("//baseUrl") != null) { String videoBaseUrl = videoPlaylist.SelectSingleNode("//baseUrl").InnerText; foreach (XmlNode node in videoPlaylist.SelectNodes("//media")) { String quality = node.SelectSingleNode("quality").InnerText; String url = node.SelectSingleNode("url").InnerText; String movieUrl = String.Format("{0}/{1}", videoBaseUrl, url); String host = movieUrl.Substring(movieUrl.IndexOf(":") + 3, movieUrl.IndexOf(":", movieUrl.IndexOf(":") + 3) - (movieUrl.IndexOf(":") + 3)); String app = movieUrl.Substring(movieUrl.IndexOf("/", host.Length) + 1, movieUrl.IndexOf("/", movieUrl.IndexOf("/", host.Length) + 1) - movieUrl.IndexOf("/", host.Length) - 1); String tcUrl = videoBaseUrl; String playPath = url; string resultUrl = new OnlineVideos.MPUrlSourceFilter.RtmpUrl(movieUrl) { TcUrl = tcUrl, App = app, PlayPath = playPath }.ToString(); switch (quality.ToUpperInvariant()) { case "FLV": case "LQ": video.PlaybackOptions.Add("Low quality", resultUrl); break; case "HQ": video.PlaybackOptions.Add("High quality", resultUrl); break; default: video.PlaybackOptions.Add(quality.ToUpperInvariant(), resultUrl); break; } } } } if (video.PlaybackOptions != null && video.PlaybackOptions.Count > 0) { var enumer = video.PlaybackOptions.GetEnumerator(); enumer.MoveNext(); return enumer.Current.Value; } return ""; }
public override List<string> getMultipleVideoUrls(VideoInfo video, bool inPlaylist = false) { List<String> videoUrls = new List<string>(); if (!video.VideoUrl.Contains("voyo")) { #region Old Doma archive String showEpisodesId = video.VideoUrl.Substring(video.VideoUrl.LastIndexOf("/") + 1); String configUrl = String.Format(DomaUtil.showEpisodePlaylistUrlFormat, showEpisodesId); String baseWebData = GetWebData(configUrl); int start = baseWebData.IndexOf(DomaUtil.showEpisodePlaylistStart); if (start > 0) { int end = baseWebData.IndexOf(DomaUtil.showEpisodePlaylistEnd, start); if (end > 0) { String showEpisodePlaylist = baseWebData.Substring(start, end - start); MatchCollection matches = Regex.Matches(showEpisodePlaylist, DomaUtil.showVideoUrlsRegex); foreach (Match tempMatch in matches) { videoUrls.Add(tempMatch.Groups["showVideosUrl"].Value); } } } #endregion } else { #region VOYO String baseWebData = GetWebData(video.VideoUrl, null, null, null, true); int startIndex = baseWebData.IndexOf(DomaUtil.showVoyoParamsStart); if (startIndex >= 0) { int endIndex = baseWebData.IndexOf(DomaUtil.showVoyoParamsEnd, startIndex + DomaUtil.showVoyoParamsStart.Length); if (endIndex >= 0) { baseWebData = baseWebData.Substring(startIndex, endIndex - startIndex); String prod = String.Empty; String unit = String.Empty; String media = String.Empty; String site = String.Empty; String section = String.Empty; String subsite = String.Empty; String width = String.Empty; String height = String.Empty; Match match = Regex.Match(baseWebData, DomaUtil.showVoyoSiteParamRegex); if (match.Success) { site = match.Groups["site"].Value; } match = Regex.Match(baseWebData, DomaUtil.showVoyoSectionParamRegex); if (match.Success) { section = match.Groups["section"].Value; } match = Regex.Match(baseWebData, DomaUtil.showVoyoSubsiteParamRegex); if (match.Success) { subsite = match.Groups["subsite"].Value; } match = Regex.Match(baseWebData, DomaUtil.showVoyoWidthParamRegex); if (match.Success) { width = match.Groups["width"].Value; } match = Regex.Match(baseWebData, DomaUtil.showVoyoHeightParamRegex); if (match.Success) { height = match.Groups["height"].Value; } match = Regex.Match(baseWebData, DomaUtil.showVoyoProdUnitMediaRegex); if (match.Success) { prod = match.Groups["prod"].Value; unit = match.Groups["unit"].Value; media = match.Groups["media"].Value; } String showParamsUrl = String.Format(DomaUtil.showVoyoVideoUrlFormat, prod, unit, media, site, section, subsite, site, width, height, new Random().NextDouble()); String showParamsData = GetWebData(showParamsUrl, null, null, null, true); Newtonsoft.Json.Linq.JObject jObject = (Newtonsoft.Json.Linq.JObject)Newtonsoft.Json.JsonConvert.DeserializeObject(showParamsData); String decodedPage = (String)((Newtonsoft.Json.Linq.JValue)((Newtonsoft.Json.Linq.JProperty)jObject.First).Value); String base64EncodedParameters = String.Empty; String showVoyoUrlParamStart = String.Format(DomaUtil.showVoyoUrlParamStartFormat, media); startIndex = decodedPage.IndexOf(showVoyoUrlParamStart); if (startIndex >= 0) { endIndex = decodedPage.IndexOf(DomaUtil.showVoyoUrlParamEnd, startIndex + showVoyoUrlParamStart.Length); if (endIndex >= 0) { base64EncodedParameters = decodedPage.Substring(startIndex + showVoyoUrlParamStart.Length, endIndex - startIndex - showVoyoUrlParamStart.Length); } } if (!String.IsNullOrEmpty(base64EncodedParameters)) { String decodedParams = HttpUtility.HtmlDecode(Flowplayer.Commercial.V3_1_5_17_002.Aes.Decrypt(base64EncodedParameters, Flowplayer.Commercial.V3_1_5_17_002.Aes.Key, Flowplayer.Commercial.V3_1_5_17_002.Aes.KeyType.Key128)); String host = String.Empty; String fileName = String.Empty; match = Regex.Match(decodedParams, DomaUtil.showVoyoHostRegex); if (match.Success) { jObject = (Newtonsoft.Json.Linq.JObject)Newtonsoft.Json.JsonConvert.DeserializeObject("{ \"host\": \"" + match.Groups["host"].Value + "\" }"); host = (String)((Newtonsoft.Json.Linq.JValue)((Newtonsoft.Json.Linq.JProperty)jObject.First).Value); } match = Regex.Match(decodedParams, DomaUtil.showVoyoFileNameRegex); if (match.Success) { jObject = (Newtonsoft.Json.Linq.JObject)Newtonsoft.Json.JsonConvert.DeserializeObject("{ \"filename\": \"" + match.Groups["fileName"].Value + "\" }"); fileName = (String)((Newtonsoft.Json.Linq.JValue)((Newtonsoft.Json.Linq.JProperty)jObject.First).Value); } if (!(String.IsNullOrEmpty(host) || String.IsNullOrEmpty(fileName))) { String playPath = String.Format("mp4:{0}-1.mp4", fileName); String resultUrl = new OnlineVideos.MPUrlSourceFilter.RtmpUrl(host) { TcUrl = host, PlayPath = playPath }.ToString(); videoUrls.Add(resultUrl); } } } } return videoUrls; #endregion } return videoUrls; }
public override string getUrl(VideoInfo video) { String baseWebData = GetWebData(video.VideoUrl, null, null, null, true); String playerJs = GetWebData(SlovenskaTeleviziaUtil.playerJsUrl, null, video.VideoUrl, null, true); video.PlaybackOptions = new Dictionary<string, string>(); int startIndex = baseWebData.IndexOf(SlovenskaTeleviziaUtil.videoStart); if (startIndex >= 0) { int endIndex = baseWebData.IndexOf(SlovenskaTeleviziaUtil.videoEnd, startIndex); if (endIndex >= 0) { String videoData = baseWebData.Substring(startIndex, endIndex - startIndex); Match match = Regex.Match(videoData, SlovenskaTeleviziaUtil.videoStreamRegex); if (match.Success) { String streamId = match.Groups["streamId"].Value; startIndex = playerJs.IndexOf(SlovenskaTeleviziaUtil.videoUrlFormatStart); if (startIndex >= 0) { endIndex = playerJs.IndexOf(SlovenskaTeleviziaUtil.videoUrlFormatEnd, startIndex); if (endIndex >= 0) { String playerData = playerJs.Substring(startIndex, endIndex - startIndex); match = Regex.Match(playerData, SlovenskaTeleviziaUtil.videoUrlFormatRegex); if (match.Success) { String videoUrlPart1 = match.Groups["videoUrlPart1"].Value; String videoUrlPart2 = match.Groups["videoUrlPart2"].Value; String rtmpUrl = videoUrlPart1 + streamId + videoUrlPart2; String streamPart = "mp4:" + streamId; String playPath = rtmpUrl.Substring(rtmpUrl.IndexOf(streamPart)); String tcUrl = rtmpUrl.Remove(rtmpUrl.IndexOf(streamPart) - 1, streamPart.Length + 1); String app = tcUrl.Substring(tcUrl.IndexOf("/", tcUrl.IndexOf("/") + 2) + 1); String resultUrl = new OnlineVideos.MPUrlSourceFilter.RtmpUrl(rtmpUrl) { TcUrl = tcUrl, App = app, PlayPath = playPath }.ToString(); video.PlaybackOptions.Add(video.Title, resultUrl); } } } } } } //Match match = Regex.Match(baseWebData, SlovenskaTeleviziaUtil.flashVarsRegex); //if (match.Success) //{ // baseWebData = GetWebData(match.Groups["playListFile"].Value.Replace("%26", "&"), null, null, null, true).Replace("xmlns=\"http://xspf.org/ns/0/\"", ""); // XmlDocument movieData = new XmlDocument(); // movieData.LoadXml(baseWebData); // XmlNode location = movieData.SelectSingleNode("//location"); // XmlNode stream = movieData.SelectSingleNode("//meta[@rel = \"streamer\"]"); // if ((location != null) && (stream != null)) // { // String movieUrl = stream.InnerText + "/" + location.InnerText; // string host = String.Empty; // string port = "1935"; // string firstSlash = movieUrl.Substring(movieUrl.IndexOf(":") + 3, movieUrl.IndexOf("/", movieUrl.IndexOf(":") + 3) - (movieUrl.IndexOf(":") + 3)); // String[] parts = firstSlash.Split(':'); // if (parts.Length == 2) // { // // host name and port // host = parts[0]; // port = parts[1]; // } // else // { // host = firstSlash; // } // string app = movieUrl.Substring(movieUrl.IndexOf("/", host.Length) + 1, movieUrl.IndexOf("/", movieUrl.IndexOf("/", host.Length) + 1) - movieUrl.IndexOf("/", host.Length) - 1); // string tcUrl = "rtmp://" + host + "/" + app; // string playPath = "mp4:" + movieUrl.Substring(movieUrl.IndexOf(app) + app.Length + 1); // string resultUrl = new OnlineVideos.MPUrlSourceFilter.RtmpUrl(movieUrl) { TcUrl = tcUrl, App = app, PlayPath = playPath }.ToString(); // video.PlaybackOptions.Add(video.Title, resultUrl); // } //} if (video.PlaybackOptions != null && video.PlaybackOptions.Count > 0) { var enumer = video.PlaybackOptions.GetEnumerator(); enumer.MoveNext(); return enumer.Current.Value; } return ""; }
public override string getUrl(VideoInfo video) { String baseWebData = GetWebData(video.VideoUrl, null, null, null, true); Match mediaIdMatch = Regex.Match(baseWebData, NovaUtil.mediaIdRegex); if (mediaIdMatch.Success) { video.PlaybackOptions = new Dictionary <string, string>(); String mediaId = mediaIdMatch.Groups["mediaId"].Value; String time = DateTime.Now.ToString("yyyyMMddHHmmss"); String signature = String.Format("nova-vod|{0}|{1}|bae8ca04b7d23ab2d62968d2ea54", mediaId, time); String encodedHash = String.Empty; using (MD5 md5 = MD5.Create()) { Byte[] md5hash = md5.ComputeHash(Encoding.Default.GetBytes(signature)); encodedHash = Convert.ToBase64String(md5hash); } String videoPlaylistUrl = String.Format("http://master-ng.nacevi.cz/cdn.server/PlayerLink.ashx?t={1}&c=nova-vod|{0}&h=0&d=1&s={2}&tm=nova", mediaId, time, encodedHash); String videoPlaylistWebData = GetWebData(videoPlaylistUrl); XmlDocument videoPlaylist = new XmlDocument(); videoPlaylist.LoadXml(videoPlaylistWebData); if (videoPlaylist.SelectSingleNode("//baseUrl") != null) { String videoBaseUrl = videoPlaylist.SelectSingleNode("//baseUrl").InnerText; foreach (XmlNode node in videoPlaylist.SelectNodes("//media")) { String quality = node.SelectSingleNode("quality").InnerText; String url = node.SelectSingleNode("url").InnerText; String movieUrl = String.Format("{0}/{1}", videoBaseUrl, url); String host = movieUrl.Substring(movieUrl.IndexOf(":") + 3, movieUrl.IndexOf(":", movieUrl.IndexOf(":") + 3) - (movieUrl.IndexOf(":") + 3)); String app = movieUrl.Substring(movieUrl.IndexOf("/", host.Length) + 1, movieUrl.IndexOf("/", movieUrl.IndexOf("/", host.Length) + 1) - movieUrl.IndexOf("/", host.Length) - 1); String tcUrl = videoBaseUrl; String playPath = url; string resultUrl = new OnlineVideos.MPUrlSourceFilter.RtmpUrl(movieUrl) { TcUrl = tcUrl, App = app, PlayPath = playPath }.ToString(); switch (quality.ToUpperInvariant()) { case "FLV": case "LQ": video.PlaybackOptions.Add("Low quality", resultUrl); break; case "HQ": video.PlaybackOptions.Add("High quality", resultUrl); break; default: video.PlaybackOptions.Add(quality.ToUpperInvariant(), resultUrl); break; } } } } if (video.PlaybackOptions != null && video.PlaybackOptions.Count > 0) { var enumer = video.PlaybackOptions.GetEnumerator(); enumer.MoveNext(); return(enumer.Current.Value); } return(""); }
public override string getUrl(VideoInfo video) { String baseWebData = GetWebData(video.VideoUrl, null, null, null, true); Match videoId = Regex.Match(baseWebData, JojPlusUtil.videoIdRegex); video.PlaybackOptions = new Dictionary<string, string>(); if (videoId.Success) { String safeVideoId = videoId.Groups["videoId"].Value.Replace("-", "%2D"); String servicesUrl = String.Format(JojPlusUtil.servicesUrlWithoutPageIdFormat, safeVideoId); servicesUrl = Utils.FormatAbsoluteUrl(servicesUrl, video.VideoUrl); XmlDocument videoData = new XmlDocument(); videoData.LoadXml(GetWebData(servicesUrl)); XmlNodeList files = videoData.SelectNodes("//file[@type=\"rtmp-archiv\"]"); foreach (XmlNode file in files) { String videoQualityUrl = "rtmp://n15.joj.sk/" + file.Attributes["path"].Value; string host = videoQualityUrl.Substring(videoQualityUrl.IndexOf(":") + 3, videoQualityUrl.IndexOf("/", videoQualityUrl.IndexOf(":") + 3) - (videoQualityUrl.IndexOf(":") + 3)); string app = ""; string tcUrl = "rtmp://" + host; string playPath = videoQualityUrl.Substring(videoQualityUrl.IndexOf(tcUrl) + tcUrl.Length + 1); string resultUrl = new OnlineVideos.MPUrlSourceFilter.RtmpUrl(videoQualityUrl) { TcUrl = tcUrl, App = app, PlayPath = playPath }.ToString(); video.PlaybackOptions.Add(file.Attributes["label"].Value, resultUrl); } } if (video.PlaybackOptions != null && video.PlaybackOptions.Count > 0) { var enumer = video.PlaybackOptions.GetEnumerator(); enumer.MoveNext(); return enumer.Current.Value; } return String.Empty; }
public override List<string> getMultipleVideoUrls(VideoInfo video, bool inPlaylist = false) { List<String> videoUrls = new List<string>(); System.Net.CookieContainer cookies = new System.Net.CookieContainer(); String baseWebData = GetWebData(video.VideoUrl, cookies, null, null, true); int startIndex = baseWebData.IndexOf(MarkizaUtil.showVoyoParamsStart); if (startIndex >= 0) { int endIndex = baseWebData.IndexOf(MarkizaUtil.showVoyoParamsEnd, startIndex + MarkizaUtil.showVoyoParamsStart.Length); if (endIndex >= 0) { baseWebData = baseWebData.Substring(startIndex, endIndex - startIndex); String prod = String.Empty; String unit = String.Empty; String media = String.Empty; String site = String.Empty; String section = String.Empty; String subsite = String.Empty; String width = String.Empty; String height = String.Empty; Match match = Regex.Match(baseWebData, MarkizaUtil.showVoyoSiteParamRegex); if (match.Success) { site = match.Groups["site"].Value; } match = Regex.Match(baseWebData, MarkizaUtil.showVoyoSectionParamRegex); if (match.Success) { section = match.Groups["section"].Value; } match = Regex.Match(baseWebData, MarkizaUtil.showVoyoSubsiteParamRegex); if (match.Success) { subsite = match.Groups["subsite"].Value; } match = Regex.Match(baseWebData, MarkizaUtil.showVoyoWidthParamRegex); if (match.Success) { width = match.Groups["width"].Value; } match = Regex.Match(baseWebData, MarkizaUtil.showVoyoHeightParamRegex); if (match.Success) { height = match.Groups["height"].Value; } match = Regex.Match(baseWebData, MarkizaUtil.showVoyoProdUnitMediaRegex); if (match.Success) { prod = match.Groups["prod"].Value; unit = match.Groups["unit"].Value; media = match.Groups["media"].Value; } String cookiesRequestUrl = String.Format("http://voyo.markiza.sk/bin/usrtrck-new.php?section_id={0}&article_id=&gallery_id=&media_id=&article_date=&r={1}&c=", section, new Random().NextDouble()); GetWebData(cookiesRequestUrl, cookies, null, null, true); cookiesRequestUrl = String.Format("http://voyo.markiza.sk/bin/eshop/ws/user.php?x=isLoggedIn&r={0}", new Random().NextDouble()); GetWebData(cookiesRequestUrl, cookies, null, null, true); cookiesRequestUrl = String.Format("http://voyo.markiza.sk/bin/eshop/ws/user.php?x=login&r={0}", new Random().NextDouble()); GetWebDataFromPost(cookiesRequestUrl, String.Format("u={0}&p={1}", this.login, this.password), cookies, null, null, true); String showParamsUrl = String.Format(MarkizaUtil.showVoyoVideoUrlFormat, prod, unit, media, site, section, subsite, site, width, height, new Random().NextDouble()); String showParamsData = GetWebData(showParamsUrl, cookies, null, null, true); Newtonsoft.Json.Linq.JObject jObject = (Newtonsoft.Json.Linq.JObject)Newtonsoft.Json.JsonConvert.DeserializeObject(showParamsData); String decodedPage = (String)((Newtonsoft.Json.Linq.JValue)((Newtonsoft.Json.Linq.JProperty)jObject.First).Value); String base64EncodedParameters = String.Empty; String showVoyoUrlParamStart = String.Format(MarkizaUtil.showVoyoUrlParamStartFormat, media); startIndex = decodedPage.IndexOf(showVoyoUrlParamStart); if (startIndex >= 0) { endIndex = decodedPage.IndexOf(MarkizaUtil.showVoyoUrlParamEnd, startIndex + showVoyoUrlParamStart.Length); if (endIndex >= 0) { base64EncodedParameters = decodedPage.Substring(startIndex + showVoyoUrlParamStart.Length, endIndex - startIndex - showVoyoUrlParamStart.Length); } } if (!String.IsNullOrEmpty(base64EncodedParameters)) { String decodedParams = HttpUtility.HtmlDecode(Flowplayer.Commercial.V3_1_5_17_002.Aes.Decrypt(base64EncodedParameters, Flowplayer.Commercial.V3_1_5_17_002.Aes.Key, Flowplayer.Commercial.V3_1_5_17_002.Aes.KeyType.Key128)); String host = String.Empty; String fileName = String.Empty; String connectionArgs = String.Empty; match = Regex.Match(decodedParams, MarkizaUtil.showVoyoHostRegex); if (match.Success) { jObject = (Newtonsoft.Json.Linq.JObject)Newtonsoft.Json.JsonConvert.DeserializeObject("{ \"host\": \"" + match.Groups["host"].Value + "\" }"); host = (String)((Newtonsoft.Json.Linq.JValue)((Newtonsoft.Json.Linq.JProperty)jObject.First).Value); } match = Regex.Match(decodedParams, MarkizaUtil.showVoyoFileNameRegex); if (match.Success) { jObject = (Newtonsoft.Json.Linq.JObject)Newtonsoft.Json.JsonConvert.DeserializeObject("{ \"filename\": \"" + match.Groups["fileName"].Value + "\" }"); fileName = (String)((Newtonsoft.Json.Linq.JValue)((Newtonsoft.Json.Linq.JProperty)jObject.First).Value); } if (!(String.IsNullOrEmpty(host) || String.IsNullOrEmpty(fileName))) { String playPath = String.Format("mp4:{0}-1.mp4", fileName); OnlineVideos.MPUrlSourceFilter.RtmpUrl rtmpUrl = new OnlineVideos.MPUrlSourceFilter.RtmpUrl(host) { TcUrl = host, PlayPath = playPath, App = "voyosk" }; match = Regex.Match(decodedParams, MarkizaUtil.showVoyoConnectionArgsRegex); if (match.Success) { jObject = (Newtonsoft.Json.Linq.JObject)Newtonsoft.Json.JsonConvert.DeserializeObject("{ \"connectionArgs\":[" + match.Groups["connectionArgs"].Value + "] }"); Newtonsoft.Json.Linq.JArray jConnectionArray = jObject["connectionArgs"] as Newtonsoft.Json.Linq.JArray; if ((jConnectionArray != null) && (jConnectionArray.Count > 0)) { MPUrlSourceFilter.RtmpObjectArbitraryData rtmpConnectionParams = new MPUrlSourceFilter.RtmpObjectArbitraryData(); for (int i = 0; i < jConnectionArray.Count; i++) { var connectionItem = jConnectionArray[i]; switch (connectionItem.Type) { case Newtonsoft.Json.Linq.JTokenType.None: break; case Newtonsoft.Json.Linq.JTokenType.Object: break; case Newtonsoft.Json.Linq.JTokenType.Array: break; case Newtonsoft.Json.Linq.JTokenType.Constructor: break; case Newtonsoft.Json.Linq.JTokenType.Property: break; case Newtonsoft.Json.Linq.JTokenType.Comment: break; case Newtonsoft.Json.Linq.JTokenType.Integer: rtmpConnectionParams.Objects.Add(new MPUrlSourceFilter.RtmpNumberArbitraryData(i.ToString(), (long)((Newtonsoft.Json.Linq.JValue)connectionItem).Value)); break; case Newtonsoft.Json.Linq.JTokenType.Float: rtmpConnectionParams.Objects.Add(new MPUrlSourceFilter.RtmpNumberArbitraryData(i.ToString(), (float)((Newtonsoft.Json.Linq.JValue)connectionItem).Value)); break; case Newtonsoft.Json.Linq.JTokenType.String: rtmpConnectionParams.Objects.Add(new MPUrlSourceFilter.RtmpStringArbitraryData(i.ToString(), (String)((Newtonsoft.Json.Linq.JValue)connectionItem).Value)); break; case Newtonsoft.Json.Linq.JTokenType.Boolean: break; case Newtonsoft.Json.Linq.JTokenType.Null: break; case Newtonsoft.Json.Linq.JTokenType.Undefined: break; case Newtonsoft.Json.Linq.JTokenType.Date: break; case Newtonsoft.Json.Linq.JTokenType.Raw: break; case Newtonsoft.Json.Linq.JTokenType.Bytes: break; default: break; } } rtmpUrl.ArbitraryData.Add(rtmpConnectionParams); } } videoUrls.Add(rtmpUrl.ToString()); } } } } return videoUrls; }
public override List <string> getMultipleVideoUrls(VideoInfo video, bool inPlaylist = false) { List <String> videoUrls = new List <string>(); System.Net.CookieContainer cookies = new System.Net.CookieContainer(); String baseWebData = GetWebData(video.VideoUrl, cookies, null, null, true); int startIndex = baseWebData.IndexOf(MarkizaUtil.showVoyoParamsStart); if (startIndex >= 0) { int endIndex = baseWebData.IndexOf(MarkizaUtil.showVoyoParamsEnd, startIndex + MarkizaUtil.showVoyoParamsStart.Length); if (endIndex >= 0) { baseWebData = baseWebData.Substring(startIndex, endIndex - startIndex); String prod = String.Empty; String unit = String.Empty; String media = String.Empty; String site = String.Empty; String section = String.Empty; String subsite = String.Empty; String width = String.Empty; String height = String.Empty; Match match = Regex.Match(baseWebData, MarkizaUtil.showVoyoSiteParamRegex); if (match.Success) { site = match.Groups["site"].Value; } match = Regex.Match(baseWebData, MarkizaUtil.showVoyoSectionParamRegex); if (match.Success) { section = match.Groups["section"].Value; } match = Regex.Match(baseWebData, MarkizaUtil.showVoyoSubsiteParamRegex); if (match.Success) { subsite = match.Groups["subsite"].Value; } match = Regex.Match(baseWebData, MarkizaUtil.showVoyoWidthParamRegex); if (match.Success) { width = match.Groups["width"].Value; } match = Regex.Match(baseWebData, MarkizaUtil.showVoyoHeightParamRegex); if (match.Success) { height = match.Groups["height"].Value; } match = Regex.Match(baseWebData, MarkizaUtil.showVoyoProdUnitMediaRegex); if (match.Success) { prod = match.Groups["prod"].Value; unit = match.Groups["unit"].Value; media = match.Groups["media"].Value; } String cookiesRequestUrl = String.Format("http://voyo.markiza.sk/bin/usrtrck-new.php?section_id={0}&article_id=&gallery_id=&media_id=&article_date=&r={1}&c=", section, new Random().NextDouble()); GetWebData(cookiesRequestUrl, cookies, null, null, true); cookiesRequestUrl = String.Format("http://voyo.markiza.sk/bin/eshop/ws/user.php?x=isLoggedIn&r={0}", new Random().NextDouble()); GetWebData(cookiesRequestUrl, cookies, null, null, true); cookiesRequestUrl = String.Format("http://voyo.markiza.sk/bin/eshop/ws/user.php?x=login&r={0}", new Random().NextDouble()); GetWebDataFromPost(cookiesRequestUrl, String.Format("u={0}&p={1}", this.login, this.password), cookies, null, null, true); String showParamsUrl = String.Format(MarkizaUtil.showVoyoVideoUrlFormat, prod, unit, media, site, section, subsite, site, width, height, new Random().NextDouble()); String showParamsData = GetWebData(showParamsUrl, cookies, null, null, true); Newtonsoft.Json.Linq.JObject jObject = (Newtonsoft.Json.Linq.JObject)Newtonsoft.Json.JsonConvert.DeserializeObject(showParamsData); String decodedPage = (String)((Newtonsoft.Json.Linq.JValue)((Newtonsoft.Json.Linq.JProperty)jObject.First).Value); String base64EncodedParameters = String.Empty; String showVoyoUrlParamStart = String.Format(MarkizaUtil.showVoyoUrlParamStartFormat, media); startIndex = decodedPage.IndexOf(showVoyoUrlParamStart); if (startIndex >= 0) { endIndex = decodedPage.IndexOf(MarkizaUtil.showVoyoUrlParamEnd, startIndex + showVoyoUrlParamStart.Length); if (endIndex >= 0) { base64EncodedParameters = decodedPage.Substring(startIndex + showVoyoUrlParamStart.Length, endIndex - startIndex - showVoyoUrlParamStart.Length); } } if (!String.IsNullOrEmpty(base64EncodedParameters)) { String decodedParams = HttpUtility.HtmlDecode(Flowplayer.Commercial.V3_1_5_17_002.Aes.Decrypt(base64EncodedParameters, Flowplayer.Commercial.V3_1_5_17_002.Aes.Key, Flowplayer.Commercial.V3_1_5_17_002.Aes.KeyType.Key128)); String host = String.Empty; String fileName = String.Empty; String connectionArgs = String.Empty; match = Regex.Match(decodedParams, MarkizaUtil.showVoyoHostRegex); if (match.Success) { jObject = (Newtonsoft.Json.Linq.JObject)Newtonsoft.Json.JsonConvert.DeserializeObject("{ \"host\": \"" + match.Groups["host"].Value + "\" }"); host = (String)((Newtonsoft.Json.Linq.JValue)((Newtonsoft.Json.Linq.JProperty)jObject.First).Value); } match = Regex.Match(decodedParams, MarkizaUtil.showVoyoFileNameRegex); if (match.Success) { jObject = (Newtonsoft.Json.Linq.JObject)Newtonsoft.Json.JsonConvert.DeserializeObject("{ \"filename\": \"" + match.Groups["fileName"].Value + "\" }"); fileName = (String)((Newtonsoft.Json.Linq.JValue)((Newtonsoft.Json.Linq.JProperty)jObject.First).Value); } if (!(String.IsNullOrEmpty(host) || String.IsNullOrEmpty(fileName))) { String playPath = String.Format("mp4:{0}-1.mp4", fileName); OnlineVideos.MPUrlSourceFilter.RtmpUrl rtmpUrl = new OnlineVideos.MPUrlSourceFilter.RtmpUrl(host) { TcUrl = host, PlayPath = playPath, App = "voyosk" }; match = Regex.Match(decodedParams, MarkizaUtil.showVoyoConnectionArgsRegex); if (match.Success) { jObject = (Newtonsoft.Json.Linq.JObject)Newtonsoft.Json.JsonConvert.DeserializeObject("{ \"connectionArgs\":[" + match.Groups["connectionArgs"].Value + "] }"); Newtonsoft.Json.Linq.JArray jConnectionArray = jObject["connectionArgs"] as Newtonsoft.Json.Linq.JArray; if ((jConnectionArray != null) && (jConnectionArray.Count > 0)) { MPUrlSourceFilter.RtmpObjectArbitraryData rtmpConnectionParams = new MPUrlSourceFilter.RtmpObjectArbitraryData(); for (int i = 0; i < jConnectionArray.Count; i++) { var connectionItem = jConnectionArray[i]; switch (connectionItem.Type) { case Newtonsoft.Json.Linq.JTokenType.None: break; case Newtonsoft.Json.Linq.JTokenType.Object: break; case Newtonsoft.Json.Linq.JTokenType.Array: break; case Newtonsoft.Json.Linq.JTokenType.Constructor: break; case Newtonsoft.Json.Linq.JTokenType.Property: break; case Newtonsoft.Json.Linq.JTokenType.Comment: break; case Newtonsoft.Json.Linq.JTokenType.Integer: rtmpConnectionParams.Objects.Add(new MPUrlSourceFilter.RtmpNumberArbitraryData(i.ToString(), (long)((Newtonsoft.Json.Linq.JValue)connectionItem).Value)); break; case Newtonsoft.Json.Linq.JTokenType.Float: rtmpConnectionParams.Objects.Add(new MPUrlSourceFilter.RtmpNumberArbitraryData(i.ToString(), (float)((Newtonsoft.Json.Linq.JValue)connectionItem).Value)); break; case Newtonsoft.Json.Linq.JTokenType.String: rtmpConnectionParams.Objects.Add(new MPUrlSourceFilter.RtmpStringArbitraryData(i.ToString(), (String)((Newtonsoft.Json.Linq.JValue)connectionItem).Value)); break; case Newtonsoft.Json.Linq.JTokenType.Boolean: break; case Newtonsoft.Json.Linq.JTokenType.Null: break; case Newtonsoft.Json.Linq.JTokenType.Undefined: break; case Newtonsoft.Json.Linq.JTokenType.Date: break; case Newtonsoft.Json.Linq.JTokenType.Raw: break; case Newtonsoft.Json.Linq.JTokenType.Bytes: break; default: break; } } rtmpUrl.ArbitraryData.Add(rtmpConnectionParams); } } videoUrls.Add(rtmpUrl.ToString()); } } } } return(videoUrls); }