3 from .common
import InfoExtractor
6 class ToypicsIE(InfoExtractor
):
8 IE_DESC
= 'Toypics video'
9 _VALID_URL
= r
'https?://videos\.toypics\.net/view/(?P<id>[0-9]+)'
11 'url': 'http://videos.toypics.net/view/514/chancebulged,-2-1/',
12 'md5': '16e806ad6d6f58079d210fe30985e08b',
16 'title': "Chance-Bulge'd, 2",
18 'uploader': 'kidsune',
22 def _real_extract(self
, url
):
23 video_id
= self
._match
_id
(url
)
25 webpage
= self
._download
_webpage
(url
, video_id
)
27 formats
= self
._parse
_html
5_media
_entries
(
28 url
, webpage
, video_id
)[0]['formats']
29 title
= self
._html
_search
_regex
([
30 r
'<h1[^>]+class=["\']view
-video
-title
[^
>]+>([^
<]+)</h
',
31 r'<title
>([^
<]+) - Toypics
</title
>',
34 uploader = self._html_search_regex(
35 r'More videos
from <strong
>([^
<]+)</strong
>', webpage, 'uploader
',
47 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
+ f
'/public/{n}'
74 lpage
= self
._download
_webpage
(
76 note
=f
'Downloading page {n}/{page_count}')
79 r
'<div[^>]+class=["\']preview
[^
>]+>\s
*<a
[^
>]+href
="(https?://videos\.toypics\.net/view/[^"]+)"',