public CefReturnValue OnBeforeResourceLoad(IWebBrowser browser, IRequest request, bool isMainFrame) { string url = request.Url; //Console.WriteLine(url); string ext = Util.GetExtension(url); string newextension = ""; bool found = false; string protocol = "HTTP"; //bool forcedownload = true; //if (forcedownload == true) if (Util.IsLive(ext)) { protocol = "LIVE"; //newextension = "ts"; found = true; } if (domain.Contains("ustream.tv")) { if (url.Contains(".flv?start=")) { Console.WriteLine(url); //http://sjc-ucdn01-comcast-tcdn.ustream.tv/sjc-uhs14/streams/httpflv/ustreamVideo/3849993/streams/live_1_1440823221_1305193735.flv?start=334 string anchor = "ustreamVideo/(?<value>[^/]*?)/streams"; string ustream = "http://iphone-streaming.ustream.tv/uhls/[ID]/streams/live/iphone/playlist.m3u8"; string id = Util.Analyze(url, anchor); ustream = ustream.Replace("[ID]", id); url = ustream; protocol = "LIVE"; found = true; } else if (url.Contains(".flv?e=")) { if (url.Contains("&fs=")) { return(CefReturnValue.Continue); } } else if (url.Contains(".flv")) { return(CefReturnValue.Continue); } } if (checkBox3.Checked == true && found == false) { return(CefReturnValue.Continue); } if (checkBox2.Checked) { new Thread(() => { DownloadData data = new DownloadData { URL = url, Title = this.Text, Folder = domain, Protocol = protocol, Extension = newextension }; var gettor = new SizeGettor(); gettor.data = data; gettor.client = client; gettor.Get(url); }).Start(); //return CefReturnValue.Continue; } if (Util.IsMovie(ext)) { found = true; if (Util.IsLiveDomain(domain)) { found = false; } } if (domain.Contains("twitcasting.tv") && url.Contains("/download/")) { newextension = "mp4"; found = true; } //if (domain.Contains("twitcasting.tv") && url.Contains("/streamserver.php?mode=view")) //{ // if (checkBox1.Checked == true) // { // LiveDownload(); // return CefReturnValue.Continue; // } //} if (url.Contains("get_player_video_info")) { string json = Util.GetHtml(url, Encoding.UTF8); var infos = ULIZA.Uliza(json, domain); foreach (var item in infos) { Download(item); } return(CefReturnValue.Continue); } if ((url.Contains(".ism") && url.Contains("Fragments(video=0)")) || ext == "ism") { if (url.Contains("Fragments(video=0)")) { url = Util.RemoveExtension(url); url = url + ".ism/Manifest"; } if (url == SavedSilverLight) { } else { //http://azrvnsss.video.rakuten.co.jp/ondemand/storage001/X/Z/XZPLOPDHFS/DEhxkW_pc_sd.ism/QualityLevels(698571)/Fragments(video=0) protocol = "ISM"; newextension = "mp4"; found = true; Console.WriteLine(url); } SavedSilverLight = url; } //if (url.Contains("apiPassword="******"filedownload?") || // //letv filedownload // //url.cm apiPassword // found = true; //} if (found == true) { DownloadData data = new DownloadData { URL = url, Title = this.Text, Folder = domain, Protocol = protocol, Extension = newextension }; if (protocol == "LIVE") { this.InvokeOnUiThreadIfRequired(() => SetLiveData(data)); } else { Download(data); } } return(CefReturnValue.Continue); }
public CefReturnValue OnBeforeResourceLoad(IWebBrowser browser, IRequest request, bool isMainFrame) { string url = request.Url; //Console.WriteLine(url); string ext = Util.GetExtension(url); string newextension = ""; bool found = false; string protocol = "HTTP"; //bool forcedownload = true; //if (forcedownload == true) if (Util.IsLive(ext)) { protocol = "LIVE"; //newextension = "ts"; found = true; } if (domain.Contains("ustream.tv")) { if (url.Contains(".flv?start=")) { Console.WriteLine(url); //http://sjc-ucdn01-comcast-tcdn.ustream.tv/sjc-uhs14/streams/httpflv/ustreamVideo/3849993/streams/live_1_1440823221_1305193735.flv?start=334 string anchor = "ustreamVideo/(?<value>[^/]*?)/streams"; string ustream = "http://iphone-streaming.ustream.tv/uhls/[ID]/streams/live/iphone/playlist.m3u8"; string id = Util.Analyze(url, anchor); ustream = ustream.Replace("[ID]", id); url = ustream; protocol = "LIVE"; found = true; } else if (url.Contains(".flv?e=")) { if (url.Contains("&fs=")) { return CefReturnValue.Continue; } } else if (url.Contains(".flv")) { return CefReturnValue.Continue; } } if (checkBox3.Checked == true && found == false) { return CefReturnValue.Continue; } if (checkBox2.Checked) { new Thread(() => { DownloadData data = new DownloadData { URL = url, Title = this.Text, Folder = domain, Protocol = protocol, Extension = newextension }; var gettor = new SizeGettor(); gettor.data = data; gettor.client = client; gettor.Get(url); }).Start(); //return CefReturnValue.Continue; } if (Util.IsMovie(ext)) { found = true; if (Util.IsLiveDomain(domain)) { found = false; } } if (domain.Contains("twitcasting.tv") && url.Contains("/download/")) { newextension = "mp4"; found = true; } //if (domain.Contains("twitcasting.tv") && url.Contains("/streamserver.php?mode=view")) //{ // if (checkBox1.Checked == true) // { // LiveDownload(); // return CefReturnValue.Continue; // } //} if (url.Contains("get_player_video_info")) { string json = Util.GetHtml(url, Encoding.UTF8); var infos = ULIZA.Uliza(json, domain); foreach (var item in infos) { Download(item); } return CefReturnValue.Continue; } if((url.Contains(".ism") && url.Contains("Fragments(video=0)")) || ext == "ism") { if (url.Contains("Fragments(video=0)")) { url = Util.RemoveExtension(url); url = url + ".ism/Manifest"; } if (url == SavedSilverLight) { } else { //http://azrvnsss.video.rakuten.co.jp/ondemand/storage001/X/Z/XZPLOPDHFS/DEhxkW_pc_sd.ism/QualityLevels(698571)/Fragments(video=0) protocol = "ISM"; newextension = "mp4"; found = true; Console.WriteLine(url); } SavedSilverLight = url; } //if (url.Contains("apiPassword="******"filedownload?") || // //letv filedownload // //url.cm apiPassword // found = true; //} if (found == true) { DownloadData data = new DownloadData { URL = url, Title = this.Text, Folder = domain, Protocol = protocol, Extension = newextension }; if (protocol == "LIVE") { this.InvokeOnUiThreadIfRequired(() => SetLiveData(data)); } else { Download(data); } } return CefReturnValue.Continue; }
private void BrowserForm_FormClosing(object sender, FormClosingEventArgs e) { Bookmark.SaveFile(); SizeGettor.Clear(); }