def getNumberOfLikes (self): url = PANDORA_LIKES_COUNT_URL.substitute(webname = self.webname) Browser.go(url) soup = BeautifulSoup(Browser.show()) songsDiv = soup.find('div', {'id': 'songs'}) numberSpan = songsDiv.find('span', {'class': 'section_count'}) return int(numberSpan.text.strip('()'))
def _requestLikes (self, startingLike, startingThumb): url = PANDORA_LIKES_URL.substitute(webname = self.webname, likestart = startingLike, thumbstart = startingThumb) Browser.go(url) likesList = self._songHtmlToList(Browser.show()) soup = BeautifulSoup(Browser.show()) nextInfoElement = soup.find('div', {'class': 'show_more tracklike'}) nextStartingLike = self._attributeNumberValueOrZero(nextInfoElement, 'data-nextlikestartindex') nextStartingThumb = self._attributeNumberValueOrZero(nextInfoElement, 'data-nextthumbstartindex') return (likesList, nextStartingLike, nextStartingThumb)