Пример #1
0
	def __init__(self, width = 500, height = 300):
		"""
		抖音App视频下载
		"""
		# 无头浏览器
		chrome_options = Options()
		chrome_options.add_argument('user-agent="Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"')
		self.driver = Browser(driver_name='chrome', executable_path='D:/chromedriver', options=chrome_options, headless=True)
Пример #2
0
 def __init__(self, width = 500, height = 300):
       """
       抖音App视频下载
       """
       # 无头浏览器
       chrome_options = Options()
       chrome_options.add_argument('user-agent="Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"')
       self.driver = Browser(driver_name='chrome', executable_path='D:/chromedriver', options=chrome_options, headless=True)
Пример #3
0
 def __init__(self, width=500, height=300):
     """
     抖音App视频下载
     """
     # 无头浏览器
     chrome_options = Options()
     chrome_options.add_argument(
         'user-agent="Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"'
     )
Пример #4
0
 def __init__(self, width = 500, height = 300):
     """
     抖音视频下载
     :param width:
     :param height:
     """
     chrome_options = Options()
     chrome_options.add_argument('user-agent="Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"')
     self.driver = Browser(driver_name='chrome', executable_path='D:\Program Files\Python3\Scripts\chromedriver.exe', options=chrome_options, headless=True)
Пример #5
0
    def __init__(self,
                 addr,
                 browser_window_size=(1920, 1080),
                 page_load_timeout=30,
                 sticky_timeout=30):
        setupterm()

        if os.path.isfile('/.docker'):
            # xvfb wrapper starting
            print('Using Xvfb')
            kwargs = {}
            if 'XVFB_WIDTH' in os.environ:
                kwargs['width'] = os.environ['XVFB_WIDTH']
            if 'XVFB_HEIGHT' in os.environ:
                kwargs['height'] = os.environ['XVFB_HEIGHT']
            self.xvfb = Xvfb(**kwargs)
            self.xvfb.start()

        options = Options()
        options.add_argument('--no-sandbox')
        self.browser = Browser('chrome',
                               headless=False,
                               options=options,
                               wait_time=30,
                               executable_path='./drivers/chromedriver')
        self.browser.driver.implicitly_wait(sticky_timeout)
        self.browser.driver.set_page_load_timeout(page_load_timeout)
        self.browser.driver.set_window_size(*browser_window_size)
        self.browser.visit(addr)

        self._failed_number = 0
        self._succeeded_number = 0

        self._red = tparm(tigetstr('setaf'), 1).decode('utf8')
        self._green = tparm(tigetstr('setaf'), 2).decode('utf8')
        self._reset = tparm(tigetstr('sgr0')).decode('utf8')

        self._pre_test_cases = []
        self._test_cases = []
        self._post_test_cases = []
        for method in self.__ordered__:  # pylint: disable=no-member
            if method.startswith('test_'):
                self._test_cases.append(method)
Пример #6
0
 def setproxy(self):
     if self.proxy_info:
         [host, port] = self.proxy_info.split(":")
         if self.webdriver == 'firefox':
             proxy_settings = {
                 'network.proxy.type': 1,
                 'network.proxy.http': host,
                 'network.proxy.http_port': int(port),
                 'network.proxy.ssl': host,
                 'network.proxy.ssl_port': int(port),
                 'network.proxy.socks': host,
                 'network.proxy.socks_port': int(port),
                 'network.proxy.ftp': host,
                 'network.proxy.ftp_port': int(port)
             }
             return proxy_settings
         elif self.webdriver == 'chrome':
             chrome_options = Options()
             chrome_options.add_argument('--proxy-server=http://%s' %
                                         self.proxy_info)
             return chrome_options
     else:
         return None
 def __init__(self):
     options = Options()
     # options.add_argument('--disable-accelerated-2d-canvas')
     options.add_argument('--disable-gpu')
     options.add_argument('--user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36')
     self.browser = Browser("chrome", options=options)
Пример #8
0
        def __init__(self, width = 500, height = 300):
		# 无头浏览器
                chrome_options = Options()
                chrome_options.add_argument('user-agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36"')
                self.driver = Browser(driver_name='chrome', executable_path='D:/chromedriver', options=chrome_options, headless=True)