网页抓取邮箱

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows.Forms;

namespace WindowsFormsApplication5
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            WebClient web = new WebClient();//抓取网页的类
            web.Encoding = Encoding.Default;//字符串编码方式
            string url = textBox1.Text.Trim();//去除输入网址的空格
            if (!string.IsNullOrEmpty(url))//判读输入网址是否为空
            {
                string html = web.DownloadString(url);//下载网页
                MatchCollection mc = Regex.Matches(html, @"[a-zA-Z0-9_\-\.][email protected]\w+(\.\w+)+");//按正则表达式匹配
                StringBuilder sb = new StringBuilder();//可变字符串序列
                foreach (Match m in mc)
                {
                    sb.AppendLine(m.Value);//将字符追加到当前对象的末尾
                }
                textBox2.Text = sb.ToString();//显示出来
                //File.WriteAllText(@"E:\1.txt", sb.ToString());
                StreamWriter sw = new StreamWriter(@"E:\1.txt", true);//使用写入流保存到txt文档中
                sw.WriteLine(sb.ToString());
            }
        }
    }
}
时间: 2024-08-04 18:31:31

网页抓取邮箱的相关文章

winform网页抓取邮箱单发群发并有附件

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Threading; using System.Net.Mail; using System.Net; u

通过WebClient类来发起请求并下载html 抓取邮箱 图片

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Net; using System.Text.RegularExpressions; using System.IO; namespace 通过WebClient类来发起请求并下载html 抓取邮箱 图片 { class Program { static void Main(string[] args

一个实用的C#网页抓取类代码分享

一个实用的C# 网页抓取类 模拟蜘蛛,类中定义了超多的C#采集文章.网页抓取文章的基础技巧,下面分享代码: using System; using System.Data; using System.Configuration; using System.Net; using System.IO; using System.Text; using System.Collections.Generic; using System.Text.RegularExpressions; using Sys

用Python进行网页抓取

引言 从网页中提取信息的需求日益剧增,其重要性也越来越明显.每隔几周,我自己就想要到网页上提取一些信息.比如上周我们考虑建立一个有关各种数据科学在线课程的欢迎程度和意见的索引.我们不仅需要找出新的课程,还要抓取对课程的评论,对它们进行总结后建立一些衡量指标.这是一个问题或产品,其功效更多地取决于网页抓取和信息提取(数据集)的技术,而非以往我们使用的数据汇总技术. 网页信息提取的方式 从网页中提取信息有一些方法.使用API可能被认为是从网站提取信息的最佳方法.几乎所有的大型网站,像Twitter.

基于Casperjs的网页抓取技术【抓取豆瓣信息网络爬虫实战示例】

CasperJS is a navigation scripting & testing utility for the PhantomJS (WebKit) and SlimerJS (Gecko) headless browsers, written in Javascript. PhantomJS是基于WebKit内核的headless browser SlimerJS则是基于Gecko内核的headless browser Headless browser: 无界面显示的浏览器,可以用于

java中使用 正则 抓取邮箱

我们来抓取豆瓣网的邮箱吧!把这个页面的所有邮箱都抓取下来 如https://www.douban.com/group/topic/8845032/: 代码如下: package cn.zhangzong.test; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.URL; import java.net.URLConnectio

网页抓取:PHP实现网页爬虫方式小结

来源:http://www.ido321.com/1158.html 抓取某一个网页中的内容,需要对DOM树进行解析,找到指定节点后,再抓取我们需要的内容,过程有点繁琐.LZ总结了几种常用的.易于实现的网页抓取方式,如果熟悉JQuery选择器,这几种框架会相当简单. 一.Ganon 项目地址: http://code.google.com/p/ganon/ 文档: http://code.google.com/p/ganon/w/list 测试:抓取我的网站首页所有class属性值是focus的

淘搜索之网页抓取系统分析与实现(2)—redis + scrapy

1.scrapy+redis使用 (1)应用 这里redis与scrapy一起,scrapy作为crawler,而redis作为scrapy的调度器.如架构图中的②所示.图1 架构图 (2)为什么选择redis redis作为调度器的实现仍然和其特性相关,可见<一淘搜索之网页抓取系统分析与实现(1)--redis使用>(http://blog.csdn.net/u012150179/article/details/38226711)中关于redis的分析. 2.redis实现scrapy sc

用python做网页抓取与解析入门笔记[zz]

(from http://chentingpc.me/article/?id=961) 事情的起因是,我做survey的时候搜到了这两本书:Computational Social Network Analysis和Computational Social Network,感觉都蛮不错的,想下载下来看看,但是点开网页发现这个只能分章节下载,晕,我可没时间一章一章下载,想起了迅雷的下载全部链接,试试看,果真可以把他们一网打尽,但是,sadly,迅雷下载的时候,文件名没办法跟章节名对应起来,晕,我可