Commit a5d9e39e authored by lixiaofang's avatar lixiaofang

add

parent 956c7cec
......@@ -67,6 +67,7 @@ if __name__ == "__main__":
if cookies is not None:
follow(cookies, id)
time.sleep(60)
except:
......
import requests
import time
import datetime
import pymysql
import random
import pandas as pd
import traceback
from log_settings import *
import logging
from auto_request import login, time_convs, follow
from auto_request import host, user, port, db, passwd
##做不了
def get_follw_majia(numtime):
try:
pc = pymysql.connect(host=host, user=user, passwd=passwd, db=db, port=3306)
cursor = pc.cursor()
cursor.execute(
"select temp1.user_id,temp1.email,temp2.user_id from account_user_auth temp1 left join (select user_id,follow_id,create_time from user_follow) temp2 on temp1.user_id = temp2.follow_id where temp1.email in ('s_05tmwu@shadow.com','s_07CRHt@shadow.com','s_0bdxxU@shadow.com','s_0mfxcO@shadow.com','s_0u6eaV@shadow.com','s_0UudEr@shadow.com','s_1b3v5V@shadow.com','s_ZVuLyC@shadow.com','s_1dbAoA@shadow.com','s_1dholX@shadow.com','s_1EpLlt@shadow.com') and temp2.create_time like '%%%%%s%%%%' " % (
numtime))
data = cursor.fetchall()
data = list(data)
logging.info("Database version : %s " % data)
pc.close()
return data
except:
logging.error("catch exception,get_data:%s" % traceback.format_exc())
return []
if __name__ == "__main__":
try:
numtime1,numtime2 = time_convs(1,2)
data = get_follw_majia(numtime1)
dict_follow_id = {}
for j in data and data:
if j[2] != None:
if j[0] not in dict_follow_id.keys():
dict_follow_id.setdefault(j[0], [])
dict_follow_id[j[0]].append(j[2])
else:
dict_follow_id[j[0]].append(j[2])
dict_email = {}
for j in data and data:
if j[2] != None:
if j[0] not in dict_email.keys():
dict_email.setdefault(j[0], [])
dict_email[j[0]].append(j[1])
else:
dict_email[j[0]].append(j[1])
for key, value in dict_follow_id.items():
id = dict_email[key][0]
for i in value:
cookies = login(id)
if cookies is not None:
follow(cookies, i)
except:
logging.error("catch exception,main:%s" % traceback.format_exc())
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment