首页 > 其他 > 详细

抓取页面上的email邮箱

时间:2018-05-12 17:53:02      阅读:216      评论:0      收藏:0      [点我收藏+]
#!/usr/bin/python
#-*- coding:utf-8 -*-
import requests  
import re  

def get_email(url):  
    """get all the email address from the url"""  
    content = requests.get(url).text  
    pattern = r‘[0-9a-zA-Z._]+@[0-9a-zA-Z._]+\.[0-9a-zA-Z._]+‘  
    p = re.compile(pattern)  
    m = p.findall(content)  
    with open(‘emil.txt‘, ‘a‘) as f:  
        for mm in m:  
            f.write(mm+‘\n‘)  
    ‘‘‘‘‘ 
    with open(‘tmp.html‘, ‘w‘) as f: 
        f.writelines(content) 
    ‘‘‘  
if __name__==‘__main__‘:  
    get_email(‘https://www.aliyun.com/jiaocheng/442063.html‘)  

 

抓取页面上的email邮箱

原文:https://www.cnblogs.com/songfucai/p/9029331.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!