Ejemplo n.º 1
0
	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('()'))
Ejemplo n.º 2
0
	def _songHtmlToList (self, html):
		songList = []

		soup = BeautifulSoup(Browser.show())
		songs = soup.findAll('div', {'class': 'infobox-body'})
		for song in songs:
			links = song.findAll('a')
			title = links[0].text
			artist = links[1].text
			songList.append([title, artist])

		return songList
Ejemplo n.º 3
0
	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)