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

mojevideo.py (4952B)


  1. from .common import InfoExtractor
  2. from ..utils import js_to_json, remove_end, update_url_query
  3. class MojevideoIE(InfoExtractor):
  4. IE_DESC = 'mojevideo.sk'
  5. _VALID_URL = r'https?://(?:www\.)?mojevideo\.sk/video/(?P<id>\w+)/(?P<display_id>[\w()]+?)\.html'
  6. _TESTS = [{
  7. 'url': 'https://www.mojevideo.sk/video/3d17c/chlapci_dobetonovali_sme_mame_hotovo.html',
  8. 'md5': '384a4628bd2bbd261c5206cf77c38c17',
  9. 'info_dict': {
  10. 'id': '3d17c',
  11. 'ext': 'mp4',
  12. 'title': 'Chlapci dobetónovali sme, máme hotovo!',
  13. 'display_id': 'chlapci_dobetonovali_sme_mame_hotovo',
  14. 'description': 'md5:a0822126044050d304a9ef58c92ddb34',
  15. 'thumbnail': 'https://fs5.mojevideo.sk/imgfb/250236.jpg',
  16. 'duration': 21.0,
  17. 'upload_date': '20230919',
  18. 'timestamp': 1695129706,
  19. 'like_count': int,
  20. 'dislike_count': int,
  21. 'view_count': int,
  22. 'comment_count': int,
  23. },
  24. }, {
  25. # 720p
  26. 'url': 'https://www.mojevideo.sk/video/14677/den_blbec.html',
  27. 'md5': '517c3e111c53a67d10b429c1f344ba2f',
  28. 'info_dict': {
  29. 'id': '14677',
  30. 'ext': 'mp4',
  31. 'title': 'Deň blbec?',
  32. 'display_id': 'den_blbec',
  33. 'description': 'I maličkosť vám môže zmeniť celý deň. Nikdy nezahadzujte žuvačky na zem!',
  34. 'thumbnail': 'https://fs5.mojevideo.sk/imgfb/83575.jpg',
  35. 'duration': 100.0,
  36. 'upload_date': '20120515',
  37. 'timestamp': 1337076481,
  38. 'like_count': int,
  39. 'dislike_count': int,
  40. 'view_count': int,
  41. 'comment_count': int,
  42. },
  43. }, {
  44. # 1080p
  45. 'url': 'https://www.mojevideo.sk/video/2feb2/band_maid_onset_(instrumental)_live_zepp_tokyo_(full_hd).html',
  46. 'md5': '64599a23d3ac31cf2fe069e4353d8162',
  47. 'info_dict': {
  48. 'id': '2feb2',
  49. 'ext': 'mp4',
  50. 'title': 'BAND-MAID - onset (Instrumental) Live - Zepp Tokyo (Full HD)',
  51. 'display_id': 'band_maid_onset_(instrumental)_live_zepp_tokyo_(full_hd)',
  52. 'description': 'Výborná inštrumentálna skladba od skupiny BAND-MAID.',
  53. 'thumbnail': 'https://fs5.mojevideo.sk/imgfb/196274.jpg',
  54. 'duration': 240.0,
  55. 'upload_date': '20190708',
  56. 'timestamp': 1562576592,
  57. 'like_count': int,
  58. 'dislike_count': int,
  59. 'view_count': int,
  60. 'comment_count': int,
  61. },
  62. }, {
  63. # 720p
  64. 'url': 'https://www.mojevideo.sk/video/358c8/dva_nissany_skyline_strielaju_v_londyne.html',
  65. 'only_matching': True,
  66. }, {
  67. # 720p
  68. 'url': 'https://www.mojevideo.sk/video/2455d/gopro_hero4_session_nova_sportova_vodotesna_kamera.html',
  69. 'only_matching': True,
  70. }, {
  71. # 1080p
  72. 'url': 'https://www.mojevideo.sk/video/352ee/amd_rx_6800_xt_vs_nvidia_rtx_3080_(test_v_9_hrach).html',
  73. 'only_matching': True,
  74. }, {
  75. # 1080p
  76. 'url': 'https://www.mojevideo.sk/video/2cbeb/trailer_z_avengers_infinity_war.html',
  77. 'only_matching': True,
  78. }]
  79. def _real_extract(self, url):
  80. video_id, display_id = self._match_valid_url(url).groups()
  81. webpage = self._download_webpage(url, video_id)
  82. video_id_dec = self._search_regex(
  83. r'\bvId\s*=\s*(\d+)', webpage, 'video id', fatal=False) or str(int(video_id, 16))
  84. video_exp = self._search_regex(r'\bvEx\s*=\s*["\'](\d+)', webpage, 'video expiry')
  85. video_hashes = self._search_json(
  86. r'\bvHash\s*=', webpage, 'video hashes', video_id,
  87. contains_pattern=r'\[(?s:.+)\]', transform_source=js_to_json)
  88. formats = []
  89. for video_hash, (suffix, quality, format_note) in zip(video_hashes, [
  90. ('', 1, 'normálna kvalita'),
  91. ('_lq', 0, 'nízka kvalita'),
  92. ('_hd', 2, 'HD-720p'),
  93. ('_fhd', 3, 'FULL HD-1080p'),
  94. ('_2k', 4, '2K-1440p'),
  95. ]):
  96. formats.append({
  97. 'format_id': f'mp4-{quality}',
  98. 'quality': quality,
  99. 'format_note': format_note,
  100. 'url': update_url_query(
  101. f'https://cache01.mojevideo.sk/securevideos69/{video_id_dec}{suffix}.mp4', {
  102. 'md5': video_hash,
  103. 'expires': video_exp,
  104. }),
  105. })
  106. return {
  107. 'id': video_id,
  108. 'display_id': display_id,
  109. 'formats': formats,
  110. 'title': (self._og_search_title(webpage, default=None)
  111. or remove_end(self._html_extract_title(webpage, 'title'), ' - Mojevideo')),
  112. 'description': self._og_search_description(webpage),
  113. **self._search_json_ld(webpage, video_id, default={}),
  114. }