logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

sen.py (1459B)


  1. from .common import InfoExtractor
  2. from ..utils import url_or_none
  3. from ..utils.traversal import traverse_obj
  4. class SenIE(InfoExtractor):
  5. _VALID_URL = r'https?://(?:www\.)?sen\.com/video/(?P<id>[0-9a-f-]+)'
  6. _TEST = {
  7. 'url': 'https://www.sen.com/video/eef46eb1-4d79-4e28-be9d-bd937767f8c4',
  8. 'md5': 'ff615aca9691053c94f8f10d96cd7884',
  9. 'info_dict': {
  10. 'id': 'eef46eb1-4d79-4e28-be9d-bd937767f8c4',
  11. 'ext': 'mp4',
  12. 'description': 'Florida, 28 Sep 2022',
  13. 'title': 'Hurricane Ian',
  14. 'tags': ['North America', 'Storm', 'Weather'],
  15. },
  16. }
  17. def _real_extract(self, url):
  18. video_id = self._match_id(url)
  19. api_data = self._download_json(f'https://api.sen.com/content/public/video/{video_id}', video_id)
  20. m3u8_url = (traverse_obj(api_data, (
  21. 'data', 'nodes', lambda _, v: v['id'] == 'player', 'video', 'url', {url_or_none}, any))
  22. or f'https://vod.sen.com/videos/{video_id}/manifest.m3u8')
  23. return {
  24. 'id': video_id,
  25. 'formats': self._extract_m3u8_formats(m3u8_url, video_id, 'mp4'),
  26. **traverse_obj(api_data, ('data', 'nodes', lambda _, v: v['id'] == 'details', any, 'content', {
  27. 'title': ('title', 'text', {str}),
  28. 'description': ('descriptions', 0, 'text', {str}),
  29. 'tags': ('badges', ..., 'text', {str}),
  30. })),
  31. }