作为站长,利用友链搞钱这个事很多人都在做,搞得不错的,一年一千多还是可以的,差一点一年几百块服务器的费用还是能挣回来的。爱链网是一家专门做友链买卖的网站,虽然手续费有点高,但是买家付手续费跟我一点关系都没有。
友链买卖不就是把自己的网站信息挂上去就行了吗?刷新什么?这里就要说一下爱链网的运行方式了,因为每天添加新网站,所以先被添加的网站会被后添加的网站挤到后面去,几个月不管它直接排名最后面,买家看到你的机会就变少了。因此爱链网允许每个月刷新一次,刷新会将你的网站提到前面来,所以刷新的时间很重要。
下面是python代码
#!/usr/bin/python3# -*- coding: UTF-8 -*-import requestsfrom bs4 import BeautifulSoupimport timeimport smtplibfrom email.mime.text import MIMETextfrom email.header import Headerclass alw:def __init__(self,username,password):self.user=usernameself.pwd=passwordself.ye=0self.tkname=''self.header={"Content-Type": 'application/x-www-form-urlencoded; charset=UTF-8',"User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.25 Safari/537.36 Core/1.70.3861.400 QQBrowser/10.7.4313.400"}def login(self):loginurl='https://www.520link.com/Login/CheckLogin'data = {"click":1,"nam":self.user,"pass":self.pwd}self.session = requests.Session()f = self.session.post(loginurl, data=data, headers=self.header)f = self.session.get('https://www.520link.com/sell',headers=self.header)gksoup = BeautifulSoup(f.text, "html")name=gksoup.find('h5').textqwe=gksoup.find("div",attrs={"class":"user-infor-account fr"})ye=qwe.find('span').textself.ye=yeself.tkname=nameprint(name)def shuaxin(self):url='https://www.520link.com/weblist/UpdateTime'mheader={"Content-Type": 'application/x-www-form-urlencoded; charset=UTF-8',"User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.25 Safari/537.36 Core/1.70.3861.400 QQBrowser/10.7.4313.400","Host":"www.520link.com","Origin":"https://www.520link.com","Referer":"https://www.520link.com/weblist"}data={"widSTR":"","wtype":2}f = self.session.post(url, data=data, headers=mheader)print(f.text)return f.textdef sendmail(self,text):mail_host="smtp.163.com" #设置服务器mail_user="你的发信邮箱@163.com" #用户名mail_pass="账号口令" #口令 sender = '发信邮箱@163.com'receivers = ['接收邮箱@qq.com'] # 接收邮件,可设置为你的QQ邮箱或者其他邮箱message = MIMEText(text, 'plain', 'utf-8')message['From'] = Header("代码狗", 'utf-8')message['To'] = Header("测试者", 'utf-8')subject = '友链过期提醒'message['Subject'] = Header(subject, 'utf-8')try:smtpObj = smtplib.SMTP_SSL(mail_host, 465) smtpObj.login(mail_user,mail_pass) smtpObj.sendmail(sender, receivers, message.as_string())print ("邮件发送成功")except smtplib.SMTPException:print ("Error: 无法发送邮件")yl=alw('你的爱链网账号','密码')yl.login()text=yl.shuaxin()
保存成python文件,使用宝塔设置定时任务,执行此文件即可,定时任务命令
python 你的此文件路径
上面的代码用的邮件推送结果,上图是企业微信推送。本来网易云的刷歌签到接口写完了,但是在测试的时候发现好像被拉黑了,需要人工验证,十分尴尬,又TM白写!
原创文章,作者:奋斗,如若转载,请注明出处:https://blog.ytso.com/242512.html