舔狗的最高境界,学会Python爬虫让你从舔狗升华到海王

今天给大家带来的就是把舔狗语录,发给你想发给的人,舔一个人是舔狗,舔一群人就是海王了,你连续群发一个月,肯定会脱单。亲测有效【被拉黑】

1e3bbe5a1cb34dfcb15f6957849747d4.jpeg

工具准备
开发工具:pycharm

开发环境:python3.7, Windows11 

使用工具包:requests,smtplib,MIMEText,MIMEMultipart


整个项目分为两大步骤:

1 获取舔狗日记的舔狗语句,选取需要发送的数据信息

2 通过QQ邮箱将话述发送到目标邮箱号

网页的数据加载很简单网页刷新静态加载的数据,直接通过xpath方式提取数据,制作一个非常简单的爬虫功能,对网址发送请求,提取数据,这里就不做过多的介绍,各位看官大佬完成so easy 没有什么特别的地方。

简易源码分享:

  url = 'https://www.nihaowua.com/dog.html'
    response = requests.get(url)
    text = html.xpath('//article/text()')[0]


将数据通过邮箱发送
舔一个叫舔狗,舔一群就是海王,大面积撒出我们的舔网,发送的目标方的邮箱我们设置成列表的形式,只专注的舔一个不符合我们高智商舔狗的身份

tos = ['[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]']


发信的邮箱服务器选择QQ邮箱,在创建发送邮箱对象前需要先配置邮箱服务

c7c7cc93e25a4401aacfb17fa31dabd4.jpeg

点击QQ邮箱设置 在点击账户

6c9bb33716d341c9a67bd18798e42a33.jpeg

开启pop3/stmp服务 生成授权码。

53c042f623e749b88897d9b9d766c526.jpeg

开始通过代码发送邮箱,需要借助几个邮箱发送的工具包:

smtplib 封装发信协议

MIMEText 发送文本内容

MIMEMultipart 创建邮件对象

创建邮件对象,添加邮件内容设置标题,设置发信放,选择发信服务器,使用授权码做发信服务,发送邮箱 发送邮箱是要添加上延时操作不然服务器会判定你是做的邮箱轰炸

简易源码分享

import time
​
import requests
from lxml import etree
​
​
# smtp封装发信协议
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
​
​
​
​
​
# 发送邮箱
​
msg_from = '[email protected]'
passwd = 'fdltqccdspvedegj'
​
tos = ['[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]']
​
while True:
    url = 'https://www.nihaowua.com/dog.html'
    response = requests.get(url)
    html = etree.HTML(response.text)
    # print(response.text)
    # 提取数据  提取数据的方式  xpath   bs4  css正则
    # print(html)
    text = html.xpath('//article/text()')[0]
    print(text)
    for to in tos:
        msg = MIMEMultipart()
        # 添加邮箱内容
        msg.attach(MIMEText(text, 'plain', 'utf-8'))
        msg['Subject'] = '每天想你一千次'
        msg['From'] = msg_from
​
        server = smtplib.SMTP_SSL('smtp.qq.com', 465)
​
        server.login(msg_from, passwd)
​
        server.sendmail(msg_from, to, msg.as_string())
        print('邮件发送成功')
        time.sleep(3)
​
    time.sleep(7200)


各位舔狗们,快去试试吧,希望大家多多支持政胤

政胤工作室期待你的关注a97da7bd0af942abb8f4c9dd914f1945.jpeg

猜你喜欢

转载自blog.csdn.net/m0_69043821/article/details/124773882
今日推荐