pax_global_header 0000666 0000000 0000000 00000000064 13436457030 0014517 g ustar 00root root 0000000 0000000 52 comment=3863a14eedf17551743a8bbccf0237874d7f4a16
woob-3863a14eedf17551743a8bbccf0237874d7f4a16-modules-paroles2chansons/ 0000775 0000000 0000000 00000000000 13436457030 0024342 5 ustar 00root root 0000000 0000000 woob-3863a14eedf17551743a8bbccf0237874d7f4a16-modules-paroles2chansons/modules/ 0000775 0000000 0000000 00000000000 13436457030 0026012 5 ustar 00root root 0000000 0000000 woob-3863a14eedf17551743a8bbccf0237874d7f4a16-modules-paroles2chansons/modules/paroles2chansons/ 0000775 0000000 0000000 00000000000 13436457030 0031276 5 ustar 00root root 0000000 0000000 __init__.py 0000664 0000000 0000000 00000000121 13436457030 0033322 0 ustar 00root root 0000000 0000000 woob-3863a14eedf17551743a8bbccf0237874d7f4a16-modules-paroles2chansons/modules/paroles2chansons from .module import Paroles2chansonsModule
__all__ = ['Paroles2chansonsModule']
browser.py 0000664 0000000 0000000 00000004511 13436457030 0033255 0 ustar 00root root 0000000 0000000 woob-3863a14eedf17551743a8bbccf0237874d7f4a16-modules-paroles2chansons/modules/paroles2chansons # -*- coding: utf-8 -*-
# Copyright(C) 2016 Julien Veyssier
#
# This file is part of a weboob module.
#
# This weboob module is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This weboob module is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this weboob module. If not, see .
from weboob.browser.exceptions import BrowserHTTPNotFound
from weboob.browser import PagesBrowser
from weboob.browser.url import URL
from weboob.browser.profiles import Firefox
from .pages import SearchPage, LyricsPage, HomePage, ArtistPage
import itertools
__all__ = ['Paroles2chansonsBrowser']
class Paroles2chansonsBrowser(PagesBrowser):
PROFILE = Firefox()
TIMEOUT = 30
BASEURL = 'http://paroles2chansons.lemonde.fr/'
home = URL('$',
HomePage)
search = URL('search',
SearchPage)
artist = URL('paroles-(?P[^/]*)$',
ArtistPage)
lyrics = URL('paroles-(?P[^/]*)/paroles-(?P[^/]*)\.html',
LyricsPage)
def iter_lyrics(self, criteria, pattern):
self.home.stay_or_go()
assert self.home.is_here()
self.page.search_lyrics(pattern)
assert self.search.is_here()
if criteria == 'song':
return self.page.iter_song_lyrics()
elif criteria == 'artist':
artist_ids = self.page.get_artist_ids()
it = []
# we just take the 3 first artists to avoid too many page loadings
for aid in artist_ids[:3]:
it = itertools.chain(it, self.artist.go(artistid=aid).iter_lyrics())
return it
def get_lyrics(self, id):
ids = id.split('|')
try:
self.lyrics.go(artistid=ids[0], songid=ids[1])
songlyrics = self.page.get_lyrics()
return songlyrics
except BrowserHTTPNotFound:
return
favicon.png 0000664 0000000 0000000 00000003261 13436457030 0033354 0 ustar 00root root 0000000 0000000 woob-3863a14eedf17551743a8bbccf0237874d7f4a16-modules-paroles2chansons/modules/paroles2chansons PNG
IHDR @ @ iq bKGD pHYs tIME
9c0D >IDATxilTUtޛ,"K)[KE@#J `1F%F@@1 q!@DH*B\
DXd)JiNK03PJ3̼w=۽,XH(nMs7UԊx3o`K>l]$0iE)eHB\ooyѵyuN9/:Y~H3