Fix bug module francetelevisions : remove "latest" feature

"Latest videos" page no longer on new website.
This commit is contained in:
Vincent Texier 2014-12-15 21:56:29 +01:00 committed by Florent
commit 026f3fb712
3 changed files with 1 additions and 30 deletions

View file

@ -30,7 +30,6 @@ class PluzzBrowser(PagesBrowser):
BASEURL = 'http://pluzz.francetv.fr' BASEURL = 'http://pluzz.francetv.fr'
index_page = URL(r'recherche\?recherche=(?P<pattern>.*)', IndexPage) index_page = URL(r'recherche\?recherche=(?P<pattern>.*)', IndexPage)
latest_page = URL(r'lesplusrecents', IndexPage)
video_page = URL(r'http://webservices.francetelevisions.fr/tools/getInfosOeuvre/v2/\?idDiffusion=(?P<id>.*)&catalogue=Pluzz', VideoPage) video_page = URL(r'http://webservices.francetelevisions.fr/tools/getInfosOeuvre/v2/\?idDiffusion=(?P<id>.*)&catalogue=Pluzz', VideoPage)
def search_videos(self, pattern): def search_videos(self, pattern):
@ -48,6 +47,3 @@ class PluzzBrowser(PagesBrowser):
r = self.open(url, stream=True) r = self.open(url, stream=True)
buf = r.iter_lines() buf = r.iter_lines()
return buf return buf
def latest_videos(self):
return self.latest_page.go().iter_videos()

View file

@ -19,7 +19,7 @@
from weboob.capabilities.video import CapVideo, BaseVideo from weboob.capabilities.video import CapVideo, BaseVideo
from weboob.capabilities.collection import CapCollection, CollectionNotFound from weboob.capabilities.collection import CapCollection
from weboob.tools.backend import Module from weboob.tools.backend import Module
from .browser import PluzzBrowser from .browser import PluzzBrowser
@ -52,21 +52,4 @@ class PluzzModule(Module, CapVideo, CapCollection):
return video return video
def iter_resources(self, objs, split_path):
if BaseVideo in objs:
collection = self.get_collection(objs, split_path)
if collection.path_level == 0:
yield self.get_collection(objs, [u'latest'])
if collection.split_path == [u'latest']:
for video in self.browser.latest_videos():
yield video
def validate_collection(self, objs, collection):
if collection.path_level == 0:
return
if BaseVideo in objs and collection.split_path == [u'latest']:
collection.title = u'Latest France Télévisions videos'
return
raise CollectionNotFound(collection.split_path)
OBJECTS = {BaseVideo: fill_video} OBJECTS = {BaseVideo: fill_video}

View file

@ -19,7 +19,6 @@
from weboob.tools.test import BackendTest from weboob.tools.test import BackendTest
from weboob.capabilities.video import BaseVideo
class PluzzTest(BackendTest): class PluzzTest(BackendTest):
@ -32,10 +31,3 @@ class PluzzTest(BackendTest):
v = l[0] v = l[0]
self.backend.fillobj(v, ('url',)) self.backend.fillobj(v, ('url',))
self.assertTrue(v.url, 'URL for video "%s" not found: %s' % (v.id, v.url)) self.assertTrue(v.url, 'URL for video "%s" not found: %s' % (v.id, v.url))
def test_latest(self):
l = list(self.backend.iter_resources([BaseVideo], [u'latest']))
assert len(l)
v = l[0]
self.backend.fillobj(v, ('url',))
assert v.url