Exemple #1
0
    def alternatives(self):
        # TODO: there are FAR more versions hidden behind API calls
        # it would be nice to get them all

        # kindle
        tag = self.soup.find('table', class_='twisterMediaMatrix')
        if tag:
            asins = set([
                extract_asin(anchor['href'])
                for anchor in tag.find_all('a', href=re.compile(ur'/dp/'))
            ])
            if self.asin in asins:
                asins.remove(self.asin)
            return list(asins)

        # paperback
        tag = self.soup.find('div', id='MediaMatrix')
        if tag:
            asins = set([
                extract_asin(anchor['href'])
                for anchor in tag.find_all('a', href=re.compile(ur'/dp/'))
            ])
            if self.asin in asins:
                asins.remove(self.asin)
            return list(asins)

        return []
Exemple #2
0
    def alternatives(self):
        # TODO: there are FAR more versions hidden behind API calls
        # it would be nice to get them all

        # kindle
        tag = self.soup.find('table', class_='twisterMediaMatrix')
        if tag:
            asins = set([
                extract_asin(anchor['href'])
                for anchor in tag.find_all('a', href=re.compile(ur'/dp/'))
            ])
            if self.asin in asins:
Exemple #3
0
    def alternatives(self):
        # TODO: there are FAR more versions hidden behind API calls
        # it would be nice to get them all

        # kindle
        tag = self.soup.find("table", class_="twisterMediaMatrix")
        if tag:
            asins = set([extract_asin(anchor["href"]) for anchor in tag.find_all("a", href=re.compile(r"/dp/"))])
            if self.asin in asins:
                asins.remove(self.asin)
            return list(asins)

        # paperback
        tag = self.soup.find("div", id="MediaMatrix")
        if tag:
            asins = set([extract_asin(anchor["href"]) for anchor in tag.find_all("a", href=re.compile(r"/dp/"))])
            if self.asin in asins:
                asins.remove(self.asin)
            return list(asins)

        return []
Exemple #4
0
        # kindle
        tag = self.soup.find('table', class_='twisterMediaMatrix')
        if tag:
            asins = set([
                extract_asin(anchor['href'])
                for anchor in tag.find_all('a', href=re.compile(ur'/dp/'))
            ])
            if self.asin in asins:
                asins.remove(self.asin)
            return list(asins)

        # paperback
        tag = self.soup.find('div', id='MediaMatrix')
        if tag:
            asins = set([
                extract_asin(anchor['href'])
                for anchor in tag.find_all('a', href=re.compile(ur'/dp/'))
            ])
            if self.asin in asins:
                asins.remove(self.asin)
            return list(asins)

        return []

    @property
    def reviews_url(self):
        # we could use the asin to directly make a review url
        # but some products actually use the ISBN for the review url
        # and the ASIN version would fail
        # so we'll get the url given to us, and get the asin/isbn from that
        try:
 def asin(self):
     asin_tag = self.soup.find('a', href=re.compile(r'dp/([^/]+)'))
     return extract_asin(asin_tag.attrs['href'])
 def asin(self):
     asin_tag = self.soup.find('a', href=re.compile(r'dp/([^/]+)'))
     return extract_asin(asin_tag.attrs['href'])
Exemple #7
0
 def asin(self):
     asin_tag = self.soup.find("a", href=re.compile(r"dp/([^/]+)"))
     return extract_asin(asin_tag.attrs["href"])