]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/toypics.py
1 from .common
import InfoExtractor
5 class ToypicsIE(InfoExtractor
):
7 IE_DESC
= 'Toypics video'
8 _VALID_URL
= r
'https?://videos\.toypics\.net/view/(?P<id>[0-9]+)'
10 'url': 'http://videos.toypics.net/view/514/chancebulged,-2-1/',
11 'md5': '16e806ad6d6f58079d210fe30985e08b',
15 'title': "Chance-Bulge'd, 2",
17 'uploader': 'kidsune',
21 def _real_extract(self
, url
):
22 video_id
= self
._match
_id
(url
)
24 webpage
= self
._download
_webpage
(url
, video_id
)
26 formats
= self
._parse
_html
5_media
_entries
(
27 url
, webpage
, video_id
)[0]['formats']
28 title
= self
._html
_search
_regex
([
29 r
'<h1[^>]+class=["\']view
-video
-title
[^
>]+>([^
<]+)</h
',
30 r'<title
>([^
<]+) - Toypics
</title
>',
33 uploader = self._html_search_regex(
34 r'More videos
from <strong
>([^
<]+)</strong
>', webpage, 'uploader
',
46 class ToypicsUserIE(InfoExtractor):
48 IE_DESC = 'Toypics user profile
'
49 _VALID_URL = r'https?
://videos\
.toypics\
.net
/(?
!view
)(?P
<id>[^
/?
#&]+)'
51 'url': 'http://videos.toypics.net/Mikey',
55 'playlist_mincount': 19,
58 def _real_extract(self
, url
):
59 username
= self
._match
_id
(url
)
61 profile_page
= self
._download
_webpage
(
62 url
, username
, note
='Retrieving profile page')
64 video_count
= int(self
._search
_regex
(
65 r
'public/">Public Videos \(([0-9]+)\)</a></li>', profile_page
,
70 page_count
= (video_count
+ PAGE_SIZE
+ 1) // PAGE_SIZE
71 for n
in range(1, page_count
+ 1):
72 lpage_url
= url
+ '/public/%d' % n
73 lpage
= self
._download
_webpage
(
75 note
='Downloading page %d/%d' % (n
, page_count
))
78 r
'<div[^>]+class=["\']preview
[^
>]+>\s
*<a
[^
>]+href
="(https?://videos\.toypics\.net/view/[^"]+)"',