mirror of
https://github.com/ytdl-org/youtube-dl
synced 2025-01-21 02:40:10 +09:00
Added playlist extraction functionality
This commit is contained in:
parent
1dcca5c300
commit
ee1b02ab83
@ -1,8 +1,10 @@
|
|||||||
|
# coding: utf-8
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from .common import InfoExtractor
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
|
||||||
|
|
||||||
class TASVideosIE(InfoExtractor):
|
class TASVideosIE(InfoExtractor):
|
||||||
_VALID_URL = r'http://tasvideos.org/(?P<id>\d+M)\.html'
|
_VALID_URL = r'http://tasvideos.org/(?P<id>\d+M)\.html'
|
||||||
@ -11,7 +13,7 @@ class TASVideosIE(InfoExtractor):
|
|||||||
'md5': '8dced25a575e853cec5533a887a8dcfc',
|
'md5': '8dced25a575e853cec5533a887a8dcfc',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '4352M',
|
'id': '4352M',
|
||||||
'ext': 'mkv',
|
'ext': 'mp4',
|
||||||
'title': 'C64 L\'Abbaye des Morts',
|
'title': 'C64 L\'Abbaye des Morts',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -25,12 +27,11 @@ class TASVideosIE(InfoExtractor):
|
|||||||
title = self._search_regex(
|
title = self._search_regex(
|
||||||
r'<span title="Movie[^"]+">(?P<TITLE>[^<]+)<\/span>', webpage,
|
r'<span title="Movie[^"]+">(?P<TITLE>[^<]+)<\/span>', webpage,
|
||||||
'title')
|
'title')
|
||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
|
|
||||||
for url in video_urls:
|
for url in video_urls:
|
||||||
format_entry = {'url': "http://www." + url}
|
format_entry = {'url': 'http://www.' + url}
|
||||||
formats.append(format_entry)
|
formats.append(format_entry)
|
||||||
|
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@ -38,3 +39,49 @@ class TASVideosIE(InfoExtractor):
|
|||||||
'title': title,
|
'title': title,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class TASVideosPlaylistIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'http://tasvideos.org/(?P<id>Movies-[^\.]*?)\.html'
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://tasvideos.org/Movies-Stars.html',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'Movies-Stars',
|
||||||
|
'title': 'TASVideos movies: Tier Stars',
|
||||||
|
},
|
||||||
|
'playlist_count': 114,
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
playlist_id = self._match_id(url)
|
||||||
|
webpage = self._download_webpage(url, playlist_id)
|
||||||
|
playlist_title = self._search_regex(
|
||||||
|
r'<title>(?P<title>[^<]*)</title>', webpage, 'title')
|
||||||
|
video_entries = re.findall(
|
||||||
|
r'((?s)<table class="item".*?archive.*?<\/table)>', webpage)
|
||||||
|
entries = []
|
||||||
|
for entry in video_entries:
|
||||||
|
video_urls = re.findall(
|
||||||
|
r'<a [^>]+(?P<URL>archive\.org\/download[^<]+\.(?:mkv|mp4|avi))[^<]+<\/a>',
|
||||||
|
entry)
|
||||||
|
title = self._search_regex(
|
||||||
|
r'<span title="Movie[^"]+">(?P<title>[^<]+)<\/span>', entry,
|
||||||
|
'title')
|
||||||
|
video_id = self._search_regex(
|
||||||
|
r'id="movie_(?P<id>\d+)', entry, 'video id') + 'M'
|
||||||
|
|
||||||
|
formats = []
|
||||||
|
for url in video_urls:
|
||||||
|
format_entry = {'url': "http://www." + url}
|
||||||
|
formats.append(format_entry)
|
||||||
|
|
||||||
|
self._sort_formats(formats)
|
||||||
|
|
||||||
|
formats = {
|
||||||
|
'id': video_id,
|
||||||
|
'title': title,
|
||||||
|
'formats': formats,
|
||||||
|
}
|
||||||
|
entries.append(formats)
|
||||||
|
|
||||||
|
return self.playlist_result(entries, playlist_id, playlist_title)
|
||||||
|
Loading…
Reference in New Issue
Block a user