コード例 #1
0
 def __init__(self, task_infos, task_id):
     self.proxy = get_oxylabs_proxy('us',
                                    _city=None,
                                    _session=random.random())['https']
     auth = self.proxy.split("@")[0][7:]
     proxyid = self.proxy.split("@")[1]
     proxyauth_plugin_path = create_proxyauth_extension(
         proxy_host=proxyid.split(":")[0],
         proxy_port=int(proxyid.split(":")[1]),
         proxy_username=auth.split(":")[0],
         proxy_password=auth.split(":")[1])
     self.options = webdriver.ChromeOptions()
     self.task_infos = task_infos
     self.task_id = task_id
     self.target_id = self.task_infos[str(self.task_id)]["asin"]["asin"]
     self.options.add_argument(
         'user-agent="%s"' % json.loads(self.task_infos[str(
             self.task_id)]['account']['header'])['user-agent'])
     self.options.add_extension(proxyauth_plugin_path)
     # self.options.add_argument('--proxy-server=%s' % self.proxy)
     # headless模式
     # self.options.add_argument("--headless")
     # self.options.add_argument('--disable-gpu')
     # 设置不加载图片
     self.options.add_experimental_option(
         'prefs', {"profile.managed_default_content_settings.images": 2})
     self.driver = webdriver.Chrome(options=self.options)
コード例 #2
0
ファイル: register_de.py プロジェクト: kknet/YHZX
 def __init__(self, user_info, proxy, index, register_city):
     # self.proxy = get_oxylabs_proxy('us', _city=None, _session=random.random())['https']
     self.proxy = proxy
     self.index = index
     self.register_city = register_city
     auth = self.proxy.split("@")[0][7:]
     proxyid = self.proxy.split("@")[1]
     proxyauth_plugin_path = tools.create_proxyauth_extension(
         proxy_host=proxyid.split(":")[0],
         proxy_port=int(proxyid.split(":")[1]),
         proxy_username=auth.split(":")[0],
         proxy_password=auth.split(":")[1])
     self.User_Agent = generate_user_agent(device_type="desktop")
     self.chrome_options = Options()
     self.chrome_options.add_extension(proxyauth_plugin_path)
     self.chrome_options.add_argument('user-agent="%s"' % self.User_Agent)
     self.chrome_options.add_argument(
         '--referer=https://www.aliexpress.com')
     #设置无头模式
     # self.chrome_options.add_argument("--headless")
     # self.chrome_options.add_argument('--disable-gpu')
     # 设置不加载图片
     self.chrome_options.add_experimental_option(
         'prefs', {"profile.managed_default_content_settings.images": 2})
     self.driver = webdriver.Chrome(chrome_options=self.chrome_options)
     self.user_info = user_info
     # print('当前正在注册的用户是',self.user_info['data']['email']["login_aliexpress_email"])
     self.password = "******"
     self.index_url = 'http://www.aliexpress.com/'
     self.headers = {"user-agent": self.User_Agent}
コード例 #3
0
ファイル: review_US_multiprocess.py プロジェクト: kknet/YHZX
 def __init__(self, task_id, task_info):
     self.task_id = task_id
     self.task_info = task_info
     self.target_id = self.task_info["asin"]["asin"]
     #OXY代理
     # self.proxy = get_oxylabs_proxy('us', _city=None, _session=random.random())['https']
     #Geosurf代理
     self.proxy = 'http://10502+US+10502-%s:[email protected]:8000' % random.randint(
         200000, 300000)
     auth = self.proxy.split("@")[0][7:]
     proxyid = self.proxy.split("@")[1]
     proxyauth_plugin_path = create_proxyauth_extension(
         proxy_host=proxyid.split(":")[0],
         proxy_port=int(proxyid.split(":")[1]),
         proxy_username=auth.split(":")[0],
         proxy_password=auth.split(":")[1])
     self.options = webdriver.ChromeOptions()
     self.options.add_argument(
         'user-agent="%s"' %
         json.loads(self.task_info['account']['header'])['user-agent'])
     # 代理需要指定账户密码时,添加代理使用这种方式
     self.options.add_extension(proxyauth_plugin_path)
     # 代理不需要指定账户密码时,添加代理使用这种方式
     # self.options.add_argument('--proxy-server=%s' % self.proxy)
     # headless模式
     # self.options.add_argument("--headless")
     # self.options.add_argument('--disable-gpu')
     # 设置不加载图片
     self.options.add_experimental_option(
         'prefs', {"profile.managed_default_content_settings.images": 2})
     self.driver = webdriver.Chrome(options=self.options)
