* Revert "[francetv] Separate main extractor and rework others to delegate to it" This reverts commit 24b97ef14a944edeb00bf81ed0ddc990459e3bc3. * Revert "[francetv] Improve manifest URL signing (closes #15536)" This reverts commit 6f54dce07d5ab9780e653193a9db53013712f19d. * Revert "[francetv] Sign m3u8 manifest URLs (closes #15565)" This reverts commit 4eb4ace765dae302460291a790c5e81f373ce5cc. * Revert "[veoh] Add support for embed URLs" This reverts commit 6adfc88ce6034563f6e275c72131cdf87e2d2ab6. * Revert "[dvtv] Skip download on failing test" This reverts commit ad4167ed33a00c70d411e68e5745482880ad2855. * Revert "[afreecatv] Fix extraction (closes #15556)" This reverts commit 8cc0cd0a2ff7bfe27d3571aa75cab841f6f96f91. * Revert "[periscope] Use accessVideoPublic endpoint (closes #15554)" This reverts commit b6aef8f69f16724ca8705823c86a349b97eceeff. * Revert "[YoutubeDL] Add support for filesize_approx in format selector (closes #15550)" This reverts commit eb048b366869f19e3138a76af7c31325c7a66b70. * Revert "[discovery] Fix auth request (closes #15542)" This reverts commit 14adea5bc7d0c0324716403717b3f234aec4d7bb. * Revert "[6play] Extract subtitles (closes #15541)" This reverts commit aee441166254bf3d6810ddaaca2ca6de7f327899. * Revert "Credit @mweinelt for #15124" This reverts commit 82eaab7f58f0a1a0ff85d2829ce48dd61bbbcefe. * Revert "Credit @iamleot for internazionale (#14973)" This reverts commit fdd87ce20957a903653336621797cea866db204f. * Revert "Credit @che0 for seznamzpravy (#14616) and dvtv (#15442)" This reverts commit 9b904aaeba37fa218ddad01bb04a5ea7c8d585aa. * Revert "[newgrounds] Fix metadata extraction (closes #15531)" This reverts commit 8be35d3cd121029b0c134cd3b5672c46add7b88d. * Revert "[nbc] add support for NBC Olympics Streams(closes #10295)" This reverts commit ba6e116f59c296f78668b1b665657b33e7c40410. * Revert "[dvtv] Simplify (closes #15442)" This reverts commit 2da0581a746fe6a98a331a646e64840d7ef78bc0. * Revert "[dvtv] Fix live streams extraction" This reverts commit 773234624f2a8e63a382cba91228a0445261d783. * Revert "release 2018.02.08" This reverts commit 0204b2a7b183a412c5a13bc306f8d77a0de6f9a8. * Revert "[ChangeLog] Actualize" This reverts commit 72aa0a29e54dee40f1b52da5c2e2aa46886dee1b. * Revert "[extractors] Import for myvi:embed" This reverts commit 38e519ff0327b5b4067d5c3b0c40d651c8a508f9. * Revert "[pokemon] PEP 8" This reverts commit 7b11f92ae02d791a1115537c6bd3c129198a7810. * Revert "[gameinformer] PEP 8" This reverts commit aa71431e28de547fb55ab55e47817769c8e91029. * Revert "[myvi] Extend _VALID_URL" This reverts commit 441ec65fd33e224bee2e49092a45af9b1c92fd90. * Revert "[myvi:embed] Add extractor (closes #15521)" This reverts commit e35a984bc7623226bfba13e6c94a2f3cf8fc76fe. * Revert "[prosiebensat1] Extend _VALID_URL (closes #15520)" This reverts commit 0e1a732e390e0e90b48fc54e3b6b61c9accb043a. * Revert "[pokemon] Relax _VALID_URL and extend title extraction (closes #15518)" This reverts commit 8a768fe854833d29eab2cb695ed2e154d2b2cf28. * Revert "[gameinformer] Use geo verification headers" This reverts commit 6cdc00e9989adf7d2e4a09e838791f39dce7c118. * Revert "[la7] Fix extraction (closes #15501)" This reverts commit 8d2fbb06a9fe5821d143039716b058cbd2ae0267. * Revert "[gameinformer] Fix brightcove id extraction" This reverts commit dc1171da811f5f055aab82bb34b068bd6496ca47. * Revert "[afreecatv] Pass referrer to video info request (closes #15507)" This reverts commit c16af2cb4ea0011b3103751574e0b2e2404b3783. * Revert "[telebruxelles] Relax _VALID_URL and add support for live streams" This reverts commit 1f916ea01b9fc6df933d7220100ef14a859fd63c. * Revert "[telebruxelles] Fix extraction (closes #15504)" This reverts commit ea7a8f529844d5ccc201d2d689c07bddce91f3c5. * Revert "[extractor/common] Respect secure schemes in _extract_wowza_formats" This reverts commit b44f7f4fc8d69ea8da69287c4c94f2dfe4c8aec0. * Revert "release 2018.02.04" This reverts commit ed4de10767c633eaa13c4415b4b6819e2cc358c7. * Revert "[ChangeLog] Actualize" This reverts commit f277eb6c9d5d995697fc8f37cb8bcb0780be19b8. * Revert "[brightcove] Pass embed page URL as referrer (closes #15486)" This reverts commit a690cb67422b4d1b1a4976fa4e51444467ac6656. * Revert "[downloader/http] Randomize HTTP chunk size" This reverts commit c315342edb0caa310a184e7c6863cee38abca916. * Revert "[youtube] Enforce using chunked HTTP downloading for DASH formats" This reverts commit 7412fe8d5e8f6229135f3f9d2ca70c91cc5a9e11. * Revert "[downloader/http] Add ability to pass downloader options via info dict" This reverts commit 6cfd25a8e0bd236e1d276f44430e9a6d2545237c. * Revert "[downloader/http] Fix 302 infinite loops by not reusing requests" This reverts commit 57c3eea4e579a0a2e259c409d2139577e382e8f8. * Revert "Document http_chunk_size" This reverts commit ff3f520741a721b2022baa99fedbcb94b1c37632.
167 lines
5.3 KiB
Python
167 lines
5.3 KiB
Python
from __future__ import unicode_literals
|
|
|
|
import re
|
|
|
|
from .common import InfoExtractor
|
|
from ..utils import (
|
|
extract_attributes,
|
|
int_or_none,
|
|
parse_duration,
|
|
parse_filesize,
|
|
unified_timestamp,
|
|
)
|
|
|
|
|
|
class NewgroundsIE(InfoExtractor):
|
|
_VALID_URL = r'https?://(?:www\.)?newgrounds\.com/(?:audio/listen|portal/view)/(?P<id>[0-9]+)'
|
|
_TESTS = [{
|
|
'url': 'https://www.newgrounds.com/audio/listen/549479',
|
|
'md5': 'fe6033d297591288fa1c1f780386f07a',
|
|
'info_dict': {
|
|
'id': '549479',
|
|
'ext': 'mp3',
|
|
'title': 'B7 - BusMode',
|
|
'uploader': 'Burn7',
|
|
'timestamp': 1378878540,
|
|
'upload_date': '20130911',
|
|
'duration': 143,
|
|
},
|
|
}, {
|
|
'url': 'https://www.newgrounds.com/portal/view/673111',
|
|
'md5': '3394735822aab2478c31b1004fe5e5bc',
|
|
'info_dict': {
|
|
'id': '673111',
|
|
'ext': 'mp4',
|
|
'title': 'Dancin',
|
|
'uploader': 'Squirrelman82',
|
|
'timestamp': 1460256780,
|
|
'upload_date': '20160410',
|
|
},
|
|
}, {
|
|
# source format unavailable, additional mp4 formats
|
|
'url': 'http://www.newgrounds.com/portal/view/689400',
|
|
'info_dict': {
|
|
'id': '689400',
|
|
'ext': 'mp4',
|
|
'title': 'ZTV News Episode 8',
|
|
'uploader': 'BennettTheSage',
|
|
'timestamp': 1487965140,
|
|
'upload_date': '20170224',
|
|
},
|
|
'params': {
|
|
'skip_download': True,
|
|
},
|
|
}]
|
|
|
|
def _real_extract(self, url):
|
|
media_id = self._match_id(url)
|
|
|
|
webpage = self._download_webpage(url, media_id)
|
|
|
|
title = self._html_search_regex(
|
|
r'<title>([^>]+)</title>', webpage, 'title')
|
|
|
|
media_url = self._parse_json(self._search_regex(
|
|
r'"url"\s*:\s*("[^"]+"),', webpage, ''), media_id)
|
|
|
|
formats = [{
|
|
'url': media_url,
|
|
'format_id': 'source',
|
|
'quality': 1,
|
|
}]
|
|
|
|
max_resolution = int_or_none(self._search_regex(
|
|
r'max_resolution["\']\s*:\s*(\d+)', webpage, 'max resolution',
|
|
default=None))
|
|
if max_resolution:
|
|
url_base = media_url.rpartition('.')[0]
|
|
for resolution in (360, 720, 1080):
|
|
if resolution > max_resolution:
|
|
break
|
|
formats.append({
|
|
'url': '%s.%dp.mp4' % (url_base, resolution),
|
|
'format_id': '%dp' % resolution,
|
|
'height': resolution,
|
|
})
|
|
|
|
self._check_formats(formats, media_id)
|
|
self._sort_formats(formats)
|
|
|
|
uploader = self._search_regex(
|
|
r'(?:Author|Writer)\s*<a[^>]+>([^<]+)', webpage, 'uploader',
|
|
fatal=False)
|
|
|
|
timestamp = unified_timestamp(self._search_regex(
|
|
r'<dt>Uploaded</dt>\s*<dd>([^<]+)', webpage, 'timestamp',
|
|
default=None))
|
|
duration = parse_duration(self._search_regex(
|
|
r'<dd>Song\s*</dd><dd>.+?</dd><dd>([^<]+)', webpage, 'duration',
|
|
default=None))
|
|
|
|
filesize_approx = parse_filesize(self._html_search_regex(
|
|
r'<dd>Song\s*</dd><dd>(.+?)</dd>', webpage, 'filesize',
|
|
default=None))
|
|
if len(formats) == 1:
|
|
formats[0]['filesize_approx'] = filesize_approx
|
|
|
|
if '<dd>Song' in webpage:
|
|
formats[0]['vcodec'] = 'none'
|
|
|
|
return {
|
|
'id': media_id,
|
|
'title': title,
|
|
'uploader': uploader,
|
|
'timestamp': timestamp,
|
|
'duration': duration,
|
|
'formats': formats,
|
|
}
|
|
|
|
|
|
class NewgroundsPlaylistIE(InfoExtractor):
|
|
_VALID_URL = r'https?://(?:www\.)?newgrounds\.com/(?:collection|[^/]+/search/[^/]+)/(?P<id>[^/?#&]+)'
|
|
_TESTS = [{
|
|
'url': 'https://www.newgrounds.com/collection/cats',
|
|
'info_dict': {
|
|
'id': 'cats',
|
|
'title': 'Cats',
|
|
},
|
|
'playlist_mincount': 46,
|
|
}, {
|
|
'url': 'http://www.newgrounds.com/portal/search/author/ZONE-SAMA',
|
|
'info_dict': {
|
|
'id': 'ZONE-SAMA',
|
|
'title': 'Portal Search: ZONE-SAMA',
|
|
},
|
|
'playlist_mincount': 47,
|
|
}, {
|
|
'url': 'http://www.newgrounds.com/audio/search/title/cats',
|
|
'only_matching': True,
|
|
}]
|
|
|
|
def _real_extract(self, url):
|
|
playlist_id = self._match_id(url)
|
|
|
|
webpage = self._download_webpage(url, playlist_id)
|
|
|
|
title = self._search_regex(
|
|
r'<title>([^>]+)</title>', webpage, 'title', default=None)
|
|
|
|
# cut left menu
|
|
webpage = self._search_regex(
|
|
r'(?s)<div[^>]+\bclass=["\']column wide(.+)',
|
|
webpage, 'wide column', default=webpage)
|
|
|
|
entries = []
|
|
for a, path, media_id in re.findall(
|
|
r'(<a[^>]+\bhref=["\']/?((?:portal/view|audio/listen)/(\d+))[^>]+>)',
|
|
webpage):
|
|
a_class = extract_attributes(a).get('class')
|
|
if a_class not in ('item-portalsubmission', 'item-audiosubmission'):
|
|
continue
|
|
entries.append(
|
|
self.url_result(
|
|
'https://www.newgrounds.com/%s' % path,
|
|
ie=NewgroundsIE.ie_key(), video_id=media_id))
|
|
|
|
return self.playlist_result(entries, playlist_id, title)
|