代码拉取完成,页面将自动刷新
同步操作将从 troyld/Nyspider 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#coding:utf-8
import requests
import os
import sqlite3
import xlwt3
from email import encoders
from email.header import Header
from email.mime.text import MIMEText
from email.utils import parseaddr,formataddr
import smtplib
import datetime
headers = {
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "en-US,en;q=0.5",
"Connection": "keep-alive",
"User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:39.0) Gecko/20100101 Firefox/39.0"}
def get_image(image_url,image_name):
content=requests.get(image_url,headers=headers).content
with open(image_name,'wb') as f:
f.write(content)
f.close
def to_Excel():
for filename in os.listdir('.'):
if(filename.endswith('txt')):
f_d=open(filename,'r')
f_ex=xlwt3.Workbook()
sheet=f_ex.add_sheet('one')
count=0
for line in f_d.readlines():
lists=line.split('|')
try:
num=0
for text in lists:
sheet.write(count,num,text)
num+=1
count+=1
except:
sheet=f_ex.add_sheet('two')
count=0
num=0
for text in lists:
sheet.write(count,num,text)
num+=1
count+=1
f_ex.save(filename.replace('txt','xls'))
def send_email(email,subject,text,user,passwd):
smtp_server='smtp.126.com'
msg = MIMEText(text, 'plain', 'utf-8')
msg['Subject']=subject
msg['From'] = _format_addr(user)
msg['To'] = _format_addr(email)
server = smtplib.SMTP(smtp_server, 25)
server.set_debuglevel(1)
server.login(user, passwd)
server.sendmail(user, [email], msg.as_string())
server.quit()
def convert_html(html):
return html.encode('ISO-8859-1').decode('utf-8','ignore')
def Duplicate():
for filename in os.listdir('.'):
if filename.endswith('txt'):
lines=open(filename,'r').readlines()
lines=list(set(lines))
lines.sort()
f=open(filename,'w')
for line in lines:
f.write(line)
f.close()
def yesterday_get(today=datetime.datetime.now()):
oneday = datetime.timedelta(days=1)
yesterday = today- oneday
return yesterday
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。