pax_global_header 0000666 0000000 0000000 00000000064 13434577234 0014526 g ustar 00root root 0000000 0000000 52 comment=80d8d4f930af694bb2ce2ffeb7ce41d7e40f45cd
woob-80d8d4f930af694bb2ce2ffeb7ce41d7e40f45cd-modules-youjizz-pages/ 0000775 0000000 0000000 00000000000 13434577234 0024352 5 ustar 00root root 0000000 0000000 woob-80d8d4f930af694bb2ce2ffeb7ce41d7e40f45cd-modules-youjizz-pages/modules/ 0000775 0000000 0000000 00000000000 13434577234 0026022 5 ustar 00root root 0000000 0000000 woob-80d8d4f930af694bb2ce2ffeb7ce41d7e40f45cd-modules-youjizz-pages/modules/youjizz/ 0000775 0000000 0000000 00000000000 13434577234 0027545 5 ustar 00root root 0000000 0000000 woob-80d8d4f930af694bb2ce2ffeb7ce41d7e40f45cd-modules-youjizz-pages/modules/youjizz/pages/ 0000775 0000000 0000000 00000000000 13434577234 0030644 5 ustar 00root root 0000000 0000000 __init__.py 0000664 0000000 0000000 00000000000 13434577234 0032664 0 ustar 00root root 0000000 0000000 woob-80d8d4f930af694bb2ce2ffeb7ce41d7e40f45cd-modules-youjizz-pages/modules/youjizz/pages woob-80d8d4f930af694bb2ce2ffeb7ce41d7e40f45cd-modules-youjizz-pages/modules/youjizz/pages/index.py 0000664 0000000 0000000 00000003575 13434577234 0032337 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# Copyright(C) 2010-2014 Roger Philibert
#
# 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.pages import HTMLPage, pagination
from weboob.browser.elements import ListElement, ItemElement, method
from weboob.browser.filters.standard import CleanText, Duration, Regexp
from weboob.browser.filters.html import Link, CSS
from weboob.capabilities.base import NotAvailable
from weboob.capabilities.image import Thumbnail
from weboob.capabilities.video import BaseVideo
class IndexPage(HTMLPage):
@pagination
@method
class iter_videos(ListElement):
item_xpath = '//span[@id="miniatura"]'
next_page = Link(u'//a[text()="Next ยป"]')
class item(ItemElement):
klass = BaseVideo
obj_id = CSS('a') & Link & Regexp(pattern=r'/videos/(.+)\.html')
obj_title = CSS('span#title1') & CleanText
obj_duration = CSS('span.thumbtime span') & CleanText & Duration | NotAvailable
obj_nsfw = True
def obj_thumbnail(self):
thumbnail = Thumbnail(self.xpath('.//img')[0].attrib['data-original'])
thumbnail.url = thumbnail.id.replace('http://', 'https://')
return thumbnail
woob-80d8d4f930af694bb2ce2ffeb7ce41d7e40f45cd-modules-youjizz-pages/modules/youjizz/pages/video.py 0000664 0000000 0000000 00000003463 13434577234 0032332 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# Copyright(C) 2010-2014 Roger Philibert
#
# 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 .
import re
from weboob.browser.pages import HTMLPage
from weboob.browser.elements import ItemElement, method
from weboob.browser.filters.standard import CleanText, Env
from weboob.capabilities.video import BaseVideo
from weboob.tools.misc import to_unicode
class VideoPage(HTMLPage):
@method
class get_video(ItemElement):
klass = BaseVideo
obj_id = Env('id')
obj_title = CleanText('//title')
obj_nsfw = True
obj_ext = u'flv'
def obj_url(self):
real_id = int(self.env['id'].split('-')[-1])
response = self.page.browser.open('https://www.youjizz.com/videos/embed/%s' % real_id)
data = response.text
video_file_urls = re.findall(r'"((?:https?:)?//[^",]+\.(?:flv|mp4)(?:\?[^"]*)?)"', data.replace('\\', ''))
if len(video_file_urls) == 0:
raise ValueError('Video URL not found')
url = to_unicode(video_file_urls[-1])
if url.startswith('//'):
url = u'https:' + url
return url