public override int DiscoverDynamicCategories() { if (Settings.Categories == null) Settings.Categories = new BindingList<Category>(); cc = new CookieContainer(); string data = GetWebData(@"https://www.filmon.com/tv/live", userAgent: userAgent, cookies: cc); string jsondata = @"{""result"":" + Helpers.StringUtils.GetSubString(data, "var groups =", @"if(!$.isArray").Trim().TrimEnd(';') + "}"; JToken jt = JObject.Parse(jsondata) as JToken; foreach (JToken jCat in jt["result"] as JArray) { RssLink cat = new RssLink(); cat.Name = jCat.Value<string>("title"); cat.Description = jCat.Value<string>("description"); cat.Thumb = jCat.Value<string>("logo_uri"); Settings.Categories.Add(cat); JArray channels = jCat["channels"] as JArray; List<VideoInfo> videos = new List<VideoInfo>(); foreach (JToken channel in channels) { VideoInfo video = new VideoInfo(); video.Thumb = channel.Value<string>("logo"); video.Description = channel.Value<string>("description"); video.Title = channel.Value<string>("title"); video.VideoUrl = @"https://www.filmon.com/ajax/getChannelInfo"; video.Other = String.Format(@"channel_id={0}&quality=low", channel.Value<string>("id")); videos.Add(video); } cat.Other = videos; } Settings.DynamicCategoriesDiscovered = true; return Settings.Categories.Count; }
public override string GetVideoUrl(VideoInfo video) { CookieContainer newCc = new CookieContainer(); foreach (Cookie c in cc.GetCookies(new Uri(@"https://www.filmon.com/"))) { newCc.Add(c); } NameValueCollection headers = new NameValueCollection(); headers.Add("Accept", "*/*"); headers.Add("User-Agent", userAgent); headers.Add("X-Requested-With", "XMLHttpRequest"); string webdata = GetWebData(video.VideoUrl, (string)video.Other, newCc, headers: headers); JToken jt = JObject.Parse(webdata) as JToken; JArray streams = jt.Value<JArray>("streams"); video.PlaybackOptions = new Dictionary<string, string>(); foreach (JToken stream in streams) { string serverUrl = stream.Value<string>("url"); RtmpUrl res = new RtmpUrl(serverUrl); res.Live = true; res.PlayPath = stream.Value<string>("name"); int p = serverUrl.IndexOf("live/?id"); res.App = serverUrl.Substring(p); video.PlaybackOptions.Add(stream.Value<string>("quality"), res.ToString()); } return video.PlaybackOptions.First().Value; }
public override List<VideoInfo> GetVideos(Category category) { List<VideoInfo> videos = new List<VideoInfo>(); String sessionIdData = GetWebData("https://orangetv.orange.es/atv/api/anonymous?appId=es.orange.pc&appVersion=1.0"); String sessionId = (String)JObject.Parse(sessionIdData).SelectToken("sessionId"); NameValueCollection headers = new NameValueCollection(); headers.Add("Accept", "*/*"); headers.Add("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.3"); headers.Add("Accept-Encoding", "gzip,deflate,sdch"); headers.Add("Accept-Language", "es-ES,es;q=0.8"); headers.Add("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.89 Safari/537.1"); headers.Add("X-Aspiro-TV-Session", sessionId); String canalesData = GetWebData("https://orangetv.orange.es/atv/api/epg?from=now&offset=-2h&duration=16h&view=epg&byTags=SmoothStreaming%40sourceType", headers: headers); JArray canalesJson = JArray.Parse(canalesData); for (int i = 0; i < canalesJson.Count; i++) { JToken canal = canalesJson[i]; VideoInfo video = new VideoInfo(); video.Title = (String)canal["title"]; video.Thumb = (String)canal["images"]["LOGO"]; video.VideoUrl = "https://orangetv.orange.es/#!channel/" + (String)canal["id"] + "/play"; videos.Add(video); } return videos; }
public override string GetVideoUrl(VideoInfo video) { var data = GetWebData(video.VideoUrl); var videoUrl = ""; var baseDownloadUrl = "http://www.gametrailers.com/feeds/video_download/"; if (data != null && data.Length > 0) { if (regEx_PlaylistUrl != null) { try { var m = regEx_PlaylistUrl.Match(data); while (m.Success) { var contentid = HttpUtility.HtmlDecode(m.Groups["contentid"].Value); var token = HttpUtility.HtmlDecode(m.Groups["token"].Value); var finalDownloadUrl = baseDownloadUrl + contentid + "/" + token; var dataJson = GetWebData(finalDownloadUrl); var o = JObject.Parse(dataJson); videoUrl = o["url"].ToString().Replace("\"", ""); break; } } catch (Exception eVideoUrlRetrieval) { Log.Debug("Error while retrieving Video Url: " + eVideoUrlRetrieval); } return videoUrl; } } return null; }
//protected override CookieContainer GetCookie() //{ // if (OnlyGerman) return base.GetCookie(); // else return null; //} public override string GetVideoUrl(VideoInfo video) { string result = base.GetVideoUrl(video); if (video.PlaybackOptions == null && !string.IsNullOrEmpty(result)) result = Movie2KFilmVideoInfo.getPlaybackUrl(result, this); return result; }
public VideoViewModel(VideoInfo videoInfo, Category category, string siteName, string utilName, bool isDetailsVideo) : base(Consts.KEY_NAME, isDetailsVideo ? ((DetailVideoInfo)videoInfo).Title2 : videoInfo.Title) { VideoInfo = videoInfo; Category = category; SiteName = siteName; SiteUtilName = utilName; IsDetailsVideo = isDetailsVideo; _titleProperty = new WProperty(typeof(string), videoInfo.Title); _title2Property = new WProperty(typeof(string), isDetailsVideo ? ((DetailVideoInfo)videoInfo).Title2 : string.Empty); _descriptionProperty = new WProperty(typeof(string), videoInfo.Description); _lengthProperty = new WProperty(typeof(string), videoInfo.Length); _airdateProperty = new WProperty(typeof(string), videoInfo.Airdate); _thumbnailImageProperty = new WProperty(typeof(string), videoInfo.ThumbnailImage); _contextMenuEntriesProperty = new WProperty(typeof(ItemsList), null); eventDelegator = OnlineVideosAppDomain.Domain.CreateInstanceAndUnwrap(typeof(PropertyChangedDelegator).Assembly.FullName, typeof(PropertyChangedDelegator).FullName) as PropertyChangedDelegator; eventDelegator.InvokeTarget = new PropertyChangedExecutor() { InvokeHandler = (s, e) => { if (e.PropertyName == "ThumbnailImage") ThumbnailImage = (s as VideoInfo).ThumbnailImage; else if (e.PropertyName == "Length") Length = (s as VideoInfo).Length; } }; VideoInfo.PropertyChanged += eventDelegator.EventDelegate; }
public override List<string> GetMultipleVideoUrls(VideoInfo video, bool inPlaylist = false) { string url = GetVideoUrl(video); if (inPlaylist) video.PlaybackOptions.Clear(); return new List<string>() { url }; }
public override List<VideoInfo> GetVideos(Category category) { List<VideoInfo> listVideos = new List<VideoInfo>(); string url = (category as RssLink).Url; string webData = GetWebData((category as RssLink).Url); Regex r = new Regex(@"href=""(?<url>[^""]*)""></a><span\sclass=""play_video""></span>\s*<img\ssrc=""(?<thumb>[^""]*)""\swidth=""120""\sheight=""90""\salt=""""\s/>\s*</div>\s*<p>\s*<strong>(?<title>[^<]*)</strong>\s*<span>(?<description>[^<]*)<br/>(?<description2>[^<]*)</span>\s*</p>", RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.Multiline | RegexOptions.Singleline | RegexOptions.IgnorePatternWhitespace | RegexOptions.ExplicitCapture); Match m = r.Match(webData); while (m.Success) { VideoInfo video = new VideoInfo() { VideoUrl = m.Groups["url"].Value, Title = m.Groups["title"].Value, Thumb = m.Groups["thumb"].Value, Description = m.Groups["description"].Value.Trim() + "\n" + m.Groups["description2"].Value.Trim() }; listVideos.Add(video); m = m.NextMatch(); } return listVideos; }
public override string GetVideoUrl(VideoInfo video) { string res = base.GetVideoUrl(video); if (video.PlaybackOptions != null && video.PlaybackOptions.Count > 1) return video.PlaybackOptions.Last().Value; return res; }
public override string GetVideoUrl(VideoInfo video) { string webData = GetWebData(video.VideoUrl); Match m = regEx_FileUrl.Match(webData); if (m.Success) { string newUrl = m.Groups["m0"].Value + "?authenticity_token=" + HttpUtility.UrlEncode(m.Groups["m1"].Value); webData = GetWebData(newUrl); m = Regex.Match(webData, @"url:\s\\""(?<url>[^\\]*)\\[^{]*{[^{]*{\\n\s*url:\s\\""[^""]*"",\\n\s*netConnectionUrl:\s\\""(?<netConnectionUrl>[^\\]*)\\""", defaultRegexOptions); if (m.Success) { string ncUrl = m.Groups["netConnectionUrl"].Value; string[] parts = ncUrl.Split('/'); string playPath = parts[4]; bool live = webData.Contains("live = true"); if (live) { int p = playPath.IndexOf("stream"); if (p >= 0) playPath = playPath.Insert(p, "/"); } RtmpUrl result = new RtmpUrl(ncUrl) { PlayPath = m.Groups["url"].Value, App = String.Format("{0}/{1}{2}", parts[3], parts[4], m.Groups["m1"].Value), Live = live }; return result.ToString(); } } return String.Empty; }
public override String GetVideoUrl(VideoInfo video) { string data = GetWebData(video.VideoUrl); Match m = regEx_URL.Match(data); if (m.Success) { ut_section_id = m.Groups["ut_section_id"].Value; media_id = m.Groups["media_id"].Value; site_id = m.Groups["site_id"].Value; section_id = m.Groups["section_id"].Value; } data = GetWebData("http://dnevnik.hr/bin/player/?mod=serve&site_id=" + site_id + "&media_id=" + media_id + "&userad_id=§ion_id=" + section_id); m = regEx_URLFile.Match(data); if (m.Success) { FileUrl = m.Groups["FileUrl"].Value; FileServer = m.Groups["FileServer"].Value; FileType = m.Groups["FileType"].Value; if (string.IsNullOrEmpty(FileType)) FileType = "flv"; data = "http://vid" + FileServer + ".dnevnik.hr/" + FileUrl + "-2" + "." + FileType; } return data; }
public override String GetVideoUrl(VideoInfo video) { video.PlaybackOptions = new Dictionary<string, string>(); var html = GetWebData<HtmlDocument>(video.VideoUrl); var itemprop = html.DocumentNode.Descendants("span").FirstOrDefault(s => s.GetAttributeValue("itemprop", "") == "contentUrl"); return itemprop.GetAttributeValue("content", ""); }
public override List<VideoInfo> GetVideos(Category category) { List<VideoInfo> vids = new List<VideoInfo>(); string channelReg = @"<strong>(?<title>.*?)\s-(?<links>.*?)</strong><br />"; string urlReg = @"href=""(?<link>sop://[^""]*)"""; foreach (Match channelMatch in new Regex(channelReg, RegexOptions.Singleline).Matches(category.Other as string)) { int x = 1; string title = channelMatch.Groups["title"].Value; foreach (Match link in new Regex(urlReg).Matches(channelMatch.Groups["links"].Value)) { VideoInfo vid = new VideoInfo(); vid.Title = title; if (x > 1) vid.Title += string.Format(" ({0})", x); vid.VideoUrl = link.Groups["link"].Value; vids.Add(vid); x++; } } return vids; }
/// <summary> /// /// </summary> /// <param name="src">视频源文件</param> public Video(string src) { if (!System.IO.File.Exists(src)) throw new Exception(src + " Not Found."); _Source = src; Info = MediaHelper.GetVideoInfo(src); }
/// <summary> /// 构造函数 /// </summary> /// <param name="bytes">视频文件字节集</param> /// <param name="extension">扩展名(如.png)</param> public Video(byte[] bytes, string extension) { var fname = Path.GetTempPath() + "pomelo_" + Guid.NewGuid().ToString().Replace("-", "") + extension; System.IO.File.WriteAllBytes(fname, bytes); _Source = fname; Info = MediaHelper.GetImageInfo(fname); }
public override List<VideoInfo> GetVideos(Category category) { JArray videos = category.Other as JArray; List<VideoInfo> res = new List<VideoInfo>(); foreach (JToken videoId in videos) { VideoInfo video = new VideoInfo(); string id = videoId.Value<string>(); if (contentList.ContainsKey(id)) { JToken vid = contentList[id]; video.Title = vid["title"].Value<string>(); JToken descr = vid["description"]; if (descr != null) video.Description = descr.Value<string>(); JToken thumb = vid["thumbnailUrl"]; if (thumb != null) video.Thumb = thumb.Value<string>(); video.Length = TimeSpan.FromSeconds(vid["length"].Value<int>() / 1000).ToString(); video.Airdate = epoch.AddSeconds(vid["publishedDate"].Value<double>() / 1000).ToString(); video.VideoUrl = baseUrl + "channels/" + category.Name + "/" + id; video.Other = id; res.Add(video); } } return res; }
public override string GetVideoUrl(VideoInfo video) { Match m = Regex.Match("exp=2575783636001 " + (string)video.Other, @"exp=(?<experienceId>[^\s]+)\s(?<contentId>[^$]+)$"); AMFArray renditions = GetResultsFromViewerExperienceRequest(m, video.VideoUrl); string res = FillPlaybackOptions(video, renditions); int firstDiff = int.MaxValue; int lastDiff = int.MaxValue; if (video.PlaybackOptions != null) { foreach (KeyValuePair<string, string> kv in video.PlaybackOptions) { string url = kv.Value; int i = 0; while (i < url.Length && i < res.Length && url[i] == res[i]) i++; if (i < firstDiff) firstDiff = i; i = 0; while (i < url.Length && i < res.Length && url[url.Length - 1 - i] == res[res.Length - i - 1]) i++; if (i < lastDiff) lastDiff = i; } video.PlaybackOptions = video.PlaybackOptions.ToDictionary(u => u.Key, u => format(firstDiff, lastDiff, u.Value)); } if (firstDiff > 0) return format(firstDiff, lastDiff, res); else return res; }
public override void Play(VideoInfo video) { if (IsPlaying) return; Task.Factory.StartNew(() => { Process process; if (video.IsPlaylist) process = Process.Start(PlayerPath, '"' + video.Uri + '"'); else { string init = '"' + video.Uri + '"'; if (video.ResumePosition > 0) { double n = video.ResumePosition; n /= 1000; init += " --start=\"" + n.ToString(CultureInfo.InvariantCulture) + "\""; } if (video.SubtitlePaths != null && video.SubtitlePaths.Count > 0) { foreach (string s in video.SubtitlePaths) { init += " --sub-file=\"" + s + "\""; } } process = Process.Start(PlayerPath, init); } if (process != null) { IsPlaying = true; process.WaitForExit(); IsPlaying = false; } }); }
public override List<VideoInfo> GetVideos(Category category) { if (true.Equals(category.Other)) //videos in serwisy informacyjne { string sav = videoListRegExFormatString; videoListRegExFormatString = "{0}"; var res = base.GetVideos(category); videoListRegExFormatString = sav; return res; } string webData = GetWebData(((RssLink)category).Url); JObject contentData = JObject.Parse(webData); if (contentData != null) { JArray items = contentData["items"] as JArray; if (items != null) { List<VideoInfo> result = new List<VideoInfo>(); foreach (JToken item in items) if (!item.Value<bool>("payable") && item.Value<int>("play_mode") == 1) { VideoInfo video = new VideoInfo(); video.Title = item.Value<string>("title"); video.VideoUrl = String.Format(videoListRegExFormatString, item.Value<string>("_id")); video.Description = item.Value<string>("description_root"); video.Thumb = getImageUrl(item); video.Airdate = item.Value<string>("publication_start_dt") + ' ' + item.Value<string>("publication_start_hour"); result.Add(video); } return result; } } return null; }
public override String GetVideoUrl(VideoInfo video) { video.PlaybackOptions = new Dictionary<string, string>(); var json = GetWebData<JObject>(video.VideoUrl); foreach (var quality in json["videoJsonPlayer"]["VSR"]) { string qualityName = string.Format("{0} | {1} | {2}", quality.First.Value<string>("versionShortLibelle").PadRight(3), quality.First.Value<string>("mediaType").PadRight(4), quality.First.Value<string>("quality")); if (quality.First.Value<string>("mediaType") == "rtmp") { if (!video.PlaybackOptions.ContainsKey(qualityName)) { string host = quality.First.Value<string>("streamer"); string file = quality.First.Value<string>("url"); string playbackUrl = new MPUrlSourceFilter.RtmpUrl(host) { TcUrl = host, PlayPath = "mp4:" + file }.ToString(); video.PlaybackOptions.Add(qualityName, playbackUrl); } } else if (quality.First.Value<string>("mediaType") == "mp4") { string file = quality.First.Value<string>("url"); video.PlaybackOptions.Add(qualityName, file); } } return video.PlaybackOptions.FirstOrDefault(q => q.Key.Contains(videoQuality.ToString())).Value; }
/// <summary> /// Load the videos for the selected category - will only handle general category types /// </summary> /// <param name="parentCategory"></param> /// <returns></returns> public static List<VideoInfo> LoadGeneralVideos(Category parentCategory) { var doc = new XmlDocument(); var result = new List<VideoInfo>(); var path = "/brandLongFormInfo/allEpisodes/longFormEpisodeInfo"; // default the path for items without series doc.Load(parentCategory.CategoryInformationPage()); if (!string.IsNullOrEmpty(parentCategory.SeriesId())) { path = "/brandLongFormInfo/allSeries/longFormSeriesInfo[seriesNumber='" + parentCategory.SeriesId() + "'] /episodes/longFormEpisodeInfo"; } foreach (XmlNode node in doc.SelectNodes(path)) { var item = new VideoInfo(); item.Title = node.SelectSingleNodeText("title1") + (string.IsNullOrEmpty(node.SelectSingleNodeText("title2")) ? string.Empty : " - ") + node.SelectSingleNodeText("title2"); item.Description = node.SelectSingleNodeText("synopsis"); //item.ImageUrl = Properties.Resources._4OD_RootUrl + node.SelectSingleNodeText("pictureUrl"); item.Thumb = node.SelectSingleNodeText("pictureUrl"); DateTime airDate; if (DateTime.TryParse(node.SelectSingleNodeText("txTime"), out airDate)) item.Airdate = airDate.ToString("dd MMM yyyy"); item.Other = doc.SelectSingleNodeText("/brandLongFormInfo/brandWst") + "~" + node.SelectSingleNodeText("requestId"); result.Add(item); } return result; }
public override string GetVideoUrl(VideoInfo video) { string sContent=GetWebData (string.Format (_urlVideo, GetToken() ,video.Other)); JObject jsonParser= JObject.Parse (sContent); string video_url = (string)jsonParser["video"]["video_url"]; List<String> tUrl = new List<string>(); try { JArray turlArray = (JArray)jsonParser["video"]["medias"]; foreach (JObject item in turlArray ) { tUrl.Add((string)item["video_url"]); } } catch {} if (tUrl.Count > 2) { video.PlaybackOptions = new Dictionary<string, string>(); video.PlaybackOptions.Add("SD", tUrl[tUrl.Count - 2]); video.PlaybackOptions.Add("HD", tUrl[tUrl.Count - 1]); } else { tUrl.Add(video_url); } return tUrl[tUrl.Count - 1]; //for medium in jsonParser['video']['medias']:; // if medium['encoding_rate']>quality:; // quality=medium['encoding_rate']; // video_url=medium['video_url']; // string shls = (string)obj["MEDIA"]["VIDEOS"]["HLS"]; // string webdata = GetWebData(shls); // string rgxstring = @"http:\/\/(?<url>[\w.,?=\/-]*)"; // Regex rgx = new Regex(rgxstring); // var tresult = rgx.Matches(webdata); //List<string> tUrl = new List<string>(); //foreach (Match match in tresult) //{ // tUrl.Add(@"http://" + match.Groups["url"]); //} //if (tUrl.Count > 2) //{ // video.PlaybackOptions = new Dictionary<string, string>(); // video.PlaybackOptions.Add("SD", tUrl[tUrl.Count - 2]); // video.PlaybackOptions.Add("HD", tUrl[tUrl.Count - 1]); //} return video_url; }
public override List<string> GetMultipleVideoUrls(VideoInfo video, bool inPlaylist = false) { List<string> result = new List<string>(); if ("livestream".Equals(video.Other)) { result.Add(video.VideoUrl + "&swfVfy=http://www.rte.ie/player/assets/player_403.swf"); return result; } string xmlData = GetWebData(video.VideoUrl); xmlData = Regex.Replace(xmlData, @"url=""http[^""]*""", @"url="""""); XmlDocument doc = new XmlDocument(); doc.LoadXml(xmlData); XmlNamespaceManager nsmgr = GetNameSpaceManager(doc); XmlNode nd = doc.SelectSingleNode("//a:feed/a:entry/m:group", nsmgr); foreach (XmlNode node in doc.SelectNodes("//a:feed/a:entry/m:group/m:content[@r:format!='advertising']", nsmgr)) { string s = node.Attributes["url"].Value; RtmpUrl rtmpUrl = new RtmpUrl(s) { SwfVerify = true, App = "rtevod", SwfUrl = @"http://www.rte.ie/player/assets/player_403.swf" }; result.Add(rtmpUrl.ToString()); } return result; }
public LocalDeleteFrame(AVSValue args, ScriptEnvironment env) : base(args, env) { vi = GetVideoInfo(); int[] skips = GetSkipFrames(args, env); List<int> f = new List<int>(); int length = vi.num_frames; int skipIdx = 0; for (int i = 0; i < length; i++) { if (skips[skipIdx] == i) { skipIdx++; if (skips.Length <= skipIdx) { skipIdx = 0; } vi.num_frames--; continue; } f.Add(i); } this.frames = f.ToArray(); SetVideoInfo(ref vi); }
public override string GetVideoUrl(VideoInfo video) { if (video.VideoUrl.Contains("series")) video.VideoUrl = WebCache.Instance.GetRedirectedUrl(video.VideoUrl); string data = GetWebData(GetFormattedVideoUrl(video)); XmlDocument doc = new XmlDocument(); doc.LoadXml(data); var vidUrl = doc.SelectSingleNode(@"//Clip/HTTPMediaFiles/HTTPMediaFile").InnerText; var bitrates = doc.SelectNodes(@"//Clip/BitRateLabels/map"); var bitratesDict = new Dictionary<string, string>(); foreach (XmlNode bitrate in bitrates) bitratesDict.Add(bitrate.Attributes["label"].Value, bitrate.Attributes["bitrate"].Value); int p = vidUrl.IndexOf("_none"); int q = vidUrl.LastIndexOf('_', p - 1); if (p >= 0 && q >= 0) { video.PlaybackOptions = new Dictionary<string, string>(); foreach (var bitrate in bitratesDict) video.PlaybackOptions.Add(bitrate.Key, vidUrl.Substring(0, q + 1) + bitrate.Value + vidUrl.Substring(p)); } if (video.PlaybackOptions.Count == 0) return vidUrl; return video.PlaybackOptions.Values.First(); }
private List<VideoInfo> getVideoListForSinglePage(Category category, string url) { List<VideoInfo> result = new List<VideoInfo>(); nextPageUrl = ""; currentCategory = category; string webData = GetWebData(url); if (!string.IsNullOrEmpty(webData)) { foreach (Match m in videoListRegex.Matches(webData)) { VideoInfo info = new VideoInfo(); info.Title = m.Groups["title"].Value; info.Thumb = m.Groups["thumb"].Value; info.Description = m.Groups["description"].Value; info.VideoUrl = m.Groups["clipId"].Value; result.Add(info); } } Match nextPageMatch = nextPageRegex.Match(webData); if (nextPageMatch.Success) { nextPageUrl = string.Format(videoListUrlFormat, baseUrl, nextPageMatch.Groups["binId"], nextPageMatch.Groups["pageNumber"]); } return result; }
List<DetailVideoInfo> IChoice.GetVideoChoices(VideoInfo video) { string url = baseUrl + video.VideoUrl.Replace("/film/", "/play/"); List<DetailVideoInfo> choices = new List<DetailVideoInfo>(); HtmlDocument data = GetWebData<HtmlDocument>(url); HtmlNode doc = data.DocumentNode; url = doc.SelectSingleNode("//source").GetAttributeValue("src", ""); DetailVideoInfo detailNoSub = new DetailVideoInfo(); detailNoSub.Title = video.Title; detailNoSub.Thumb = video.Thumb; detailNoSub.VideoUrl = url; detailNoSub.Title2 = "Ingen textning"; choices.Add(detailNoSub); foreach (HtmlNode track in doc.SelectNodes("//track")) { DetailVideoInfo detail = new DetailVideoInfo(); detail.Title = video.Title; detail.Thumb = video.Thumb; detail.VideoUrl = url; detail.Title2 = "Textning: " + track.GetAttributeValue("label", ""); string sub = GetWebData(baseUrl + track.GetAttributeValue("src", "")); string[] lines = Regex.Split(sub, "\n").Skip(1).ToArray(); detail.SubtitleText = string.Join("\n", lines); choices.Add(detail); } return choices; }
protected override void ExtraVideoMatch(VideoInfo video, GroupCollection matchGroups) { TrackingInfo ti = new TrackingInfo(); // for southpark world System.Text.RegularExpressions.Group epGroup = matchGroups["Episode"]; if (epGroup.Success) ti.Regex = Regex.Match(epGroup.Value, @"(?<Season>\d\d)(?<Episode>\d\d)"); // for nl and de if (ti.Season == 0) ti.Regex = Regex.Match(video.VideoUrl, @"\/S(?<Season>\d{1,3})E(?<Episode>\d{1,3})-", RegexOptions.IgnoreCase); if (ti.Season != 0) { ti.Title = "South Park"; ti.VideoKind = VideoKind.TvSeries; video.Other = new VideoInfoOtherHelper() { TI = ti }; } else video.Other = new VideoInfoOtherHelper(); int time; if (Int32.TryParse(video.Airdate, out time)) { video.Airdate = epoch.AddSeconds(time).ToString(); } }
private List<VideoInfo> getVideos(string url, int startNr) { List<VideoInfo> result = new List<VideoInfo>(); bareUrl = url; newStart = startNr + 24; string webData = GetWebData(String.Format(url + "from={0}&to={1}", startNr, newStart), forceUTF8: true); JToken j = JToken.Parse(webData); /*if (startNr == 0 && false)// only for not a-z { JArray orders = j["filters"]["jarjestys"] as JArray; orderByList = new Dictionary<string, string>(); foreach (JToken order in orders) orderByList.Add(order.Value<string>("key"), order.Value<string>("key")); }*/ JArray videos = j["search"]["results"] as JArray; foreach (JToken jvid in videos) { JToken images = jvid["images"]; VideoInfo video = new VideoInfo() { Title = jvid.Value<string>("title"), Description = jvid.Value<string>("desc"), Length = jvid.Value<string>("durationSec"), Airdate = jvid.Value<string>("published"), Thumb = images.Value<string>("XL"), VideoUrl = String.Format(@"http://areena-v3.yle.fi/tv/{0}.json", jvid.Value<string>("id")) }; result.Add(video); } nextPageAvailable = result.Count >= 24; return result; }
public override string GetVideoUrl(VideoInfo video) { System.Net.WebProxy proxyObj = null; // new System.Net.WebProxy("127.0.0.1", 8118); if (!string.IsNullOrEmpty(proxy)) proxyObj = new System.Net.WebProxy(proxy); string playlist = GetWebData(string.Format(videoUrlFormatString, new System.Uri(video.VideoUrl).AbsolutePath.Substring(1)), proxy: proxyObj); if (playlist.Length > 0) { if (playlist.IndexOf("error_country_block.swf") >= 0) throw new OnlineVideosException("Video blocked for your country."); string url = ""; XmlDocument data = new XmlDocument(); data.LoadXml(playlist); video.PlaybackOptions = new Dictionary<string, string>(); foreach (XmlElement elem in data.SelectNodes("//rendition")) { url = ((XmlElement)elem.SelectSingleNode("src")).InnerText; if (!url.EndsWith(".swf")) { video.PlaybackOptions.Add(string.Format("{0}x{1} | {2} | .{3}", elem.GetAttribute("width"), elem.GetAttribute("height"), elem.GetAttribute("bitrate"), elem.GetAttribute("type").Substring(elem.GetAttribute("type").Length - 3)), url); } } return url; } return ""; }