mirror of https://github.com/yt-dlp/yt-dlp
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
88 lines
2.6 KiB
Python
88 lines
2.6 KiB
Python
![]()
11 years ago
|
from .common import InfoExtractor
|
||
|
import re
|
||
|
|
||
![]()
11 years ago
|
|
||
![]()
11 years ago
|
class ToypicsIE(InfoExtractor):
|
||
![]()
7 years ago
|
IE_DESC = 'Toypics video'
|
||
|
_VALID_URL = r'https?://videos\.toypics\.net/view/(?P<id>[0-9]+)'
|
||
![]()
11 years ago
|
_TEST = {
|
||
|
'url': 'http://videos.toypics.net/view/514/chancebulged,-2-1/',
|
||
![]()
11 years ago
|
'md5': '16e806ad6d6f58079d210fe30985e08b',
|
||
![]()
11 years ago
|
'info_dict': {
|
||
|
'id': '514',
|
||
|
'ext': 'mp4',
|
||
![]()
7 years ago
|
'title': "Chance-Bulge'd, 2",
|
||
![]()
11 years ago
|
'age_limit': 18,
|
||
|
'uploader': 'kidsune',
|
||
![]()
11 years ago
|
}
|
||
|
}
|
||
|
|
||
|
def _real_extract(self, url):
|
||
![]()
7 years ago
|
video_id = self._match_id(url)
|
||
|
|
||
|
webpage = self._download_webpage(url, video_id)
|
||
|
|
||
|
formats = self._parse_html5_media_entries(
|
||
|
url, webpage, video_id)[0]['formats']
|
||
![]()
7 years ago
|
title = self._html_search_regex([
|
||
|
r'<h1[^>]+class=["\']view-video-title[^>]+>([^<]+)</h',
|
||
|
r'<title>([^<]+) - Toypics</title>',
|
||
![]()
7 years ago
|
], webpage, 'title')
|
||
|
|
||
|
uploader = self._html_search_regex(
|
||
|
r'More videos from <strong>([^<]+)</strong>', webpage, 'uploader',
|
||
|
fatal=False)
|
||
|
|
||
![]()
11 years ago
|
return {
|
||
|
'id': video_id,
|
||
![]()
7 years ago
|
'formats': formats,
|
||
![]()
11 years ago
|
'title': title,
|
||
![]()
7 years ago
|
'uploader': uploader,
|
||
![]()
11 years ago
|
'age_limit': 18,
|
||
|
}
|
||
|
|
||
|
|
||
|
class ToypicsUserIE(InfoExtractor):
|
||
|
IE_DESC = 'Toypics user profile'
|
||
![]()
7 years ago
|
_VALID_URL = r'https?://videos\.toypics\.net/(?!view)(?P<id>[^/?#&]+)'
|
||
![]()
10 years ago
|
_TEST = {
|
||
|
'url': 'http://videos.toypics.net/Mikey',
|
||
|
'info_dict': {
|
||
|
'id': 'Mikey',
|
||
|
},
|
||
![]()
10 years ago
|
'playlist_mincount': 19,
|
||
![]()
10 years ago
|
}
|
||
![]()
11 years ago
|
|
||
|
def _real_extract(self, url):
|
||
![]()
7 years ago
|
username = self._match_id(url)
|
||
![]()
11 years ago
|
|
||
|
profile_page = self._download_webpage(
|
||
|
url, username, note='Retrieving profile page')
|
||
|
|
||
|
video_count = int(self._search_regex(
|
||
|
r'public/">Public Videos \(([0-9]+)\)</a></li>', profile_page,
|
||
|
'video count'))
|
||
|
|
||
|
PAGE_SIZE = 8
|
||
|
urls = []
|
||
|
page_count = (video_count + PAGE_SIZE + 1) // PAGE_SIZE
|
||
|
for n in range(1, page_count + 1):
|
||
|
lpage_url = url + '/public/%d' % n
|
||
|
lpage = self._download_webpage(
|
||
|
lpage_url, username,
|
||
|
note='Downloading page %d/%d' % (n, page_count))
|
||
|
urls.extend(
|
||
|
re.findall(
|
||
![]()
7 years ago
|
r'<div[^>]+class=["\']preview[^>]+>\s*<a[^>]+href="(https?://videos\.toypics\.net/view/[^"]+)"',
|
||
![]()
11 years ago
|
lpage))
|
||
|
|
||
|
return {
|
||
|
'_type': 'playlist',
|
||
|
'id': username,
|
||
|
'entries': [{
|
||
|
'_type': 'url',
|
||
![]()
11 years ago
|
'url': eurl,
|
||
![]()
11 years ago
|
'ie_key': 'Toypics',
|
||
![]()
11 years ago
|
} for eurl in urls]
|
||
![]()
11 years ago
|
}
|