Exemple #1
0
def initCookie():
    initWebDriver()
    global itemdriver
    cBaseUrl = "https://www.taobao.com/?s={}".format(time.time() * 1000)
    itemdriver.get(cBaseUrl)
    try:
        isg = itemdriver.get_cookie("isg")['value']
        tbpool.pushISG(isg)
        #cookie = itemdriver.execute_script("return document.title")  # js
        #print(cookie)
        return
    except BaseException:
        pass
Exemple #2
0
    def before(self):
        global CRA_COUNT
        L_CAT.acquire()
        CRA_COUNT = CRA_COUNT + 1
        L_CAT.release()
        isg = tbpool.popISG()

        tbpool.pushISG(isg)
        self.headers = {
            'User-Agent':
            'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.3',
        }
        return True
Exemple #3
0
 def before(self):
     self.isProxy = True
     global CRA_COUNT
     L_CAT.acquire()
     CRA_COUNT = CRA_COUNT + 1
     L_CAT.release()
     isg = tbpool.popISG()
     tbpool.pushISG(isg)
     self.headers = {
         'User-Agent':
         'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.3'
     }
     now = time.strftime("%Y%m%d", time.localtime())
     rd = time.time()
     turl = "https://shop.taobao.com/getShopInfo.htm?shopId={0}&staobaoz_{1}&rd={2}"
     self.url = turl.format(self.shopid, now, rd)
     return True
Exemple #4
0
    def before(self):
        global CRA_COUNT
        L_CAT.acquire()
        CRA_COUNT = CRA_COUNT + 1
        L_CAT.release()
        isg = tbpool.popISG()

        tbpool.pushISG(isg)
        self.headers = {
            'User-Agent':
            'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.3',
            'cookie': 'isg={}'.format(isg)
        }
        now = time.strftime("%Y%m%d", time.localtime())

        q = urllib.parse.urlencode({'q': self.q, 'loc': self.city})
        turl = "https://shopsearch.taobao.com/search?app=shopsearch&imgfile=&js=1&stats_click=search_radio_all%3A1&initiative_id=staobaoz_{0}&ie=utf8&s={1}&{2}"
        self.url = turl.format(now, self.pageno, q)
        return True