change contact start end number
This commit is contained in:
@@ -62,5 +62,5 @@ def get_proxy(proxy_type=ProxyType.BRIGHT_DATA):
|
|||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# 修改联系人行,结束联系人行 第三个参数store等于0的时候是随机,传入1的时候是总店
|
# 修改联系人行,结束联系人行 第三个参数store等于0的时候是随机,传入1的时候是总店
|
||||||
# start_book(744, 858, store_choose_state=1, mode=ModeEnum.AUTOMATIC, headless=False)
|
# start_book(744, 858, store_choose_state=1, mode=ModeEnum.AUTOMATIC, headless=False)
|
||||||
start_book(1171, 1387, store_choose_state=1, mode=ModeEnum.AUTOMATIC, headless=False)
|
start_book(1171, 1527, store_choose_state=1, mode=ModeEnum.AUTOMATIC, headless=False)
|
||||||
# recheck_the_captcha_error_contacts(store_type=1, mode=ModeEnum.AUTOMATIC, on_no_contact_found=lambda: None, headless=False)
|
# recheck_the_captcha_error_contacts(store_type=1, mode=ModeEnum.AUTOMATIC, on_no_contact_found=lambda: None, headless=False)
|
||||||
|
|||||||
+27
-31
@@ -9,7 +9,7 @@ from builtins import list
|
|||||||
|
|
||||||
from src import params
|
from src import params
|
||||||
from src.db.mongo_manager import MONGO_STORE_MANAGER
|
from src.db.mongo_manager import MONGO_STORE_MANAGER
|
||||||
from src.pojo.mail.mail_pojo import MailPojo
|
from src.pojo.mail.mail_pojo import MailPojo, MailAddress
|
||||||
from src.proxy.proxy_type import ProxyType
|
from src.proxy.proxy_type import ProxyType
|
||||||
from src.workers.link_validator import LinkValidator
|
from src.workers.link_validator import LinkValidator
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ class MailReader():
|
|||||||
mail_list = []
|
mail_list = []
|
||||||
imap = imaplib.IMAP4_SSL(AOL_IMAP_SERVER)
|
imap = imaplib.IMAP4_SSL(AOL_IMAP_SERVER)
|
||||||
# authenticate
|
# authenticate
|
||||||
imap.login(self.login, password)
|
imap.login(self.login, self.password)
|
||||||
status, messages = imap.select("INBOX")
|
status, messages = imap.select("INBOX")
|
||||||
# total number of emails
|
# total number of emails
|
||||||
messages = int(messages[0])
|
messages = int(messages[0])
|
||||||
@@ -51,8 +51,8 @@ class MailReader():
|
|||||||
from_address, subject_encoded = decode_header(msg.get("From"))[0]
|
from_address, subject_encoded = decode_header(msg.get("From"))[0]
|
||||||
if isinstance(from_address, bytes):
|
if isinstance(from_address, bytes):
|
||||||
from_address = from_address.decode(subject_encoded)
|
from_address = from_address.decode(subject_encoded)
|
||||||
print("Subject:", subject)
|
|
||||||
print("From:", from_address)
|
print("From:", from_address)
|
||||||
|
print("Subject:", subject)
|
||||||
# if the email message is multipart
|
# if the email message is multipart
|
||||||
if msg.is_multipart():
|
if msg.is_multipart():
|
||||||
# iterate over email parts
|
# iterate over email parts
|
||||||
@@ -81,16 +81,8 @@ class MailReader():
|
|||||||
|
|
||||||
hermes_email = "no-reply@hermes.com"
|
hermes_email = "no-reply@hermes.com"
|
||||||
# account credentials
|
# account credentials
|
||||||
# username = "appointment2022@aol.com"
|
username = "appointment2022@aol.com"
|
||||||
# password = "gyilpmvyyvlcaviq"
|
password = "gyilpmvyyvlcaviq"
|
||||||
|
|
||||||
|
|
||||||
username = "chenpeijun@aol.com"
|
|
||||||
password = "ytifuwguknzifqyb"
|
|
||||||
# #
|
|
||||||
#
|
|
||||||
# username = "ciyuexie@aol.com"
|
|
||||||
# password = "czezlmmyypokdfce"
|
|
||||||
|
|
||||||
|
|
||||||
def clean(text):
|
def clean(text):
|
||||||
@@ -121,21 +113,25 @@ def need_to_valid_url(url: str, successful_items) -> bool:
|
|||||||
|
|
||||||
# check whether the url has already been clicked
|
# check whether the url has already been clicked
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
mail_reader = MailReader(username, password)
|
mail_address1 = MailAddress(mail="appointment2022@aol.com", password="gyilpmvyyvlcaviq")
|
||||||
successful_items = MONGO_STORE_MANAGER.get_all_successful_items_for_day()
|
mail_address2 = MailAddress(mail="chenpeijun@aol.com", password="ytifuwguknzifqyb")
|
||||||
list = mail_reader.read_emails()
|
mail_address3 = MailAddress(mail="ciyuexie@aol.com", password="czezlmmyypokdfce")
|
||||||
with ThreadPoolExecutor(max_workers=10) as executor:
|
mail_address4 = MailAddress(mail="hongjiang176@aol.com", password="ftzpscgzvwneelmn")
|
||||||
for mail in list:
|
mail_list = [mail_address3, mail_address2, mail_address1, mail_address4]
|
||||||
match = re.search(VALIDATION_URL_REGEX, mail.body)
|
# mail_list = [mail_address4]
|
||||||
if match:
|
for mail in mail_list:
|
||||||
url = match.group(0)
|
mail_reader = MailReader(mail.mail, mail.password)
|
||||||
if need_to_valid_url(url, successful_items):
|
successful_items = MONGO_STORE_MANAGER.get_all_successful_items_for_day()
|
||||||
url_validator = LinkValidator(url)
|
list = mail_reader.read_emails()
|
||||||
print("need to validate url: " + url)
|
with ThreadPoolExecutor(max_workers=10) as executor:
|
||||||
# .start_page(params.get_proxy(ProxyType.BRIGHT_DATA))
|
for mail in list:
|
||||||
executor.submit(url_validator.start_page, params.get_proxy(ProxyType.BRIGHT_DATA))
|
match = re.search(VALIDATION_URL_REGEX, mail.body)
|
||||||
else:
|
if match:
|
||||||
print("do not need to click url --> {}".format(mail))
|
url = match.group(0)
|
||||||
|
if need_to_valid_url(url, successful_items):
|
||||||
# find link from mails
|
url_validator = LinkValidator(url)
|
||||||
print(list)
|
print("need to validate url: " + url)
|
||||||
|
# .start_page(params.get_proxy(ProxyType.BRIGHT_DATA))
|
||||||
|
executor.submit(url_validator.start_page, params.get_proxy(ProxyType.BRIGHT_DATA), True)
|
||||||
|
else:
|
||||||
|
print("do not need to click url --> {}".format(mail))
|
||||||
|
|||||||
@@ -81,7 +81,8 @@ class LinkValidator:
|
|||||||
self.browser.close()
|
self.browser.close()
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def start_page(self, proxy):
|
def start_page(self, proxy, headless=False):
|
||||||
|
self.headless = headless
|
||||||
self._run(proxy)
|
self._run(proxy)
|
||||||
|
|
||||||
def _on_page_loaded(self):
|
def _on_page_loaded(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user