mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-26 17:21:23 +01:00
Compare commits
9 Commits
ce593f1608
...
de2446d168
Author | SHA1 | Date | |
---|---|---|---|
|
de2446d168 | ||
|
b83ca24eb7 | ||
|
240a7d43c8 | ||
|
f13df591d4 | ||
|
e640e1fae3 | ||
|
92a176955f | ||
|
dbb1b746d4 | ||
|
db4b19eaff | ||
|
9a235dd6f9 |
3
.github/workflows/build.yml
vendored
3
.github/workflows/build.yml
vendored
|
@ -504,7 +504,8 @@ jobs:
|
||||||
- windows32
|
- windows32
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/download-artifact@v4
|
- name: Download artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
path: artifact
|
path: artifact
|
||||||
pattern: build-bin-*
|
pattern: build-bin-*
|
||||||
|
|
17
.github/workflows/release-master.yml
vendored
17
.github/workflows/release-master.yml
vendored
|
@ -28,3 +28,20 @@ jobs:
|
||||||
actions: write # For cleaning up cache
|
actions: write # For cleaning up cache
|
||||||
id-token: write # mandatory for trusted publishing
|
id-token: write # mandatory for trusted publishing
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
||||||
|
publish_pypi:
|
||||||
|
needs: [release]
|
||||||
|
if: vars.MASTER_PYPI_PROJECT != ''
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
id-token: write # mandatory for trusted publishing
|
||||||
|
steps:
|
||||||
|
- name: Download artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
path: dist
|
||||||
|
name: build-pypi
|
||||||
|
- name: Publish to PyPI
|
||||||
|
uses: pypa/gh-action-pypi-publish@release/v1
|
||||||
|
with:
|
||||||
|
verbose: true
|
||||||
|
|
17
.github/workflows/release-nightly.yml
vendored
17
.github/workflows/release-nightly.yml
vendored
|
@ -41,3 +41,20 @@ jobs:
|
||||||
actions: write # For cleaning up cache
|
actions: write # For cleaning up cache
|
||||||
id-token: write # mandatory for trusted publishing
|
id-token: write # mandatory for trusted publishing
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
||||||
|
publish_pypi:
|
||||||
|
needs: [release]
|
||||||
|
if: vars.NIGHTLY_PYPI_PROJECT != ''
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
id-token: write # mandatory for trusted publishing
|
||||||
|
steps:
|
||||||
|
- name: Download artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
path: dist
|
||||||
|
name: build-pypi
|
||||||
|
- name: Publish to PyPI
|
||||||
|
uses: pypa/gh-action-pypi-publish@release/v1
|
||||||
|
with:
|
||||||
|
verbose: true
|
||||||
|
|
19
.github/workflows/release.yml
vendored
19
.github/workflows/release.yml
vendored
|
@ -2,10 +2,6 @@ name: Release
|
||||||
on:
|
on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
inputs:
|
inputs:
|
||||||
prerelease:
|
|
||||||
required: false
|
|
||||||
default: true
|
|
||||||
type: boolean
|
|
||||||
source:
|
source:
|
||||||
required: false
|
required: false
|
||||||
default: ''
|
default: ''
|
||||||
|
@ -18,6 +14,10 @@ on:
|
||||||
required: false
|
required: false
|
||||||
default: ''
|
default: ''
|
||||||
type: string
|
type: string
|
||||||
|
prerelease:
|
||||||
|
required: false
|
||||||
|
default: true
|
||||||
|
type: boolean
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
source:
|
source:
|
||||||
|
@ -278,11 +278,20 @@ jobs:
|
||||||
make clean-cache
|
make clean-cache
|
||||||
python -m build --no-isolation .
|
python -m build --no-isolation .
|
||||||
|
|
||||||
|
- name: Upload artifacts
|
||||||
|
if: github.event_name != 'workflow_dispatch'
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: build-pypi
|
||||||
|
path: |
|
||||||
|
dist/*
|
||||||
|
compression-level: 0
|
||||||
|
|
||||||
- name: Publish to PyPI
|
- name: Publish to PyPI
|
||||||
|
if: github.event_name == 'workflow_dispatch'
|
||||||
uses: pypa/gh-action-pypi-publish@release/v1
|
uses: pypa/gh-action-pypi-publish@release/v1
|
||||||
with:
|
with:
|
||||||
verbose: true
|
verbose: true
|
||||||
attestations: false # Currently doesn't work w/ reusable workflows (breaks nightly)
|
|
||||||
|
|
||||||
publish:
|
publish:
|
||||||
needs: [prepare, build]
|
needs: [prepare, build]
|
||||||
|
|
|
@ -52,7 +52,7 @@ default = [
|
||||||
"pycryptodomex",
|
"pycryptodomex",
|
||||||
"requests>=2.32.2,<3",
|
"requests>=2.32.2,<3",
|
||||||
"urllib3>=1.26.17,<3",
|
"urllib3>=1.26.17,<3",
|
||||||
"websockets>=13.0",
|
"websockets>=13.0,<14",
|
||||||
]
|
]
|
||||||
curl-cffi = [
|
curl-cffi = [
|
||||||
"curl-cffi==0.5.10; os_name=='nt' and implementation_name=='cpython'",
|
"curl-cffi==0.5.10; os_name=='nt' and implementation_name=='cpython'",
|
||||||
|
|
|
@ -24,7 +24,7 @@ try:
|
||||||
from Crypto.Cipher import AES, PKCS1_OAEP, Blowfish, PKCS1_v1_5 # noqa: F401
|
from Crypto.Cipher import AES, PKCS1_OAEP, Blowfish, PKCS1_v1_5 # noqa: F401
|
||||||
from Crypto.Hash import CMAC, SHA1 # noqa: F401
|
from Crypto.Hash import CMAC, SHA1 # noqa: F401
|
||||||
from Crypto.PublicKey import RSA # noqa: F401
|
from Crypto.PublicKey import RSA # noqa: F401
|
||||||
except ImportError:
|
except (ImportError, OSError):
|
||||||
__version__ = f'broken {__version__}'.strip()
|
__version__ = f'broken {__version__}'.strip()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,31 +1,31 @@
|
||||||
import urllib.parse
|
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import parse_duration, remove_end, unified_strdate, urljoin
|
from ..utils import clean_html, determine_ext, parse_duration, traverse_obj, unescapeHTML, unified_strdate
|
||||||
|
|
||||||
|
|
||||||
class NDTVIE(InfoExtractor):
|
class NDTVIE(InfoExtractor):
|
||||||
_WORKING = False
|
_WORKING = True
|
||||||
_VALID_URL = r'https?://(?:[^/]+\.)?ndtv\.com/(?:[^/]+/)*videos?/?(?:[^/]+/)*[^/?^&]+-(?P<id>\d+)'
|
_VALID_URL = r'https?://(?:[^/]+\.)?ndtv\.com/(?:[^/]+/)*videos?/?(?:[^/]+/)*[^/?^&]+-(?P<id>\d+)'
|
||||||
|
|
||||||
_TESTS = [
|
_TESTS = [
|
||||||
{
|
{
|
||||||
'url': 'https://khabar.ndtv.com/video/show/prime-time/prime-time-ill-system-and-poor-education-468818',
|
'url': 'https://khabar.ndtv.com/video/show/prime-time/prime-time-ill-system-and-poor-education-468818',
|
||||||
'md5': '78efcf3880ef3fd9b83d405ca94a38eb',
|
'md5': '5237500d57c8af47a519c4af9e2fd9c0',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '468818',
|
'id': '468818',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'प्राइम टाइम: सिस्टम बीमार, स्कूल बदहाल',
|
'title': 'प्राइम टाइम: सिस्टम बीमार, स्कूल बदहाल',
|
||||||
'description': 'md5:f410512f1b49672e5695dea16ef2731d',
|
'description': 'md5:de6008f2439005344c1c0c686032b43a',
|
||||||
'upload_date': '20170928',
|
'upload_date': '20170928',
|
||||||
'duration': 2218,
|
'duration': 2218,
|
||||||
'thumbnail': r're:https?://.*\.jpg',
|
'thumbnail': r're:https?://.*\.jpg',
|
||||||
|
'categories': 'shows',
|
||||||
|
'channel_id': '2',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
# __filename is url
|
|
||||||
'url': 'http://movies.ndtv.com/videos/cracker-free-diwali-wishes-from-karan-johar-kriti-sanon-other-stars-470304',
|
'url': 'http://movies.ndtv.com/videos/cracker-free-diwali-wishes-from-karan-johar-kriti-sanon-other-stars-470304',
|
||||||
'md5': 'f1d709352305b44443515ac56b45aa46',
|
'md5': 'b7ef90f55e63885aef59c59cf2e44e81',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '470304',
|
'id': '470304',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
|
@ -34,6 +34,83 @@ class NDTVIE(InfoExtractor):
|
||||||
'upload_date': '20171019',
|
'upload_date': '20171019',
|
||||||
'duration': 137,
|
'duration': 137,
|
||||||
'thumbnail': r're:https?://.*\.jpg',
|
'thumbnail': r're:https?://.*\.jpg',
|
||||||
|
'categories': 'entertainment',
|
||||||
|
'channel_id': '1',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'url': 'https://www.ndtv.com/video/ndtv-jai-jawan-dnd-john-abraham-is-busy-watching-soldiers-fitness-routine-826286',
|
||||||
|
'md5': '19d9a96480a8dac0e03a42efce27350f',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '826286',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'NDTV Jai Jawan: DND, John Abraham Is Busy Watching Soldiers\' Fitness Routine',
|
||||||
|
'description': 'md5:ad700713b10702555555e6a01a25442a',
|
||||||
|
'upload_date': '20240818',
|
||||||
|
'duration': 220,
|
||||||
|
'thumbnail': 'https://c.ndtvimg.com/2024-08/be8djnjc_jai-jawan_640x480_18_August_24.jpg',
|
||||||
|
'categories': 'entertainment',
|
||||||
|
'channel_id': '1',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'url': 'https://www.ndtv.com/video/cancer-can-be-prevented-cured-with-lifestyle-changes-expert-to-ndtv-827194',
|
||||||
|
'md5': '72734ed9226e200454100ffe7dfae2b6',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '827194',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': '"Cancer Can Be Prevented, Cured With Lifestyle Changes": Expert To NDTV',
|
||||||
|
'description': 'md5:cbecc6372e33370014748db9ad2b5df0',
|
||||||
|
'upload_date': '20240818',
|
||||||
|
'duration': 931,
|
||||||
|
'thumbnail': 'https://c.ndtvimg.com/2024-08/hh48aduk_dr-sameer-kaul_640x480_18_August_24.jpg',
|
||||||
|
'categories': 'news',
|
||||||
|
'channel_id': '1',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'url': 'https://sports.ndtv.com/cricket/videos/ex-india-captain-ms-dhoni-spotted-at-airport-820044',
|
||||||
|
'md5': '9f3442f49aa660623e8925c0fc7606a4',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '820044',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Ex-India Captain MS Dhoni Spotted At Airport',
|
||||||
|
'description': 'md5:7be70dbb543bb647f83dbd6e7b8f16a0',
|
||||||
|
'upload_date': '20240730',
|
||||||
|
'duration': 45,
|
||||||
|
'thumbnail': 'https://c.ndtvimg.com/2024-07/itrg8ilo_msdhoni_640x480_31_July_24.jpg',
|
||||||
|
'categories': 'fangully',
|
||||||
|
'channel_id': '',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'url': 'https://doctor.ndtv.com/videos/attack-the-heart-attack-a-public-awareness-initiative-by-medtronics-822292',
|
||||||
|
'md5': 'a13ad8bbb45eec4405a45f9bd7ed0356',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '822292',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Attack The Heart Attack - A Public Awareness Initiative By Medtronics',
|
||||||
|
'description': 'md5:31b876e23795b4d7ef91797f88b22730',
|
||||||
|
'upload_date': '20240805',
|
||||||
|
'duration': 1304,
|
||||||
|
'thumbnail': 'https://c.ndtvimg.com/2024-08/kh67tomo_heartattack_640x480_05_August_24.jpg',
|
||||||
|
'categories': 'Health',
|
||||||
|
'channel_id': '1',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'url': 'https://food.ndtv.com/video-watch-ndtv-food-awards-2024-on-ndtv-24x7-on-saturday-9th-march-2024-767098',
|
||||||
|
'md5': '78ddea4f057115e84952563749c6b94c',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '767098',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Watch NDTV Food Awards 2024 On NDTV 24x7 On Saturday 9th March, 2024',
|
||||||
|
'description': 'md5:11948e8404b058cd0a9d174aa1e88e84',
|
||||||
|
'upload_date': '20240307',
|
||||||
|
'duration': 35,
|
||||||
|
'thumbnail': 'https://c.ndtvimg.com/2024-03/2eianfs_food-awards_640x480_08_March_24.jpg',
|
||||||
|
'categories': 'food',
|
||||||
|
'channel_id': '1',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -74,34 +151,46 @@ class NDTVIE(InfoExtractor):
|
||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
# '__title' does not contain extra words such as sub-site name, "Video" etc.
|
# required for removing unwanted js expression in the json data
|
||||||
title = urllib.parse.unquote_plus(
|
# found this expression in one article
|
||||||
self._search_regex(r"__title\s*=\s*'([^']+)'", webpage, 'title', default=None)
|
# will update this json data handler more generic if more of similar patterns found
|
||||||
or self._og_search_title(webpage))
|
webpage = webpage.replace('true / false', 'true')
|
||||||
|
|
||||||
filename = self._search_regex(
|
data = self._search_json(r'__html5playerdata\s*=\s*', webpage, 'json_data', video_id)
|
||||||
r"(?:__)?filename\s*[:=]\s*'([^']+)'", webpage, 'video filename')
|
|
||||||
# in "movies" sub-site pages, filename is URL
|
|
||||||
video_url = urljoin('https://ndtvod.bc-ssl.cdn.bitgravity.com/23372/ndtv/', filename.lstrip('/'))
|
|
||||||
|
|
||||||
# "doctor" sub-site has MM:SS format
|
title = clean_html(unescapeHTML(traverse_obj(data, ('title'))))
|
||||||
duration = parse_duration(self._search_regex(
|
duration = parse_duration(traverse_obj(data, ('dur')))
|
||||||
r"(?:__)?duration\s*[:=]\s*'([^']+)'", webpage, 'duration', fatal=False))
|
upload_date = unified_strdate(traverse_obj(data, ('date')))
|
||||||
|
video_m3u8 = traverse_obj(data, ('media'))
|
||||||
|
video_mp4 = traverse_obj(data, ('media_mp4'))
|
||||||
|
video_webm = traverse_obj(data, ('media_webm'))
|
||||||
|
description = clean_html(unescapeHTML(traverse_obj(data, ('description'))))
|
||||||
|
thumbnail = traverse_obj(data, ('image'))
|
||||||
|
channel_id = traverse_obj(data, ('channel'))
|
||||||
|
categories = traverse_obj(data, ('category'))
|
||||||
|
|
||||||
# "sports", "doctor", "swirlster" sub-sites don't have 'publish-date'
|
formats = []
|
||||||
upload_date = unified_strdate(self._html_search_meta(
|
if video_mp4:
|
||||||
'publish-date', webpage, 'upload date', default=None) or self._html_search_meta(
|
formats.append({'url': video_mp4, 'ext': determine_ext(video_mp4)})
|
||||||
'uploadDate', webpage, 'upload date', default=None) or self._search_regex(
|
if video_webm:
|
||||||
r'datePublished"\s*:\s*"([^"]+)"', webpage, 'upload date', fatal=False))
|
formats.append({'url': video_webm, 'ext': determine_ext(video_webm)})
|
||||||
|
if video_m3u8:
|
||||||
description = remove_end(self._og_search_description(webpage), ' (Read more)')
|
m3u8_data = self._extract_m3u8_formats(video_m3u8, video_id)
|
||||||
|
formats.extend(m3u8_data)
|
||||||
|
# here, making the assumption that mp4 video available is always the highest quality
|
||||||
|
# will update if any deviation found
|
||||||
|
formats[0]['width'] = m3u8_data[-1]['width']
|
||||||
|
formats[0]['height'] = m3u8_data[-1]['height']
|
||||||
|
formats[0]['tbr'] = m3u8_data[-1]['tbr']
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'url': video_url,
|
'formats': formats,
|
||||||
'title': title,
|
'title': title,
|
||||||
'description': description,
|
'description': description,
|
||||||
'thumbnail': self._og_search_thumbnail(webpage),
|
'thumbnail': thumbnail,
|
||||||
'duration': duration,
|
'duration': duration,
|
||||||
'upload_date': upload_date,
|
'upload_date': upload_date,
|
||||||
|
'categories': categories,
|
||||||
|
'channel_id': channel_id,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user