コード例 #4
0
 def __init__(self, task_infos, task_id):
     self.task_infos = task_infos
     self.task_id = task_id
     # register_city = self.task_infos[str(self.task_id)]["account"].get("register_city")
     # register_city_list = register_city.split()
     # if len(register_city_list) > 1:
     #     register_city = '_'.join(register_city_list)
     # proxies = get_oxylabs_proxy('us', _city=register_city, _session=random.random())
     # getIpInfo = get(requests.session(), 'https://ipinfo.io', proxies=proxies)
     # if getIpInfo:
     #     self.proxy = proxies['https']
     #     print('get ip!')
     # else:
     #     self.proxy = get_oxylabs_proxy('us', _city=None, _session=random.random())['https']
     #     print('get ip failed!')
     self.proxy = get_oxylabs_proxy('us',
                                    _city=None,
                                    _session=random.random())['https']
     auth = self.proxy.split("@")[0][7:]
     proxyid = self.proxy.split("@")[1]
     proxyauth_plugin_path = create_proxyauth_extension(
         proxy_host=proxyid.split(":")[0],
         proxy_port=int(proxyid.split(":")[1]),
         proxy_username=auth.split(":")[0],
         proxy_password=auth.split(":")[1])
     self.options = webdriver.ChromeOptions()
     self.options.add_argument(
         'user-agent="%s"' % json.loads(self.task_infos[str(
             self.task_id)]['account']['header'])['user-agent'])
     self.options.add_extension(proxyauth_plugin_path)
     # self.options.add_argument('--proxy-server=%s' % self.proxy)
     #headless模式
     # self.options.add_argument("--headless")
     # self.options.add_argument('--disable-gpu')
     #设置不加载图片
     self.options.add_experimental_option(
         'prefs', {"profile.managed_default_content_settings.images": 2})
     self.driver = webdriver.Chrome(options=self.options)
     self.target_id = self.task_infos[str(self.task_id)]["asin"]["asin"]
     #self.good_detail_urls属性,用于绑定目标商品所在列表页的所有商品的详情链接
     self.good_detail_urls = None
     #self.target_good_detail_url属性,用于绑定目标商品的详情链接
     self.target_good_detail_url = None
コード例 #5
0
 def __init__(self, user_info, proxy):
     # self.proxy = get_oxylabs_proxy('us', _city=None, _session=random.random())['https']
     self.proxy = proxy
     self.user_info = user_info
     auth = self.proxy.split("@")[0][7:]
     proxyid = self.proxy.split("@")[1]
     proxyauth_plugin_path = tools.create_proxyauth_extension(
         proxy_host=proxyid.split(":")[0],
         proxy_port=int(proxyid.split(":")[1]),
         proxy_username=auth.split(":")[0],
         proxy_password=auth.split(":")[1])
     self.chrome_options = Options()
     self.chrome_options.add_extension(proxyauth_plugin_path)
     self.chrome_options.add_argument('user-agent="%s"' % User_Agent)
     #设置无头模式
     # self.chrome_options.add_argument("--headless")
     # self.chrome_options.add_argument('--disable-gpu')
     self.driver = webdriver.Chrome(chrome_options=self.chrome_options)
     # print('当前正在注册的用户是',self.user_info['data']['email']["login_aliexpress_email"])
     self.password = "******"
     self.index_url = 'http://www.aliexpress.com/'
     self.headers = {"user-agent": User_Agent}
コード例 #6
0
 def __init__(self):
     self.proxy = 'http://10502+US+10502-%s:[email protected]:8000' % random.randint(
         200000, 500000)
     auth = self.proxy.split("@")[0][7:]
     proxyid = self.proxy.split("@")[1]
     proxyauth_plugin_path = create_proxyauth_extension(
         proxy_host=proxyid.split(":")[0],
         proxy_port=int(proxyid.split(":")[1]),
         proxy_username=auth.split(":")[0],
         proxy_password=auth.split(":")[1])
     self.options = webdriver.ChromeOptions()
     self.options.add_argument('user-agent="%s"' %
                               generate_user_agent(device_type="desktop"))
     #代理需要指定账户密码时,添加代理使用这种方式
     self.options.add_extension(proxyauth_plugin_path)
     # 代理不需要指定账户密码时,添加代理使用这种方式
     # self.options.add_argument('--proxy-server=%s' % self.proxy)
     #headless模式
     # self.options.add_argument("--headless")
     # self.options.add_argument('--disable-gpu')
     #设置不加载图片
     # self.options.add_experimental_option('prefs',{"profile.managed_default_content_settings.images":2})
     self.driver = webdriver.Chrome(options=self.options)