pyflages / pep8 fix
This commit is contained in:
parent
455a11b887
commit
5fc90ec3b2
3 changed files with 28 additions and 30 deletions
|
|
@ -18,7 +18,6 @@
|
|||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from weboob.capabilities.base import UserError
|
||||
from weboob.capabilities.video import ICapVideo, BaseVideo
|
||||
from weboob.capabilities.collection import ICapCollection, CollectionNotFound
|
||||
from weboob.tools.backend import BaseBackend, BackendConfig
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ class ArretSurImagesBrowser(BaseBrowser):
|
|||
return self.page.get_video(video)
|
||||
|
||||
def is_logged(self):
|
||||
return self.is_on_page(LoginPage) == False
|
||||
return not self.is_on_page(LoginPage)
|
||||
|
||||
def login(self):
|
||||
if not self.is_on_page(LoginPage):
|
||||
|
|
@ -70,4 +70,3 @@ class ArretSurImagesBrowser(BaseBrowser):
|
|||
self.location(self.buildurl('/emissions.php'))
|
||||
assert self.is_on_page(IndexPage)
|
||||
return self.page.iter_videos()
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import re
|
||||
import mechanize
|
||||
|
||||
from weboob.capabilities.base import UserError
|
||||
from weboob.tools.browser import BasePage, BrokenPageError
|
||||
|
|
@ -51,6 +50,7 @@ class IndexPage(BasePage):
|
|||
|
||||
yield video
|
||||
|
||||
|
||||
class ForbiddenVideo(UserError):
|
||||
pass
|
||||
|
||||
|
|
@ -83,11 +83,10 @@ class VideoPage(BasePage):
|
|||
|
||||
def get_title(self):
|
||||
title = self.document.getroot().cssselect('div[id=titrage-contenu] h1')[0].text
|
||||
return title;
|
||||
return title
|
||||
|
||||
def get_id(self):
|
||||
m = re.match(r'http://videos.arretsurimages.net/telecharger/(.*)', self.get_firstUrl())
|
||||
_id = ''
|
||||
if m:
|
||||
return m.group(1)
|
||||
self.logger.warning('Unable to parse ID')
|
||||
|
|
@ -96,20 +95,21 @@ class VideoPage(BasePage):
|
|||
def get_url(self):
|
||||
firstUrl = self.get_firstUrl()
|
||||
doc = self.browser.get_document(self.browser.openurl(firstUrl))
|
||||
links = doc.xpath('//a');
|
||||
url = None;
|
||||
links = doc.xpath('//a')
|
||||
url = None
|
||||
i = 1
|
||||
for link in links :
|
||||
for link in links:
|
||||
# we take the second link of the page
|
||||
if i == 2:
|
||||
url = link.attrib['href']
|
||||
i=i+1
|
||||
i += 1
|
||||
return url
|
||||
|
||||
|
||||
class LoginPage(BasePage):
|
||||
def login(self, username, password):
|
||||
response = self.browser.response()
|
||||
response.set_data(response.get_data().replace("<br/>", "<br />")) #Python mechanize is broken, fixing it.
|
||||
response.set_data(response.get_data().replace("<br/>", "<br />")) # Python mechanize is broken, fixing it.
|
||||
self.browser.set_response(response)
|
||||
self.browser.select_form(nr=0)
|
||||
self.browser.form.set_all_readonly(False)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue