爬虫使用代理IP视频抓取!爬虫 视频,现在写爬虫的语言很多,常见的都是用c语言,php等等,但是爬虫抓取数据最重要的还是代理ip,为什么黑洞HTTP软件做业务的成功率就会很高,下面我来介绍一下。
多线程爬取网页代码:
System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.IO;using System.Linq;using System.Text;using System.Text.RegularExpressions;using System.Threading;using System.Threading.Tasks;using System.Windows.Forms;using Utils;
namespace 爬虫{ public partial class Form1 : Form { List threadList = new List(); Thread thread = null;
public Form1() { InitializeComponent(); }
private void button1_Click(object sender, EventArgs e) { DateTime dtStart = DateTime.Now; button3.Enabled = true; button2.Enabled = true; button1.Enabled = false; int page = 0; int count = 0; int personCount = 0; lblPage.Text = "已完成页数:0"; int index = 0;
for (int i = 1; i <= 10; i++) { thread = new Thread(new ParameterizedThreadStart(delegate(object obj) { for (int j = 1; j <= 10; j++) { try { index = (Convert.ToInt32(obj) - 1) * 10 + j; string pageHtml = HttpRequestUtil.GetPageHtml("http://tt.mop.com/c44/0/1_" + index.ToString() + ".html"); Regex regA = new Regex(" 0) { lblSpeed.Text = "速度:" + (count / time).ToString("0.0") + "张/秒"; } })); } catch { } Thread.Sleep(1); } } } } } catch { } page++; lblPage.Invoke(new Action(delegate() { lblPage.Text = "已完成页数:" + page.ToString(); }));
if (page == 100) { button1.Invoke(new Action(delegate() { button1.Enabled = true; })); MessageBox.Show("完成!"); } } })); thread.Start(i); threadList.Add(thread); } } private void button2_Click(object sender, EventArgs e) { button1.Invoke(new Action(delegate() { foreach (Thread thread in threadList) { if (thread.ThreadState == ThreadState.Suspended) { thread.Resume(); } thread.Abort(); } button1.Enabled = true; button2.Enabled = false; button3.Enabled = false; button4.Enabled = false; })); } private void Form1_FormClosing(object sender, FormClosingEventArgs e) { foreach (Thread thread in threadList) { thread.Abort(); } } private void button3_Click(object sender, EventArgs e) { foreach (Thread thread in threadList) { if (thread.ThreadState == ThreadState.Running) { thread.Suspend(); } } button3.Enabled = false; button4.Enabled = true; } private void button4_Click(object sender, EventArgs e) { foreach (Thread thread in threadList) { if (thread.ThreadState == ThreadState.Suspended) { thread.Resume(); } } button3.Enabled = true; button4.Enabled = false; } }}
使用我们的黑洞HTTP有哪些优势?
1分布式代理IP数万代理IP节点分布全国各个省市,IP段无重复。
2支持多线程高并发使用。
3家庭宽带线路所有资源均来自家庭宽带终端,IP绿色纯净,适用所有项目。
4多项使用授权使用代理IP时需要用户名密码或IP白名单绑定,后台自由切换。
5长效+HTTPS所有代理IP支持HTTPS协议,使用无需客户端支持,代理IP平均使用时长高达4小时
相关资讯
相关文章内容简介
1 爬虫使用代理IP视频抓取
爬虫使用代理IP视频抓取!爬虫 视频,现在写爬虫的语言很多,常见的都是用c语言,php等等,但是爬虫抓取数据最重要的还是代理ip,为什么黑洞HTTP软件做业务的成功率就会很高,下面我来介绍一下。 多线程爬取网页代码: System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.IO;using System.Linq;using System.Text;using System.Text.RegularExpressions;using System.Threading;using System.Threading.Tasks;using System.Windows.Forms;using Utils; [阅读全文]
推荐阅读
12
2018-09
http代理是什么?http代理ip怎么用?
http代理是什么?HTTP协议即超文本传输协议,是Internet上行信息传输时使用最为广泛的一种非常简单的通信协议。部分局域网对协议进行了限制,只允许用户通过HTTP协议访问外部网站。
12
2019-07
如何使用代理ip保证爬虫顺利完成工作
我们在进行网络爬虫业务时,常会碰到一些问题,不是返回一些乱七八糟的状态码,就是限制我们的ip地址,甚至封ip,或是什么内容都不返回,让我们自己来猜测。所以,网络爬虫工作这么的
23
2019-11
免费代理ip给爬虫使用有什么危害?
网络爬虫采集应该使用什么代理ip,很多用户问,免费的代理ip可以用来做爬虫采集代理ip吗?其实对于一个搞技术的工作人员来说,网速获取一些免费的代理ip是非常轻松的,网上也有很多代理i
02
2019-04
爬虫过程中的代理ip使用(1)
在实际的爬虫抓取的过程中,由于会存在恶意采集或者恶意攻击的情况,很多网站都会设置相应的防爬取机制,通常防爬程序都是通过ip来识别机器人用户的,因此充足可用的ip信息可以为我们
11
2019-11
HTTP协议的工作原理和代理IP关系
我们打开浏览器,输入网址,然后就看到了网页,这是我们上网经常做的事情,那么原理是什么呢?
06
2019-11
网络IP限制该怎么办?
网络IP限制大家应该都遇见过,随着使用网络的人增多,平台都会有一些限制,来规范使用,当出现限制就无法再继续访问该网站,只有换IP才能解决。
热门文章
注意: 严禁一切违规违法的业务,一经发现直接封帐号
Powered by wanchen tech. © | 粤ICP备18047396号-6 广州万宸软件科技有限公司http代理 版权所有