mirror of https://github.com/yt-dlp/yt-dlp.git
Compare commits
19 Commits
a9bb3fc819
...
d2d4a081cb
Author | SHA1 | Date |
---|---|---|
Abdessamad Derraz | d2d4a081cb | |
bashonly | 1a366403d9 | |
Simon Sawicki | 7e26bd53f9 | |
Abdessamad Derraz | 7d87c09c5d | |
Abdessamad Derraz | 8a0f2ffd80 | |
Abdessamad DERRAZ | e61606eaf2 | |
Abdessamad Derraz | 931a90e7da | |
Abdessamad Derraz | fddf9a60ee | |
Abdessamad Derraz | 182a18eaa0 | |
Abdessamad DERRAZ | e7f90d887d | |
Abdessamad DERRAZ | bee20eeb82 | |
Abdessamad DERRAZ | c1b5121932 | |
Abdessamad DERRAZ | 7f44d0fa02 | |
Abdessamad DERRAZ | 19cc97d1a1 | |
Abdessamad DERRAZ | f5fc4de7c9 | |
Abdessamad DERRAZ | a997e972a5 | |
Abdessamad DERRAZ | 0dd98c888d | |
Abdessamad DERRAZ | 378ecc6b65 | |
Abdessamad DERRAZ | fe8d9ec837 |
|
@ -300,7 +300,7 @@ jobs:
|
|||
macos_legacy:
|
||||
needs: process
|
||||
if: inputs.macos_legacy
|
||||
runs-on: macos-latest
|
||||
runs-on: macos-12
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
|
|
@ -2090,10 +2090,7 @@ Line 1
|
|||
|
||||
args = [sys.executable, '-c', 'import sys; print(end=sys.argv[1])', argument, 'end']
|
||||
assert run_shell(args) == expected
|
||||
|
||||
escaped = shell_quote(argument, shell=True)
|
||||
args = f'{sys.executable} -c "import sys; print(end=sys.argv[1])" {escaped} end'
|
||||
assert run_shell(args) == expected
|
||||
assert run_shell(shell_quote(args, shell=True)) == expected
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -752,6 +752,7 @@ from .hollywoodreporter import (
|
|||
)
|
||||
from .holodex import HolodexIE
|
||||
from .hotnewhiphop import HotNewHipHopIE
|
||||
from .hotmart import HotmartIE
|
||||
from .hotstar import (
|
||||
HotStarIE,
|
||||
HotStarPrefixIE,
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
from .common import InfoExtractor
|
||||
from ..utils import (
|
||||
get_element_by_id,
|
||||
traverse_obj,
|
||||
int_or_none,
|
||||
url_or_none,
|
||||
)
|
||||
|
||||
|
||||
class HotmartIE(InfoExtractor):
|
||||
_VALID_URL = r'https?://player\.hotmart\.com/embed/(?P<id>[a-zA-Z0-9]+)'
|
||||
_TESTS = [
|
||||
{
|
||||
'url': (
|
||||
'https://player.hotmart.com/embed/pRQKDWkKLB?signature=S0Pr1OaDwGvKwQ8i6Y9whykEo4uuok2P4AShiYcyarvFkQDT_rBlR5L1qdIbIferFBHfTVJlXcbgUAwMMPiV6sWaA0XIU4OO282MO092DX_Z8KqS1h0Y-452TMjAt3dW2ZYMKWtfA2A2sxM7JmpYZZdMKTrT7nwoPsfbythXfph3dCLzxNQ0gS-rHfD7SYWuKJGN1JmK6iAygJf1thpskoeOJyK04SpDwMoqIOYfsrUktvsJFlV3oWM1tVoeDIQPWSZGXE6WRWDPNmTz6h7IHvc-QKGzoRy3_CvzSEioq2SaDNDdloECrKH37V1eCNvdaIr0dQeHqH_vI0NMBsfCow==&token=aa2d356b-e2f0-45e8-9725-e0efc7b5d29c&autoplay=autoplay'
|
||||
),
|
||||
'md5': '95d7a252bb97954663fcf6c6db4b4555',
|
||||
'info_dict': {
|
||||
'id': 'pRQKDWkKLB',
|
||||
'video_id': 'pRQKDWkKLB',
|
||||
'ext': 'mp4',
|
||||
'title': 'Hotmart video #pRQKDWkKLB',
|
||||
'thumbnail': (
|
||||
r're:https?://.*\.(?:jpg|jpeg|png|gif)\?token=exp=\d+~acl=.*~hmac=[a-f0-9]+$'
|
||||
),
|
||||
},
|
||||
}
|
||||
]
|
||||
|
||||
def _real_extract(self, url):
|
||||
video_id = self._match_id(url)
|
||||
|
||||
webpage = self._download_webpage(url, video_id)
|
||||
|
||||
video_data_string = get_element_by_id('__NEXT_DATA__', webpage)
|
||||
video_data = self._parse_json(video_data_string, video_id, fatal=False)
|
||||
|
||||
title = self._html_search_meta(
|
||||
['og:title', 'title', 'twitter:title'],
|
||||
webpage, 'title', default='Hotmart video #' + video_id
|
||||
)
|
||||
|
||||
url = traverse_obj(
|
||||
video_data,
|
||||
(
|
||||
'props',
|
||||
'pageProps',
|
||||
'applicationData',
|
||||
'mediaAssets',
|
||||
0,
|
||||
'urlEncrypted',
|
||||
),
|
||||
expected_type=url_or_none,
|
||||
)
|
||||
thumbnail_url = traverse_obj(
|
||||
video_data,
|
||||
('props', 'pageProps', 'applicationData', 'thumbnailUrl'),
|
||||
expected_type=url_or_none,
|
||||
)
|
||||
|
||||
formats, subtitles = self._extract_m3u8_formats_and_subtitles(
|
||||
url, video_id, 'mp4', fatal=False
|
||||
)
|
||||
|
||||
description = self._og_search_description(webpage, default=None)
|
||||
chapter = None
|
||||
chapter_number = None
|
||||
|
||||
return {
|
||||
'id': video_id,
|
||||
'video_id': video_id,
|
||||
'thumbnail': thumbnail_url,
|
||||
'formats': formats,
|
||||
'subtitles': subtitles,
|
||||
'title': title,
|
||||
'description': description,
|
||||
'chapter': chapter,
|
||||
'chapter_number': int_or_none(chapter_number),
|
||||
}
|
|
@ -1,12 +1,14 @@
|
|||
import re
|
||||
|
||||
from .common import InfoExtractor
|
||||
from .wistia import WistiaIE
|
||||
from .hotmart import HotmartIE
|
||||
from ..utils import (
|
||||
clean_html,
|
||||
extract_attributes,
|
||||
ExtractorError,
|
||||
int_or_none,
|
||||
get_element_by_class,
|
||||
get_elements_html_by_class,
|
||||
int_or_none,
|
||||
strip_or_none,
|
||||
urlencode_postdata,
|
||||
urljoin,
|
||||
|
@ -111,15 +113,16 @@ class TeachableIE(TeachableBaseIE):
|
|||
_TESTS = [{
|
||||
'url': 'https://gns3.teachable.com/courses/gns3-certified-associate/lectures/6842364',
|
||||
'info_dict': {
|
||||
'id': 'untlgzk1v7',
|
||||
'ext': 'bin',
|
||||
'id': 'Nq7vkXmXRA',
|
||||
'video_id': 'Nq7vkXmXRA',
|
||||
'ext': 'mp4',
|
||||
'title': 'Overview',
|
||||
'description': 'md5:071463ff08b86c208811130ea1c2464c',
|
||||
'duration': 736.4,
|
||||
'timestamp': 1542315762,
|
||||
'upload_date': '20181115',
|
||||
'chapter': 'Welcome',
|
||||
'chapter_number': 1,
|
||||
'webpage_url': r're:https://player.hotmart.com/embed/Nq7vkXmXRA\?signature=.+&token=.+',
|
||||
'width': 1920,
|
||||
'height': 1080,
|
||||
'thumbnail': r're:https?://.*\.(?:jpg|jpeg|webp)\?token=exp=\d+~acl=.*~hmac=[a-f0-9]+$',
|
||||
},
|
||||
'params': {
|
||||
'skip_download': True,
|
||||
|
@ -127,6 +130,9 @@ class TeachableIE(TeachableBaseIE):
|
|||
}, {
|
||||
'url': 'http://v1.upskillcourses.com/courses/119763/lectures/1747100',
|
||||
'only_matching': True,
|
||||
}, {
|
||||
'url': 'http://v1.upskillcourses.com/courses/119763/lectures/1747100',
|
||||
'only_matching': True,
|
||||
}, {
|
||||
'url': 'https://gns3.teachable.com/courses/423415/lectures/6885939',
|
||||
'only_matching': True,
|
||||
|
@ -161,13 +167,35 @@ class TeachableIE(TeachableBaseIE):
|
|||
|
||||
webpage = self._download_webpage(url, video_id)
|
||||
|
||||
wistia_urls = WistiaIE._extract_embed_urls(url, webpage)
|
||||
if not wistia_urls:
|
||||
hotmart_container_elements = get_elements_html_by_class(
|
||||
'hotmart_video_player', webpage
|
||||
)
|
||||
hotmart_urls = []
|
||||
for hotmart_container_element in hotmart_container_elements:
|
||||
hotmart_container_attributes = extract_attributes(hotmart_container_element)
|
||||
attachment_id = hotmart_container_attributes['data-attachment-id']
|
||||
|
||||
hotmart_video_url_data = self._download_json(
|
||||
f'https://{site}/api/v2/hotmart/private_video',
|
||||
video_id,
|
||||
query={'attachment_id': attachment_id},
|
||||
)
|
||||
|
||||
hotmart_url = (
|
||||
'https://player.hotmart.com/embed/'
|
||||
f'{hotmart_video_url_data ["video_id"]}?'
|
||||
f'signature={hotmart_video_url_data ["signature"]}&'
|
||||
'token='
|
||||
f'{hotmart_video_url_data ["teachable_application_key"]}'
|
||||
)
|
||||
|
||||
hotmart_urls.append(hotmart_url)
|
||||
|
||||
if not hotmart_urls:
|
||||
if any(re.search(p, webpage) for p in (
|
||||
r'class=["\']lecture-contents-locked',
|
||||
r'>\s*Lecture contents locked',
|
||||
r'id=["\']lecture-locked',
|
||||
# https://academy.tailoredtutors.co.uk/courses/108779/lectures/1955313
|
||||
r'class=["\'](?:inner-)?lesson-locked',
|
||||
r'>LESSON LOCKED<')):
|
||||
self.raise_login_required('Lecture contents locked')
|
||||
|
@ -196,14 +224,16 @@ class TeachableIE(TeachableBaseIE):
|
|||
if chapter_number <= len(sections):
|
||||
chapter = sections[chapter_number - 1]
|
||||
|
||||
entries = [{
|
||||
'_type': 'url_transparent',
|
||||
'url': wistia_url,
|
||||
'ie_key': WistiaIE.ie_key(),
|
||||
'title': title,
|
||||
'chapter': chapter,
|
||||
'chapter_number': chapter_number,
|
||||
} for wistia_url in wistia_urls]
|
||||
entries = []
|
||||
for hotmart_url in hotmart_urls:
|
||||
entries.append({
|
||||
'_type': 'url_transparent',
|
||||
'url': hotmart_url,
|
||||
'ie_key': HotmartIE.ie_key(),
|
||||
'title': title,
|
||||
'chapter': chapter,
|
||||
'chapter_number': chapter_number,
|
||||
})
|
||||
|
||||
return self.playlist_result(entries, video_id, title)
|
||||
|
||||
|
|
Loading…
Reference in New Issue