1 from .common import InfoExtractor
5 class ToypicsIE(InfoExtractor):
6 IE_DESC = 'Toypics user profile'
7 _VALID_URL = r'http://videos\.toypics\.net/view/(?P<id>[0-9]+)/.*'
9 'url': 'http://videos.toypics.net/view/514/chancebulged,-2-1/',
10 'md5': '16e806ad6d6f58079d210fe30985e08b',
14 'title': 'Chance-Bulge\'d, 2',
16 'uploader': 'kidsune',
20 def _real_extract(self, url):
21 mobj = re.match(self._VALID_URL, url)
22 video_id = mobj.group('id')
23 page = self._download_webpage(url, video_id)
24 video_url = self._html_search_regex(
25 r'src:\s+"(http://static[0-9]+\.toypics\.net/flvideo/[^"]+)"', page, 'video URL')
26 title = self._html_search_regex(
27 r'<title>Toypics - ([^<]+)</title>', page, 'title')
28 username = self._html_search_regex(
29 r'toypics.net/([^/"]+)" class="user-name">', page, 'username')
39 class ToypicsUserIE(InfoExtractor):
40 IE_DESC = 'Toypics user profile'
41 _VALID_URL = r'http://videos\.toypics\.net/(?P<username>[^/?]+)(?:$|[?#])'
43 def _real_extract(self, url):
44 mobj = re.match(self._VALID_URL, url)
45 username = mobj.group('username')
47 profile_page = self._download_webpage(
48 url, username, note='Retrieving profile page')
50 video_count = int(self._search_regex(
51 r'public/">Public Videos \(([0-9]+)\)</a></li>', profile_page,
56 page_count = (video_count + PAGE_SIZE + 1) // PAGE_SIZE
57 for n in range(1, page_count + 1):
58 lpage_url = url + '/public/%d' % n
59 lpage = self._download_webpage(
61 note='Downloading page %d/%d' % (n, page_count))
64 r'<p class="video-entry-title">\n\s*<a href="(http://videos.toypics.net/view/[^"]+)">',