[weboob] [PATCH] youjizz: handle videos longer than 59 minutes.

Adrien Kunysz adrien at kunysz.be
Fri Feb 14 20:16:17 CET 2014


OK, the searching works but there is more stuff to fix at least
in video.py for the playing to actually work. I might write another
patch later but at least it doesn't crash as soon as there is a longer
video showing up in search results any more.

On Fri, Feb 14, 2014 at 07:13:32PM +0000, Adrien Kunysz wrote:
> ---
> 
> There may be a nicer way to do it and I do not provide any test but
> it works for me. Please CC me if you reply as I am not subscribed
> to the list.
> 
>  modules/youjizz/pages/index.py |   14 +++++++++-----
>  1 files changed, 9 insertions(+), 5 deletions(-)
> 
> diff --git a/modules/youjizz/pages/index.py b/modules/youjizz/pages/index.py
> index a2bea4a..a98298e 100644
> --- a/modules/youjizz/pages/index.py
> +++ b/modules/youjizz/pages/index.py
> @@ -49,13 +49,17 @@ class IndexPage(BasePage):
>  
>              time_span = self.parser.select(span, 'span.thumbtime span', 1)
>              time_txt = time_span.text.strip().replace(';', ':')
> -            if time_txt == 'N/A':
> -                minutes, seconds = 0, 0
> -            elif ':' in time_txt:
> -                minutes, seconds = (int(v) for v in time_txt.split(':'))
> +            hours, minutes, seconds = 0, 0, 0
> +            if ':' in time_txt:
> +                t = time_txt.split(':')
> +                t.reverse()
> +                seconds = int(t[0])
> +                minutes = int(t[1])
> +                if len(t) == 3:
> +		    hours = int(t[2])
>              else:
>                  raise BrokenPageError('Unable to parse the video duration: %s' % time_txt)
>  
> -            video.duration = datetime.timedelta(minutes=minutes, seconds=seconds)
> +            video.duration = datetime.timedelta(hours=hours, minutes=minutes, seconds=seconds)
>  
>              yield video
> -- 
> 1.7.2.5
> 


More information about the weboob mailing list