def __init__(self, queue, asin, countrycode): self.queue = queue self.countrycode = countrycode self.baseurl = GlobalTools.getBaseurlFromCountrycode(countrycode) self.headers = GlobalTools.getHeaders() self.asin = asin self.url = get_link_by_asin(asin, self.baseurl) #if can't get a normal page ,can't use this kind of url to get a price and shop name #the second link look like this : http://www.amazon.de/gp/offer-listing/B01N52QW8A/ref=dp_olp_0?ie=UTF8&condition=all self.second_url = "" self.normal_situation = True self.unnormal_price = "" self.unnormal_shop = "" self.resultmap = {} self.result = [] self.us_reviews_need_adjust = False
def getFlowingList(url): res = requests.get(url,headers=GlobalTools.getHeaders()) if res.headers['Content-Encoding'] == "br": html = BeautifulSoup(brotli.decompress(res.content),"lxml") else: html = BeautifulSoup(res.content,"lxml") followerlist = html.find(id,"olpOfferList").find_all(class_="olpOffer") resultlist = [] for follow in followerlist: followerNameElem = follow.find(class_="olpSellerName") if len(followerNameElem.find_all("a"))>0: followerName = followerNameElem.text url = GlobalTools.getBaseurlFromCountrycode("uk")+(followerNameElem.find("a"))['href'] else: if len(followerNameElem.find_all("img"))>0: followerName = followerNameElem.find("img")['alt'] url = "https://amazon.com" else: followerName = "" url = "" print (followerName,url)