def fetchEntries(self, all=False):
        """GETs the corresponding chart data from Billboard.com, then parses
        the data. Makes use of BeautifulSoup.
        """
        if self.latest:
            url = 'http://www.billboard.com/charts/%s' % (self.name)
        else:
            url = 'http://www.billboard.com/charts/%s/%s' % (
                self.name, self.date)

        html = downloadHTML(url)
        soup = BeautifulSoup(html, 'html.parser')

        prevLink = soup.find('a', {'title': 'Previous Week'})
        if prevLink:
            # Extract the previous date from the link.
            # eg, /charts/country-songs/2016-02-13
            self.previousDate = prevLink.get('href').split('/')[-1]

        currentTime = soup.find('time')
        if currentTime:
            # Extract the previous date from the link.
            # eg, /charts/country-songs/2016-02-13
            self.date = currentTime.get('datetime')

        for entrySoup in soup.find_all('article', {'class': 'chart-row'}):
            # Grab title and artist
            basicInfoSoup = entrySoup.find('div', 'chart-row__title').contents
            title = basicInfoSoup[1].string.strip()

            if (basicInfoSoup[3].find('a')):
                artist = basicInfoSoup[3].a.string.strip()
            else:
                artist = basicInfoSoup[3].string.strip()

            def getRowValue(rowName):
                selector = 'div.chart-row__' + rowName + ' .chart-row__value'
                return entrySoup.select_one(selector).string.strip()

            # Grab week data (peak rank, last week's rank, total weeks on
            # chart)
            peakPos = int(getRowValue('top-spot'))

            lastPos = getRowValue('last-week')
            lastPos = 0 if lastPos == '--' else int(lastPos)

            weeks = int(getRowValue('weeks-on-chart'))

            # Get current rank
            rank = int(
                entrySoup.select_one('.chart-row__current-week').string.strip())

            change = lastPos - rank
            if lastPos == 0:
                # New entry
                if weeks > 1:
                    # If entry has been on charts before, it's a re-entry
                    change = "Re-Entry"
                else:
                    change = "New"
            elif change > 0:
                change = "+" + str(change)
            else:
                change = str(change)

            # Get spotify link for this track
            spotifyID = entrySoup.get('data-spotifyid')
            if spotifyID:
                spotifyLink = "https://embed.spotify.com/?uri=spotify:track:" + \
                    spotifyID
            else:
                spotifyID = ''
                spotifyLink = ''

            self.entries.append(
                ChartEntry(title, artist, peakPos,
                           lastPos, weeks, rank, change,
                           spotifyID, spotifyLink))

        # Hot Shot Debut is the top-ranked new entry, or the first "New" entry
        # we find.
        for entry in self.entries:
            if entry.change == "New":
                entry.change = "Hot Shot Debut"
                break
dataset/ETHPy150Open guoguo12/billboard-charts/billboard.py/ChartData.fetchEntries/original