51 lines
2.0 KiB
Python
51 lines
2.0 KiB
Python
import random
|
|
import time
|
|
from concurrent.futures import as_completed
|
|
from concurrent.futures.thread import ThreadPoolExecutor
|
|
from http.cookies import SimpleCookie
|
|
|
|
from db.mongo_manager import MONGO_STORE_MANAGER
|
|
from excel_reader import read_contacts
|
|
from models.contact_pojo import ContactPojo
|
|
from queue_message.link_validator_receiver import LinkValidatorReceiver
|
|
from queue_message.receiver import Receiver, filter_contacts
|
|
from workers.captcha_result_getter import CaptchaResultGetter, HERMES_REGISTER
|
|
from workers.sender import Sender
|
|
|
|
IPFIY = 'http://api.ipify.org'
|
|
NGROK_TEST = "https://bcc6-193-164-156-53.ngrok-free.app"
|
|
|
|
# def handle_cookie(cookie: str):
|
|
# contact_list = read_contacts('/Users/panlei/Desktop/yahoo_aol_valid_26-1.xlsx')
|
|
# # remove already booked contacts
|
|
# sub_contact_list = filter_contacts(contact_list)
|
|
# random.shuffle(sub_contact_list)
|
|
# # all_task = []
|
|
# # executor = ThreadPoolExecutor(max_workers=2)
|
|
# # urls = [3, 2, 4] # 并不是真的url
|
|
# # all_task = [executor.submit(delegate_sender, (url)) for con in sub_contact_list]
|
|
# with ThreadPoolExecutor(max_workers=2) as executor:
|
|
# for con in sub_contact_list:
|
|
# sender = Sender(cookie)
|
|
# _can_continue = executor.submit(delegate_sender, sender, con)
|
|
# print("_can_continue is {}".format(_can_continue))
|
|
# if not _can_continue:
|
|
# break
|
|
# print("fin")
|
|
# # for future in as_completed(all_task):
|
|
# # data = future.result()
|
|
# # print("in main: get page {}s success".format(data))
|
|
|
|
|
|
if __name__ == '__main__':
|
|
# link_list = MONGO_STORE_MANAGER.get_links_to_validate()
|
|
# # remove already booked contacts
|
|
# random.shuffle(link_list)
|
|
# for l in link_list:
|
|
# print(l)
|
|
|
|
# contact_list = read_contacts('/Users/panlei/Desktop/real_name_contacts_13_01_2024.xlsx')
|
|
# contact_list = filter_contacts(contact_list)
|
|
receiver = LinkValidatorReceiver()
|
|
receiver.run()
|