[booblyrics] cleaning
This commit is contained in:
parent
35645793e0
commit
595e33b1fa
5 changed files with 6 additions and 19 deletions
|
|
@ -23,8 +23,6 @@ from weboob.tools.backend import BaseBackend
|
|||
from .browser import SeeklyricsBrowser
|
||||
|
||||
from urllib import quote_plus
|
||||
from contextlib import closing
|
||||
from gzip import GzipFile
|
||||
|
||||
__all__ = ['SeeklyricsBackend']
|
||||
|
||||
|
|
|
|||
|
|
@ -18,13 +18,6 @@
|
|||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
try:
|
||||
from urlparse import parse_qs
|
||||
except ImportError:
|
||||
from cgi import parse_qs # NOQA
|
||||
|
||||
from urlparse import urlsplit
|
||||
|
||||
from weboob.capabilities.lyrics import SongLyrics
|
||||
from weboob.capabilities.base import NotAvailable, NotLoaded
|
||||
from weboob.tools.browser import BasePage
|
||||
|
|
@ -42,10 +35,10 @@ class ResultsPage(BasePage):
|
|||
continue
|
||||
artist = NotAvailable
|
||||
ftitle = self.parser.select(tr,'a > font > font',1)
|
||||
title = ftitle.getparent().getparent().text_content()
|
||||
title = unicode(ftitle.getparent().getparent().text_content())
|
||||
id = ftitle.getparent().getparent().attrib.get('href','').replace('/lyrics/','').replace('.html','')
|
||||
aartist = self.parser.select(tr,'a')[-1]
|
||||
artist = aartist.text
|
||||
artist = unicode(aartist.text)
|
||||
songlyrics = SongLyrics(id, title)
|
||||
songlyrics.artist = artist
|
||||
songlyrics.content = NotLoaded
|
||||
|
|
@ -59,9 +52,9 @@ class SonglyricsPage(BasePage):
|
|||
l_artitle = self.parser.select(self.document.getroot(),'table.text td > b > h2')
|
||||
if len(l_artitle) > 0:
|
||||
artitle = l_artitle[0].text.split(' Lyrics by ')
|
||||
artist = artitle[1]
|
||||
title = artitle[0]
|
||||
content = self.parser.select(self.document.getroot(),'div#songlyrics',1).text_content().strip()
|
||||
artist = unicode(artitle[1])
|
||||
title = unicode(artitle[0])
|
||||
content = unicode(self.parser.select(self.document.getroot(),'div#songlyrics',1).text_content().strip())
|
||||
songlyrics = SongLyrics(id, title)
|
||||
songlyrics.artist = artist
|
||||
songlyrics.content = content
|
||||
|
|
|
|||
|
|
@ -20,8 +20,6 @@
|
|||
from weboob.tools.test import BackendTest
|
||||
from weboob.capabilities.base import NotLoaded
|
||||
|
||||
from random import choice
|
||||
|
||||
class SeeklyricsTest(BackendTest):
|
||||
BACKEND = 'seeklyrics'
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ from weboob.capabilities.lyrics import ICapLyrics
|
|||
from weboob.tools.application.repl import ReplApplication
|
||||
from weboob.capabilities.base import NotAvailable,NotLoaded
|
||||
from weboob.tools.application.formatters.iformatter import IFormatter, PrettyFormatter
|
||||
from weboob.core import CallErrors
|
||||
|
||||
|
||||
__all__ = ['Booblyrics']
|
||||
|
|
|
|||
|
|
@ -18,8 +18,7 @@
|
|||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from .base import IBaseCap, CapBaseObject, Field, StringField, FloatField, \
|
||||
DateField, IntField, UserError
|
||||
from .base import IBaseCap, CapBaseObject, StringField
|
||||
|
||||
|
||||
__all__ = ['SongLyrics', 'ICapLyrics']
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue