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/>.
|
# 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.video import ICapVideo, BaseVideo
|
||||||
from weboob.capabilities.collection import ICapCollection, CollectionNotFound
|
from weboob.capabilities.collection import ICapCollection, CollectionNotFound
|
||||||
from weboob.tools.backend import BaseBackend, BackendConfig
|
from weboob.tools.backend import BaseBackend, BackendConfig
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ class ArretSurImagesBrowser(BaseBrowser):
|
||||||
return self.page.get_video(video)
|
return self.page.get_video(video)
|
||||||
|
|
||||||
def is_logged(self):
|
def is_logged(self):
|
||||||
return self.is_on_page(LoginPage) == False
|
return not self.is_on_page(LoginPage)
|
||||||
|
|
||||||
def login(self):
|
def login(self):
|
||||||
if not self.is_on_page(LoginPage):
|
if not self.is_on_page(LoginPage):
|
||||||
|
|
@ -70,4 +70,3 @@ class ArretSurImagesBrowser(BaseBrowser):
|
||||||
self.location(self.buildurl('/emissions.php'))
|
self.location(self.buildurl('/emissions.php'))
|
||||||
assert self.is_on_page(IndexPage)
|
assert self.is_on_page(IndexPage)
|
||||||
return self.page.iter_videos()
|
return self.page.iter_videos()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@
|
||||||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import mechanize
|
|
||||||
|
|
||||||
from weboob.capabilities.base import UserError
|
from weboob.capabilities.base import UserError
|
||||||
from weboob.tools.browser import BasePage, BrokenPageError
|
from weboob.tools.browser import BasePage, BrokenPageError
|
||||||
|
|
@ -51,6 +50,7 @@ class IndexPage(BasePage):
|
||||||
|
|
||||||
yield video
|
yield video
|
||||||
|
|
||||||
|
|
||||||
class ForbiddenVideo(UserError):
|
class ForbiddenVideo(UserError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
@ -83,11 +83,10 @@ class VideoPage(BasePage):
|
||||||
|
|
||||||
def get_title(self):
|
def get_title(self):
|
||||||
title = self.document.getroot().cssselect('div[id=titrage-contenu] h1')[0].text
|
title = self.document.getroot().cssselect('div[id=titrage-contenu] h1')[0].text
|
||||||
return title;
|
return title
|
||||||
|
|
||||||
def get_id(self):
|
def get_id(self):
|
||||||
m = re.match(r'http://videos.arretsurimages.net/telecharger/(.*)', self.get_firstUrl())
|
m = re.match(r'http://videos.arretsurimages.net/telecharger/(.*)', self.get_firstUrl())
|
||||||
_id = ''
|
|
||||||
if m:
|
if m:
|
||||||
return m.group(1)
|
return m.group(1)
|
||||||
self.logger.warning('Unable to parse ID')
|
self.logger.warning('Unable to parse ID')
|
||||||
|
|
@ -96,16 +95,17 @@ class VideoPage(BasePage):
|
||||||
def get_url(self):
|
def get_url(self):
|
||||||
firstUrl = self.get_firstUrl()
|
firstUrl = self.get_firstUrl()
|
||||||
doc = self.browser.get_document(self.browser.openurl(firstUrl))
|
doc = self.browser.get_document(self.browser.openurl(firstUrl))
|
||||||
links = doc.xpath('//a');
|
links = doc.xpath('//a')
|
||||||
url = None;
|
url = None
|
||||||
i = 1
|
i = 1
|
||||||
for link in links:
|
for link in links:
|
||||||
# we take the second link of the page
|
# we take the second link of the page
|
||||||
if i == 2:
|
if i == 2:
|
||||||
url = link.attrib['href']
|
url = link.attrib['href']
|
||||||
i=i+1
|
i += 1
|
||||||
return url
|
return url
|
||||||
|
|
||||||
|
|
||||||
class LoginPage(BasePage):
|
class LoginPage(BasePage):
|
||||||
def login(self, username, password):
|
def login(self, username, password):
|
||||||
response = self.browser.response()
|
response = self.browser.response()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue