源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

不使用qvod播放器获取qvod播放路径的方法

  • 时间:2022-03-04 22:43 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:不使用qvod播放器获取qvod播放路径的方法
[u]复制代码[/u] 代码如下:
static string GetHtml(string url)         {             HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;             request.Timeout = 16 * 1000;             HttpWebResponse response = request.GetResponse() as HttpWebResponse;                        Stream stream = response.GetResponseStream();             StreamReader reader = new StreamReader(stream, Encoding.Default);             string html = reader.ReadToEnd();             stream.Close();             return html;         }         static string FiltHtml(string htmlStr)         {             var jsurl = Regex.Match(htmlStr, "(?<=<script type=\"text/javascript\" src=\"/playdata/).*?(?=\"></script>)").Value;             var title = Regex.Match(htmlStr, "(?<=<title>正在播放).*?(?=xxx</title>)").Value;             var wildQvod = GetHtml(string.Format("http://xxx.com/playdata/{0}", jsurl));             var qvod = Regex.Match(wildQvod,@"(?<=\$).*?(?=\$)").Value;             return string.Format("{0}:{1}", title,qvod);         }         static void Main(string[] args)         {             StreamWriter sw = new StreamWriter(@"D:\g.txt", true, Encoding.Unicode);             sw.AutoFlush = true;             var startNum = 787;             for (var i = 0; i < 3000; i++)             {                 try                 {                     var startUrl = string.Format("http://xxx.com/player/index{0}-0-0.html", startNum + i);                     var wildHtml = GetHtml(startUrl);                     var oneData = FiltHtml(wildHtml);                     oneData = string.Format("{0}:{1}", startNum + i, oneData);                     sw.WriteLine(oneData);                     Console.WriteLine(oneData);                     System.Threading.Thread.Sleep(2000);                 }                 catch                 {                     var oneData = string.Format("{0}:出错了", i + startNum);                     Console.WriteLine(oneData);                     sw.WriteLine(oneData);                 }             }             sw.Close();             Console.ReadKey();         }
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部