2 from __future__ import unicode_literals
4 from .common import InfoExtractor
8 class ToypicsIE(InfoExtractor):
9 IE_DESC = 'Toypics video'
10 _VALID_URL = r'https?://videos\.toypics\.net/view/(?P<id>[0-9]+)'
12 'url': 'http://videos.toypics.net/view/514/chancebulged,-2-1/',
13 'md5': '16e806ad6d6f58079d210fe30985e08b',
17 'title': "Chance-Bulge'd, 2",
19 'uploader': 'kidsune',
23 def _real_extract(self, url):
24 video_id = self._match_id(url)
26 webpage = self._download_webpage(url, video_id)
28 formats = self._parse_html5_media_entries(
29 url, webpage, video_id)[0]['formats']
30 title = self._html_search_regex([
31 r'<h1[^>]+class=["\']view-video-title[^>]+>([^<]+)</h',
32 r'<title>([^<]+) - Toypics</title>',
35 uploader = self._html_search_regex(
36 r'More videos from <strong>([^<]+)</strong>', webpage, 'uploader',
48 class ToypicsUserIE(InfoExtractor):
49 IE_DESC = 'Toypics user profile'
50 _VALID_URL = r'https?://videos\.toypics\.net/(?!view)(?P<id>[^/?#&]+)'
52 'url': 'http://videos.toypics.net/Mikey',
56 'playlist_mincount': 19,
59 def _real_extract(self, url):
60 username = self._match_id(url)
62 profile_page = self._download_webpage(
63 url, username, note='Retrieving profile page')
65 video_count = int(self._search_regex(
66 r'public/">Public Videos \(([0-9]+)\)</a></li>', profile_page,
71 page_count = (video_count + PAGE_SIZE + 1) // PAGE_SIZE
72 for n in range(1, page_count + 1):
73 lpage_url = url + '/public/%d' % n
74 lpage = self._download_webpage(
76 note='Downloading page %d/%d' % (n, page_count))
79 r'<div[^>]+class=["\']preview[^>]+>\s*<a[^>]+href="(https?://videos\.toypics\.net/view/[^"]+)"',