diff --git a/HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/HaoYue.CQTVShow.Hub.csproj b/HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/HaoYue.CQTVShow.Hub.csproj index 78509c1..21282bd 100644 --- a/HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/HaoYue.CQTVShow.Hub.csproj +++ b/HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/HaoYue.CQTVShow.Hub.csproj @@ -64,6 +64,7 @@ MSBuild:Compile Designer + MSBuild:Compile @@ -103,5 +104,8 @@ Settings.Designer.cs + + + \ No newline at end of file diff --git a/HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/HtmlDoIt.cs b/HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/HtmlDoIt.cs index 7dd5dda..53c36e1 100644 --- a/HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/HtmlDoIt.cs +++ b/HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/HtmlDoIt.cs @@ -11,7 +11,7 @@ namespace HaoYue.CQTVShow.Hub { public static class HtmlDoIt { - public static string GetShowList(int type,int pageindex) + public static bool GetShowList(int type,int pageindex) { string url = ""; if (type == 0) @@ -36,31 +36,38 @@ namespace HaoYue.CQTVShow.Hub } HtmlWeb htmlweb = new HtmlWeb(); - HtmlDocument htmldoc = htmlweb.Load(url); - HtmlNodeCollection hnc = htmldoc.DocumentNode.SelectNodes("//div[@class='main']/ul/li"); - - StaticClass.StaticShowList = new List(); - //这个下标貌似是从1开始的 - for (int i = 1; i <= hnc.Count; i++) + try { + HtmlDocument htmldoc = htmlweb.Load(url); + HtmlNodeCollection hnc = htmldoc.DocumentNode.SelectNodes("//div[@class='main']/ul/li"); - if (htmldoc.DocumentNode.SelectNodes("//div[@class='main']/ul/li[" + i + "]") != null) + StaticClass.StaticShowList = new List(); + //这个下标貌似是从1开始的 + for (int i = 1; i <= hnc.Count; i++) { - StaticShow ss = new StaticShow(); - ss.Title = htmldoc.DocumentNode.SelectNodes("//div[@class='main']/ul/li[" + i + "]/a")[0].Attributes["Title"].Value; - ss.ToPath = htmldoc.DocumentNode.SelectNodes("//div[@class='main']/ul/li[" + i + "]/a")[0].Attributes["href"].Value; - //取值 - ss.Time = htmldoc.DocumentNode.SelectNodes("//div[@class='main']/ul/li[" + i + "]/a/div/span")[0].InnerHtml; - //读取img标签的src - ss.ImageSrc = htmldoc.DocumentNode.SelectNodes("//div[@class='main']/ul/li[" + i + "]/a/div/img")[0].Attributes["src"].Value; + if (htmldoc.DocumentNode.SelectNodes("//div[@class='main']/ul/li[" + i + "]") != null) + { + StaticShow ss = new StaticShow(); + ss.Title = htmldoc.DocumentNode.SelectNodes("//div[@class='main']/ul/li[" + i + "]/a")[0].Attributes["Title"].Value; + + ss.ToPath = htmldoc.DocumentNode.SelectNodes("//div[@class='main']/ul/li[" + i + "]/a")[0].Attributes["href"].Value; + //取值 + ss.Time = htmldoc.DocumentNode.SelectNodes("//div[@class='main']/ul/li[" + i + "]/a/div/span")[0].InnerHtml; + //读取img标签的src + ss.ImageSrc = htmldoc.DocumentNode.SelectNodes("//div[@class='main']/ul/li[" + i + "]/a/div/img")[0].Attributes["src"].Value; + + StaticClass.StaticShowList.Add(ss); + } - StaticClass.StaticShowList.Add(ss); } - + return true; + } + catch + { + return false; } - return ""; } public static ShowInfo GetShowInfo(string url) @@ -90,7 +97,7 @@ namespace HaoYue.CQTVShow.Hub var hdm3u8 = list.Where(w => w.filetype == 1 && w.Path.Contains("b5000")).FirstOrDefault(); if (hdm3u8 != null) { - si.PlayNormalM3u8Url = si.PlayListM3u8Url.Substring(0, si.PlayListM3u8Url.LastIndexOf("/")+1) + normalm3u8.Path; + si.PlayHDM3u8Url = si.PlayListM3u8Url.Substring(0, si.PlayListM3u8Url.LastIndexOf("/")+1) + hdm3u8.Path; } return si; diff --git a/HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/MainWindow.xaml b/HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/MainWindow.xaml index cd74292..7989794 100644 --- a/HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/MainWindow.xaml +++ b/HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/MainWindow.xaml @@ -7,9 +7,15 @@ xmlns:controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro" mc:Ignorable="d" - Title="皓月云-重庆电视台本土节目播放器" Height="621" Width="1039.5" Background="#FFFFFF"> + Title="皓月云-重庆电视台本土节目播放器 0.1.0 预览版" Height="645" Width="765.5" + + MaxHeight="645" MaxWidth="765.5" + MinHeight="645" MinWidth="765.5" + Background="#FFFFFF"> - @@ -38,7 +44,7 @@ -