Compare commits

..

No commits in common. "e8d3dfbaa0d68d278d72ed74b6e855d942c5c7b3" and "94b6916e4f13d25ac6ac7e4cdfd22f02bfa16ba6" have entirely different histories.

View File

@ -1,6 +1,8 @@
from .common import InfoExtractor from .common import InfoExtractor, ExtractorError, url_or_none
from ..utils import ExtractorError, parse_iso8601, url_or_none from ..utils import (
from ..utils.traversal import traverse_obj parse_iso8601,
traverse_obj,
)
class TrtWorldIE(InfoExtractor): class TrtWorldIE(InfoExtractor):
@ -15,7 +17,7 @@ class TrtWorldIE(InfoExtractor):
'release_timestamp': 1701529569, 'release_timestamp': 1701529569,
'release_date': '20231202', 'release_date': '20231202',
'thumbnail': 'https://cdn-i.pr.trt.com.tr/trtworld/17647563_0-0-1920-1080.jpeg', 'thumbnail': 'https://cdn-i.pr.trt.com.tr/trtworld/17647563_0-0-1920-1080.jpeg',
'description': 'md5:0a975c04257fb529c8f99c7b76a2cf12', 'description': "Tourism sustainability is one of the main issues at COP28, as the UN calls for new ways to lessen the effects of tourism on the environment. And as a leading country in the sector, T\u00fcrkiye is doing its part with a new strategy. Asli Atbas reports from one of the country's favourite holiday destinations, Cappadocia."
} }
}, { }, {
'url': 'https://www.trtworld.com/video/one-offs/frames-from-anatolia-recreating-a-james-bond-scene-in-istanbuls-grand-bazaar-14541780', 'url': 'https://www.trtworld.com/video/one-offs/frames-from-anatolia-recreating-a-james-bond-scene-in-istanbuls-grand-bazaar-14541780',
@ -26,7 +28,7 @@ class TrtWorldIE(InfoExtractor):
'release_timestamp': 1692440844, 'release_timestamp': 1692440844,
'release_date': '20230819', 'release_date': '20230819',
'thumbnail': 'https://cdn-i.pr.trt.com.tr/trtworld/16939810_0-0-1920-1080.jpeg', 'thumbnail': 'https://cdn-i.pr.trt.com.tr/trtworld/16939810_0-0-1920-1080.jpeg',
'description': 'md5:4050e21570cc3c40b6c9badae800a94f', 'description': "Join us on a fun adventure as we attempt to recreate an iconic “James Bond” scene, weaving together film history and the bustling life and culture of the real world in the heart of Istanbuls colourful Grand Bazaar!"
} }
}, { }, {
'url': 'https://www.trtworld.com/video/the-newsmakers/can-sudan-find-peace-amidst-failed-transition-to-democracy-12904760', 'url': 'https://www.trtworld.com/video/the-newsmakers/can-sudan-find-peace-amidst-failed-transition-to-democracy-12904760',
@ -44,28 +46,32 @@ class TrtWorldIE(InfoExtractor):
'id': 'zEns2dWl00w', 'id': 'zEns2dWl00w',
'ext': 'mp4', 'ext': 'mp4',
'title': "Locals learning to cope with rising tides of Kenya's Great Lakes", 'title': "Locals learning to cope with rising tides of Kenya's Great Lakes",
'thumbnail': 'https://i.ytimg.com/vi/zEns2dWl00w/maxresdefault.jpg', "thumbnail": "https://i.ytimg.com/vi/zEns2dWl00w/maxresdefault.jpg",
'description': 'md5:3ad9d7c5234d752a4ead4340c79c6b8d', "description": "The great lakes of Kenya are a major tourist attraction, and support the livelihoods of millions of residents. But in recent years, their levels have been steadily rising, wreaking havoc. \n\nAlexandria Majalla spoke to locals to find out how they're coping with the changing tides.\r\n\r\nSubscribe:\nhttp://trt.world/subscribe\nLivestream: http://trt.world/ytlive\nFacebook: http://trt.world/facebook\nTwitter: http://trt.world/twitter\nInstagram: http://trt.world/instagram\nVisit our website: http://trt.world",
'channel_id': 'UC7fWeaHhqgM4Ry-RMpM2YYw', "channel_id": "UC7fWeaHhqgM4Ry-RMpM2YYw",
'channel_url': 'https://www.youtube.com/channel/UC7fWeaHhqgM4Ry-RMpM2YYw', "channel_url": "https://www.youtube.com/channel/UC7fWeaHhqgM4Ry-RMpM2YYw",
'duration': 210, "duration": 210,
'view_count': int, "view_count": int,
'age_limit': 0, "average_rating": None,
'webpage_url': 'https://www.youtube.com/watch?v=zEns2dWl00w', "age_limit": 0,
'categories': ['News & Politics'], "webpage_url": "https://www.youtube.com/watch?v=zEns2dWl00w",
'channel': 'TRT World', "categories": [
'channel_follower_count': int, "News & Politics"
'channel_is_verified': True, ],
'uploader': 'TRT World', "channel": "TRT World",
'uploader_id': '@trtworld', "channel_follower_count": int,
'uploader_url': 'https://www.youtube.com/@trtworld', "channel_is_verified": True,
'upload_date': '20231202', "uploader": "TRT World",
'availability': 'public', "uploader_id": "@trtworld",
"uploader_url": "https://www.youtube.com/@trtworld",
"upload_date": "20231202",
"availability": "public",
'comment_count': int, 'comment_count': int,
'playable_in_embed': True, 'playable_in_embed': True,
'tags': [], 'tags': [],
'live_status': 'not_live', 'live_status': 'not_live',
'like_count': int, 'like_count': None
} }
}] }]
@ -76,7 +82,7 @@ class TrtWorldIE(InfoExtractor):
formats = [] formats = []
for media_url in traverse_obj(nuxtjs_data, ( for media_url in traverse_obj(nuxtjs_data, (
'platforms', ('website', 'ott'), 'metadata', ('hls_url', 'url'), {url_or_none})): 'platforms', ('website', 'ott'), 'metadata', ('hls_url', 'url'), {url_or_none})):
# NB: Website sometimes serves mp4 files under `hls_url` key # Website sometimes serves mp4 files under `hls_url` key
if media_url.endswith('.m3u8'): if media_url.endswith('.m3u8'):
formats.extend(self._extract_m3u8_formats(media_url, display_id, fatal=False)) formats.extend(self._extract_m3u8_formats(media_url, display_id, fatal=False))
else: else: