WindowsFormsApplication1/Form1.cs
(开头部分) 5KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
private static string Path = AppDomain.CurrentDomain.BaseDirectory + "img";
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string url = txturl.Text.Trim();
if (string.IsNullOrEmpty(url))
{
MessageBox.Show("请输入URl");
return;
}
txtimg.AppendText("开始抓取中:\r\n");
Thread th = new Thread(() => ShuaQu(url)) { IsBackground = true };
th.Start();
}
private void ShuaQu(string url)
{
DirectoryInfo di = new DirectoryInfo(Path);
if (System.IO.Directory.Exists(Path))
{
di.Delete(true);
}
System.IO.Directory.CreateDirectory(Path);
//string result = WebHttp.HttpGet(url, null, 3);
string result = GetHttpResponse(url, 6000);
string[] str = GetHtmlImageUrlList(result);
txtimg.Invoke(new Action(() =>
{
txtimg.AppendText("已经获取到数据!" + str.Count() + "\r\n");
}));
//建立获取网页标题正则表达式
String regex = @"<title>.+</title>";
//返回网页标题
String title = Regex.Match(result, regex).ToString();
txttitle.Invoke(new Action(() =>
{
txttitle.Text = Regex.Replace(title, @"[\""]+", "");
后面还有 108 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。