要爬取一个网站的邮箱,可以使用Python的requests和BeautifulSoup库来实现。以下是一个示例代码:

import requests
from bs4 import BeautifulSoup
import re

url = 'https://mehy-eg.com/our-partners/waters/'

# 发送GET请求获取网页内容
response = requests.get(url)

# 使用BeautifulSoup解析网页内容
soup = BeautifulSoup(response.text, 'html.parser')

# 使用正则表达式提取邮箱
email_pattern = re.compile(r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b')
emails = []

# 在网页内容中查找匹配的邮箱
for match in re.finditer(email_pattern, response.text):
    emails.append(match.group())

# 输出找到的邮箱
for email in emails:
    print(email)

请注意,这段代码只会爬取网页中以文本形式呈现的邮箱,对于图像、JavaScript等无法直接提取。此外,爬取网站信息时要遵守法律法规和网站的使用规则,确保不侵犯他人的隐私和权益

python 爬取httpsmehy-egcomour-partnerswaters的邮箱

原文地址: https://www.cveoy.top/t/topic/ijIX 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录