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

源码网商城

c#实现抓取高清美女妹纸图片

  • 时间:2020-10-17 16:04 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:c#实现抓取高清美女妹纸图片
c#实现抓取高清美女妹纸图片
[url=http://me2-sex.lofter.com/tag/]http://me2-sex.lofter.com/tag/[/url]美女摄影?page=" + pageNum);                 request.Credentials = System.Net.CredentialCache.DefaultCredentials;                 HttpWebResponse response = (HttpWebResponse)request.GetResponse();                 if (response.StatusCode == HttpStatusCode.OK)                 {                     using (StreamReader sr = new StreamReader(response.GetResponseStream()))                     {                         List<Uri> links = FetchLinksFromSource(sr.ReadToEnd());                         Console.WriteLine("=========================" + pageNum + "fatch END==========================");                     }                 }             });         }         private List<Uri> FetchLinksFromSource(string htmlSource)         {             List<Uri> links = new List<Uri>();             string regexImgSrc = @"<img[^>]*?src\s*=\s*[""']?([^'"" >]+?)[ '""][^>]*?>";             MatchCollection matchesImgSrc = Regex.Matches(htmlSource, regexImgSrc, RegexOptions.IgnoreCase | RegexOptions.Singleline);             foreach (Match m in matchesImgSrc)             {                 string href = m.Groups[1].Value;                 if (CheckIsUrlFormat(href))                 {                     links.Add(new Uri(href));                     Console.WriteLine(href);                 }                 else                     continue;                 using (WebClient myWebClient = new WebClient())                 {                     try                     {                         myWebClient.DownloadFile(new Uri(href), System.IO.Path.Combine(globePath, System.IO.Path.GetRandomFileName() + System.IO.Path.GetExtension(href)));                     }                     catch (Exception ex)                     {                         Console.WriteLine(ex.Message);                     }                 }             }             return links;         }
以上就是本文的全部内容了,大家可以自由扩展哦,你懂得,希望大家能够喜欢。
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部