def __init__(self,keyword,id):
     self.options = webdriver.ChromeOptions()
     self.options.add_argument('user-agent="%s"' % json.loads(item[4])['user-agent'] )
     self.driver = webdriver.Chrome(options=self.options)
     self.keyword = keyword
     self.id = id
     #self.good_detail_urls属性,用于存放目标商品所在列表页的所有商品的详情链接
     self.good_detail_urls = None
     #self.target_good_detail_url属性,用于绑定目标商品的详情链接
     self.target_good_detail_url = None
     # print('user-agent="%s"' % json.loads(item[4])['user-agent'])
     self.logger = logger('order')
示例#2
0
 def __init__(self):
     self.logger = logger('register')
     # self.proxy = get_oxylabs_proxy('us',_city=None,_session=random.random())['https']
     self.User_Agent = generate_user_agent(device_type="desktop")
     self.options = webdriver.ChromeOptions()
     # self.options.add_argument('--start-maximized') #窗口最大化
     self.options.add_argument('user-agent="%s"' % self.User_Agent)
     # print('user-agent="%s"' % self.User_Agent)
     # self.options.add_argument("--headless")
     # self.options.add_argument('--disable-gpu')
     self.driver = webdriver.Chrome(chrome_options=self.options)
     self.email = "".join(
         random.sample(self.digit_list, 3) +
         random.sample(self.digit_list, 3) +
         random.sample(self.digit_list, 4)) + "@qq.com"
     # print('当前正在注册的用户是',self.email)
     self.logger.info('当前正在注册的用户是:%s' % self.email)
     self.password = "******"
     self.index_url = 'http://www.aliexpress.com/'
     self.headers = {
         "user-agent": self.User_Agent
         # "user-agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.119 Safari/537.36"
     }
     self.mysql_helper = Mysql_helper()
示例#3
0
import sys
import threading
import time
import requests
from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.common.exceptions import TimeoutException, NoSuchFrameException, NoSuchElementException, \
    WebDriverException
from mytools.tools import get_oxylabs_proxy, get
from mytools.utils import logger

logger = logger('review')
class AliexpressReviewSpider():

    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 = self.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
import datetime
import requests
from lxml import etree
from selenium import webdriver
from selenium.webdriver.support.select import Select
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver import ActionChains
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.common.exceptions import StaleElementReferenceException, NoSuchElementException, TimeoutException, \
    NoSuchFrameException, WebDriverException
from mytools.tools import get_oxylabs_proxy, get
from mytools.utils import logger

logger = logger('place_order')


class AliexpressOrderSpider():
    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 = self.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()