Пример #1
0
 def set_item_queue(self, url, proxy, score, incr, speed=0):
     items = list()
     tasks = self.https_tasks if 'https' in url else self.http_tasks
     # todo set proxy to tmp_queue
     for task in tasks:
         score_item = ProxyScoreItem(url=proxy, score=score, incr=incr)
         ttl_item = ProxyVerifiedTimeItem(url=proxy, verified_time=int(time.time()), incr=incr)
         speed_item = ProxySpeedItem(url=proxy, response_time=speed, incr=incr)
         score_item['queue'] = SCORE_MAPS.get(task)
         ttl_item['queue'] = TTL_MAPS.get(task)
         speed_item['queue'] = SPEED_MAPS.get(task)
         items.append(score_item)
         items.append(ttl_item)
         items.append(speed_item)
     return items
Пример #2
0
 def set_item_queue(self, url, proxy, score, incr, speed=0):
     items = list()
     # todo set proxy to tmp_queue
     for task in self.socks4_tasks:
         score_item = ProxyScoreItem(url=proxy, score=score, incr=incr)
         ttl_item = ProxyVerifiedTimeItem(url=proxy,
                                          verified_time=int(time.time()),
                                          incr=incr)
         speed_item = ProxySpeedItem(url=proxy,
                                     response_time=speed,
                                     incr=incr)
         score_item['queue'] = SCORE_MAPS.get(task)
         ttl_item['queue'] = TTL_MAPS.get(task)
         speed_item['queue'] = SPEED_MAPS.get(task)
         items.append(score_item)
         items.append(ttl_item)
         items.append(speed_item)
     return items
Пример #3
0
 def set_item_queue(self, url, proxy, score, incr, speed=0):
     items = list()
     tasks = self.https_tasks if 'https' in url else self.http_tasks
     # todo set proxy to tmp_queue
     for task in tasks:
         # logger.info(f"写入{task}, proxy:{proxy}, url:{url}, incr: {incr}")
         score_item = ProxyScoreItem(url=proxy, score=score, incr=incr)
         ttl_item = ProxyVerifiedTimeItem(url=proxy,
                                          verified_time=int(time.time()),
                                          incr=incr)
         speed_item = ProxySpeedItem(url=proxy,
                                     response_time=speed,
                                     incr=incr)
         score_item['queue'] = SCORE_MAPS.get(task)
         ttl_item['queue'] = TTL_MAPS.get(task)
         speed_item['queue'] = SPEED_MAPS.get(task)
         items.append(score_item)
         items.append(ttl_item)
         items.append(speed_item)
     return items