public static List<DownloadData> Uliza(string json, string domain) { var list = new List<DownloadData>(); ULIZAINFO info = JsonConvert.DeserializeObject<ULIZAINFO>(json); string url = info.NET_CONN; string title = info.TITLE; string dir = info.STORAGESUBDIR; foreach (var item in info.PLAYLIST) { string filename = item.NAME; string ext = Util.GetExtension(filename); string T = url; string Y = String.Format("{0}:{1}/{2}", ext, dir, filename); DownloadData data = new DownloadData { URL = url, Title = title, Folder = domain, Protocol = "RTMP", Extension = "", RTMP_T = T, RTMP_Y = Y, }; list.Add(data); } //rtmpdump -r "rtmp://flv.nhk.or.jp/ondemand/flv/mp4:nhk-mov/7b1527cb9377660aa81d869c284e73dd-1_multi_464000_v1.mp4" -s "https://aka-secure-img.uliza.jp/Player/2417/player.swf?d=20150416" -t "rtmp://flv.nhk.or.jp/ondemand/flv/" -y "mp4:nhk-mov/7b1527cb9377660aa81d869c284e73dd-1_multi_464000_v1.mp4" -o filename.mp4 return list; }
public void Add(DownloadData data) { try { Connect(); channel.Add(data); } catch (Exception e) { return; } }
public void AddUrl(DownloadData data) { _dispatcher.BeginInvoke(new Action(() => { viewmodel.AddFile(data); }), (DispatcherPriority)10); }
public void Add(DownloadData data) { window.AddUrl(data); //Console.WriteLine(url); return; }
public void AddFile(DownloadData data) { string extension = ""; string filename = data.URL.Split('/').Last(); if (data.Extension != "") { extension = data.Extension; filename = filename + "." + extension; } else { extension = Util.GetExtension(data.URL); } var file = new DownloadFile { Uri = data.URL, Folder = data.Folder, Filename = filename, Title = data.Title, Protocol = data.Protocol, Extension = extension, Data = data }; downloadFiles.Add(file); OnPropertyChanged("DownloadFiles"); }
public void Download(DownloadData data) { //#### if (checkBox4.Checked) { data.URL = data.URL.Replace(textBox4.Text, textBox5.Text); } new Thread(() => { client.Add(data); }).Start(); }
public void DeleteLiveData() { livedata = null; button4.Enabled = false; button4.BackColor = SystemColors.Control; }
public void SetLiveData(DownloadData data) { livedata = data; button4.Enabled = true; button4.BackColor = Color.Crimson; if (checkBox1.Checked == true) { LiveDownload(); } }
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 void GetLinks() { try { var task = browser.GetSourceAsync(); //task.Start(); task.Wait(1000); if (task.IsCompleted == false) { return; } string html = task.Result; Uri absolute = new Uri(fullurl); string anchor = "src= *\"(?<value>.*?)\""; var list = Util.Analyze2(html, anchor); foreach (var item in list) { string url = item; try { Uri result = new Uri(absolute, url); url = result.AbsoluteUri; } catch { Console.WriteLine(url); continue; } bool found = false; string protocol = "HTTP"; string ext = Util.GetExtension(url); string newextension = ""; if (Util.IsLiveURL(url)) { protocol = "LIVE"; //newextension = "ts"; found = true; } if (Util.IsMovie(ext)) { 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 { if (checkBox3.Checked == false) { Download(data); } } } } HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument(); doc.LoadHtml(html); string links = ""; foreach (HtmlNode link in doc.DocumentNode.SelectNodes("//a[@href]")) { string url = link.Attributes["href"].Value; try { Uri result = new Uri(absolute, url); url = result.AbsoluteUri; } catch { Console.WriteLine(url); continue; } string text = link.InnerText; if (url.Contains(textBox1.Text)) { text = text.Replace('\n', ' '); text = text.Replace('\t', ' '); links += url + "\t" + text + "\n"; } string ext = Util.GetExtension(url); if ((Util.IsMovie(ext) || Util.IsPicture(ext)) && checkBox3.Checked == false) { DownloadData data = new DownloadData { URL = url, Title = this.Text, Folder = domain, Protocol = "HTTP", Extension = "", }; Download(data); } } richTextBox1.Text = links; } catch { } }