def log_valid(self, y, x): # 获取代理 chrome_options = getproxy.getpro('AU') user = self.data_tool.get_user(self.info_id) print(user) chrome_options.add_argument('user-agent={}'.format(user)) dr = webdriver.Chrome(chrome_options=chrome_options) try: print(self.info_id) dr.set_page_load_timeout(70) # dr.set_window_size(300, 300) dr.set_window_position(y=y, x=x) dr.get( 'https://www.amazon.com.au/ap/signin?_encoding=UTF8&ignoreAuthState=1&openid.assoc_handle=auflex&openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.mode=checkid_setup&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.ns.pape=http%3A%2F%2Fspecs.openid.net%2Fextensions%2Fpape%2F1.0&openid.pape.max_auth_age=0&openid.return_to=https%3A%2F%2Fwww.amazon.com.au%2F%3Fref_%3Dnav_signin&switch_account=') cookies = self.data_tool.get_cookies(self.info_id) with open("cookies.txt", "w") as fp: # json.dump(cookies, fp) fp.write(cookies) with open("cookies.txt", "r") as fp: cookies = json.load(fp) for cookie in cookies: # cookie.pop('domain') # 如果报domain无效的错误 dr.add_cookie(cookie) url_pay = "https://www.amazon.com.au/cpe/managepaymentmethods?ref_=ya_d_c_pmt_mpo" dr.get(url_pay) if 'Password' in dr.page_source: # time.sleep(50) login_wd = self.data_tool.get_info('login_wd', self.info_id) dr.find_element_by_id("ap_password").send_keys(login_wd) dr.find_element_by_xpath( '//*[@id="authportal-main-section"]/div[2]/div/div/form/div/div/div/div[4]/div/div/label/div/label/span').click() dr.find_element_by_id('signInSubmit').click() if 'they are shown in the image below' in dr.page_source: img_url = dr.find_element_by_id('auth-captcha-image').get_attribute('src') par_image(img_url) image_code = get_vircode() dr.find_element_by_id("ap_password").send_keys(login_wd) print(image_code) dr.find_element_by_id("auth-captcha-guess").send_keys(image_code) dr.find_element_by_id('signInSubmit').click() if "Your Amazon Wallet" in dr.page_source: self.sneak_away(dr) if "Your Amazon Wallet" in dr.page_source: self.sneak_away(dr) else: self.sneak_away(dr) # 也有可以不用验证,直接进去的 except: print('###################') dr.quit() return
def log_valid(self, y, x): # 获取代理 chrome_options = getproxy.getpro('DE') dr = webdriver.Chrome(chrome_options=chrome_options) try: print(self.info_id) dr.set_page_load_timeout(70) # dr.set_window_size(300, 300) dr.set_window_position(y=y, x=x) dr.get( 'https://www.amazon.de/ap/signin?_encoding=UTF8&ignoreAuthState=1&openid.assoc_handle=deflex&openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.mode=checkid_setup&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.ns.pape=http%3A%2F%2Fspecs.openid.net%2Fextensions%2Fpape%2F1.0&openid.pape.max_auth_age=0&openid.return_to=https%3A%2F%2Fwww.amazon.de%2F%3Fref_%3Dnav_signin&switch_account=' ) cookies = self.data_tool.get_cookies(self.info_id) with open("cookies.txt", "w") as fp: # json.dump(cookies, fp) fp.write(cookies) with open("cookies.txt", "r") as fp: cookies = json.load(fp) for cookie in cookies: # cookie.pop('domain') # 如果报domain无效的错误 dr.add_cookie(cookie) url_pay = "https://www.amazon.de/cpe/managepaymentmethods?ref_=ya_d_c_pmt_mpo" dr.get(url_pay) if 'Passwort' in dr.page_source: login_wd = self.data_tool.get_info('login_wd', self.info_id) dr.find_element_by_id("ap_password").send_keys(login_wd) dr.find_element_by_xpath( '//*[@id="authportal-main-section"]/div[2]/div/div/form/div/div/div/div[4]/div/div/label/div/label' ).click() dr.find_element_by_id('signInSubmit').click() if 'Mein Amazon Wallet' in dr.page_source: self.sneak_away(dr) else: self.sneak_away(dr) # 也有可以不用验证,直接进去的 except: print('###################') dr.quit() return
def register(self, y, x): # 获取代理 chrome_options = getproxy.getpro('JP') user_agent = self.data_tool.get_user(self.info_id) chrome_options.add_argument('user-agent="{}"'.format(user_agent)) dr = webdriver.Chrome(options=chrome_options) dr.set_page_load_timeout(70) dr.set_window_position(y=y, x=x) url = 'https://www.amazon.co.jp/ap/register?showRememberMe=true&openid.pape.max_auth_age=0&openid.return_to=https%3A%2F%2Fwww.amazon.co.jp%2F%3Fref_%3Dnav_ya_signin&prevRID=T036DZR7KC7QPG98VMPY&openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.assoc_handle=jpflex&openid.mode=checkid_setup&prepopulatedLoginId=&failedSignInCount=0&openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&pageId=jpflex&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0' try: dr.get(url) # 判断是否请求到注册页面 # 'Il tuo nome' if '名前' in dr.page_source: user_name = self.data_tool.get_name(self.info_id) name = dr.find_element_by_id('ap_customer_name') time.sleep(1) name.send_keys(user_name.split(' ')[0]) # user_name = self.data_tool.get_name(self.info_id) name = dr.find_element_by_id('ap_customer_name_pronunciation') time.sleep(1) name.send_keys(user_name.split(' ')[1]) amil_num = self.data_tool.get_reg_info('amil_num', self.info_id) email = dr.find_element_by_id('ap_email') email.send_keys(amil_num) login_wd = amil_num[:5] + '123' password = dr.find_element_by_id('ap_password') password.send_keys(login_wd) password_check = dr.find_element_by_id('ap_password_check') password_check.send_keys(login_wd) # 点击提交 sub = dr.find_element_by_id('continue') sub.click() time.sleep(20) # Inserisci codice if 'コードを入力' in dr.page_source: self.amil_code(dr, amil_num, login_wd) elif "画像に表示されている文字を半角で入力してください" in dr.page_source: password = dr.find_element_by_id('ap_password') password.send_keys(login_wd) time.sleep(1) password_check = dr.find_element_by_id('ap_password_check') password_check.send_keys(login_wd) image_src = dr.find_element_by_id('auth-captcha-image').get_attribute('src') par_image(image_src) image_code = get_vircode() print(image_code) captcha = dr.find_element_by_id('auth-captcha-guess') captcha.send_keys(image_code) sub = dr.find_element_by_id('continue') sub.click() self.amil_code(dr, amil_num, login_wd) else: self.data_tool.update_info(2, login_wd, self.info_id) dr.quit() return # 没有请求到注册页面(网络超时) else: self.data_tool.update_info(2, '请求失败', self.info_id) dr.quit() return except: dr.quit() # self.register(y, x) return
def register(self, y, x): # 获取代理 chrome_options = getproxy.getpro() dr = webdriver.Chrome(options=chrome_options) dr.set_page_load_timeout(70) dr.set_window_size(400, 400) dr.set_window_position(y=y, x=x) url = 'https://www.amazon.fr/ap/register?showRememberMe=true&showRmrMe=1&openid.pape.max_auth_age=0&openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&accountStatusPolicy=P1&pageId=webcs-yourorder&openid.return_to=https%3A%2F%2Fwww.amazon.fr%2Fgp%2Fcss%2Forder-history%3Fie%3DUTF8%26ref_%3Dnav_orders_first&prevRID=55Y7CZ0JN1DX3NWJFX2Q&openid.assoc_handle=frflex&openid.mode=checkid_setup&openid.ns.pape=http%3A%2F%2Fspecs.openid.net%2Fextensions%2Fpape%2F1.0&prepopulatedLoginId=&failedSignInCount=0&openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0' try: dr.get(url) # 判断是否请求到注册页面 if 'Votre nom' in dr.page_source: user_name = self.data_tool.get_name(self.info_id) name = dr.find_element_by_id('ap_customer_name') time.sleep(1) name.send_keys(user_name) amil_num = self.data_tool.get_reg_info('amil_num', self.info_id) email = dr.find_element_by_id('ap_email') email.send_keys(amil_num) login_wd = amil_num[:5] + '123' print(login_wd) password = dr.find_element_by_id('ap_password') password.send_keys(login_wd) password_check = dr.find_element_by_id('ap_password_check') password_check.send_keys(login_wd) # 点击提交 sub = dr.find_element_by_id('continue') sub.click() time.sleep(10) if 'Saisir un code' in dr.page_source: self.amil_code(dr, amil_num, login_wd) elif "sur l'image." in dr.page_source: password = dr.find_element_by_id('ap_password') password.send_keys(login_wd) time.sleep(1) password_check = dr.find_element_by_id('ap_password_check') password_check.send_keys(login_wd) image_src = dr.find_element_by_id( 'auth-captcha-image').get_attribute('src') par_image(image_src) image_code = get_vircode() print(image_code) captcha = dr.find_element_by_id('auth-captcha-guess') captcha.send_keys(image_code) sub = dr.find_element_by_id('continue') sub.click() self.amil_code(dr, amil_num, login_wd) else: self.data_tool.update_info(2, login_wd, self.info_id) dr.quit() return # 没有请求到注册页面(网络超时) else: self.data_tool.update_info(2, '请求失败', self.info_id) dr.quit() return except: dr.quit() self.register(y, x)
def register(self, y, x): # 获取代理 chrome_options = getproxy.getpro('US') user_agent = get_user_agent() # chrome_options.add_argument('--incognito') chrome_options.add_argument('lang=en') chrome_options.add_argument('--user-agent="{}"'.format(user_agent)) dr = webdriver.Chrome(chrome_options=chrome_options) # dr.get('http://geo.geosurf.io/') # time.sleep(20) dr.set_page_load_timeout(70) dr.set_window_position(y=y, x=x) dr.delete_all_cookies() url = 'https://www.amazon.com/ap/register?_encoding=UTF8&openid.assoc_handle=usflex&openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.mode=checkid_setup&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.ns.pape=http%3A%2F%2Fspecs.openid.net%2Fextensions%2Fpape%2F1.0&openid.pape.max_auth_age=0&openid.return_to=https%3A%2F%2Fwww.amazon.com%2Fgp%2Fyourstore%2Fhome%3Fie%3DUTF8%26ref_%3Dnav_custrec_newcust' try: dr.get(url) # 'Il tuo nome' print(self.info_id) if 'Your name' in dr.page_source: user_name = self.data_tool.get_name(self.info_id) name = dr.find_element_by_id('ap_customer_name') time.sleep(1) name.send_keys(user_name.split(' ')[0]) amil_num = self.data_tool.get_reg_info('yahoo_num', self.info_id) email = dr.find_element_by_id('ap_email') email.send_keys(amil_num) login_wd = amil_num[:5] + '123' password = dr.find_element_by_id('ap_password') password.send_keys(login_wd) password_check = dr.find_element_by_id('ap_password_check') password_check.send_keys(login_wd) # 点击提交 sub = dr.find_element_by_id('continue') sub.click() if 'Enter code' in dr.page_source: self.amil_code(dr, amil_num, login_wd) elif "Enter the characters as they are given in the challenge." in dr.page_source: password = dr.find_element_by_id('ap_password') password.send_keys(login_wd) time.sleep(1) password_check = dr.find_element_by_id('ap_password_check') password_check.send_keys(login_wd) image_src = dr.find_element_by_id('auth-captcha-image').get_attribute('src') par_image(image_src) image_code = get_vircode() print(image_code) captcha = dr.find_element_by_id('auth-captcha-guess') captcha.send_keys(image_code) sub = dr.find_element_by_id('continue') sub.click() self.amil_code(dr, amil_num, login_wd) else: self.data_tool.update_info(2, login_wd, self.info_id) dr.quit() return # 没有请求到注册页面(网络超时) else: self.data_tool.update_info(2, '请求失败', self.info_id) dr.quit() return except: dr.quit() # self.register(y, x) return
def register(self, y, x): # 获取代理 chrome_options = getproxy.getpro('AU') dr = webdriver.Chrome(options=chrome_options) dr.set_page_load_timeout(70) dr.set_window_size(300, 300) dr.set_window_position(y=y, x=x) url = 'https://www.amazon.com.au/ap/register?showRememberMe=true&openid.pape.max_auth_age=0&openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&pageId=auflex&ignoreAuthState=1&openid.return_to=https%3A%2F%2Fwww.amazon.com.au%2F%3Fref_%3Dnav_signin&prevRID=CG8QFBCK4TZZQW8E7M3F&openid.assoc_handle=auflex&openid.mode=checkid_setup&openid.ns.pape=http%3A%2F%2Fspecs.openid.net%2Fextensions%2Fpape%2F1.0&prepopulatedLoginId=&failedSignInCount=0&openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0' try: dr.get(url) if 'Your name' in dr.page_source: user_name = self.data_tool.get_name(self.info_id) name = dr.find_element_by_id('ap_customer_name') time.sleep(1) name.send_keys(user_name.split(' ')[0]) amil_num = self.data_tool.get_reg_info('amil_num', self.info_id) email = dr.find_element_by_id('ap_email') email.send_keys(amil_num) login_wd = amil_num[:5] + '123' password = dr.find_element_by_id('ap_password') password.send_keys(login_wd) password_check = dr.find_element_by_id('ap_password_check') password_check.send_keys(login_wd) # 点击提交 sub = dr.find_element_by_id('continue') sub.click() if 'Enter code' in dr.page_source: self.amil_code(dr, amil_num, login_wd) elif "Enter the characters as they are given in the challenge." in dr.page_source: password = dr.find_element_by_id('ap_password') password.send_keys(login_wd) time.sleep(1) password_check = dr.find_element_by_id('ap_password_check') password_check.send_keys(login_wd) image_src = dr.find_element_by_id( 'auth-captcha-image').get_attribute('src') par_image(image_src) image_code = get_vircode() print(image_code) captcha = dr.find_element_by_id('auth-captcha-guess') captcha.send_keys(image_code) sub = dr.find_element_by_id('continue') sub.click() self.amil_code(dr, amil_num, login_wd) else: self.data_tool.update_info(2, login_wd, self.info_id) dr.quit() return # 没有请求到注册页面(网络超时) else: self.data_tool.update_info(2, '请求失败', self.info_id) dr.quit() return except: dr.quit() # self.register(y, x) return