]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/toypics.py
1 from .common
import InfoExtractor
5 class ToypicsIE(InfoExtractor
):
6 IE_DESC
= 'Toypics video'
7 _VALID_URL
= r
'https?://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 video_id
= self
._match
_id
(url
)
23 webpage
= self
._download
_webpage
(url
, video_id
)
25 formats
= self
._parse
_html
5_media
_entries
(
26 url
, webpage
, video_id
)[0]['formats']
27 title
= self
._html
_search
_regex
([
28 r
'<h1[^>]+class=["\']view
-video
-title
[^
>]+>([^
<]+)</h
',
29 r'<title
>([^
<]+) - Toypics
</title
>',
32 uploader = self._html_search_regex(
33 r'More videos
from <strong
>([^
<]+)</strong
>', webpage, 'uploader
',
45 class ToypicsUserIE(InfoExtractor):
46 IE_DESC = 'Toypics user profile
'
47 _VALID_URL = r'https?
://videos\
.toypics\
.net
/(?
!view
)(?P
<id>[^
/?
#&]+)'
49 'url': 'http://videos.toypics.net/Mikey',
53 'playlist_mincount': 19,
56 def _real_extract(self
, url
):
57 username
= self
._match
_id
(url
)
59 profile_page
= self
._download
_webpage
(
60 url
, username
, note
='Retrieving profile page')
62 video_count
= int(self
._search
_regex
(
63 r
'public/">Public Videos \(([0-9]+)\)</a></li>', profile_page
,
68 page_count
= (video_count
+ PAGE_SIZE
+ 1) // PAGE_SIZE
69 for n
in range(1, page_count
+ 1):
70 lpage_url
= url
+ '/public/%d' % n
71 lpage
= self
._download
_webpage
(
73 note
='Downloading page %d/%d' % (n
, page_count
))
76 r
'<div[^>]+class=["\']preview
[^
>]+>\s
*<a
[^
>]+href
="(https?://videos\.toypics\.net/view/[^"]+)"',