ridehome.py 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. from .art19 import Art19IE
  2. from .common import InfoExtractor
  3. from ..utils import extract_attributes, get_elements_html_by_class
  4. from ..utils.traversal import traverse_obj
  5. class RideHomeIE(InfoExtractor):
  6. _VALID_URL = r'https?://(?:www\.)?ridehome\.info/show/[\w-]+/(?P<id>[\w-]+)/?(?:$|[?#])'
  7. _TESTS = [{
  8. 'url': 'https://www.ridehome.info/show/techmeme-ride-home/thu-1228-will-2024-be-the-year-apple-gets-serious-about-gaming-on-macs/',
  9. 'info_dict': {
  10. 'id': 'thu-1228-will-2024-be-the-year-apple-gets-serious-about-gaming-on-macs',
  11. },
  12. 'playlist_count': 1,
  13. 'playlist': [{
  14. 'md5': 'c84ea3cc96950a9ab86fe540f3edc588',
  15. 'info_dict': {
  16. 'id': '540e5493-9fe6-4c14-a488-dc508d8794b2',
  17. 'ext': 'mp3',
  18. 'title': 'Thu. 12/28 – Will 2024 Be The Year Apple Gets Serious About Gaming On Macs?',
  19. 'description': 'md5:9dba86ae9b5047a8150eceddeeb629c2',
  20. 'series': 'Techmeme Ride Home',
  21. 'series_id': '3c30e8f4-ab48-415b-9421-1ae06cd4058b',
  22. 'upload_date': '20231228',
  23. 'timestamp': 1703780995,
  24. 'modified_date': '20231230',
  25. 'episode_id': '540e5493-9fe6-4c14-a488-dc508d8794b2',
  26. 'modified_timestamp': 1703912404,
  27. 'release_date': '20231228',
  28. 'release_timestamp': 1703782800,
  29. 'duration': 1000.1502,
  30. 'thumbnail': r're:^https?://content\.production\.cdn\.art19\.com/images/.*\.jpeg$',
  31. },
  32. }],
  33. }, {
  34. 'url': 'https://www.ridehome.info/show/techmeme-ride-home/portfolio-profile-sensel-with-ilyarosenberg/',
  35. 'info_dict': {
  36. 'id': 'portfolio-profile-sensel-with-ilyarosenberg',
  37. },
  38. 'playlist_count': 1,
  39. 'playlist': [{
  40. 'md5': 'bf9d6efad221008ce71aea09d5533cf6',
  41. 'info_dict': {
  42. 'id': '6beed803-b1ef-4536-9fef-c23cf6b4dcac',
  43. 'ext': 'mp3',
  44. 'title': '(Portfolio Profile) Sensel - With @IlyaRosenberg',
  45. 'description': 'md5:e1e4a970bce04290e0ba6f030b0125db',
  46. 'series': 'Techmeme Ride Home',
  47. 'series_id': '3c30e8f4-ab48-415b-9421-1ae06cd4058b',
  48. 'upload_date': '20220108',
  49. 'timestamp': 1641656064,
  50. 'modified_date': '20230418',
  51. 'episode_id': '6beed803-b1ef-4536-9fef-c23cf6b4dcac',
  52. 'modified_timestamp': 1681843318,
  53. 'release_date': '20220108',
  54. 'release_timestamp': 1641672000,
  55. 'duration': 2789.38122,
  56. 'thumbnail': r're:^https?://content\.production\.cdn\.art19\.com/images/.*\.jpeg$',
  57. },
  58. }],
  59. }, {
  60. 'url': 'https://www.ridehome.info/show/spacecasts/big-tech-news-apples-macbook-pro-event/',
  61. 'info_dict': {
  62. 'id': 'big-tech-news-apples-macbook-pro-event',
  63. },
  64. 'playlist_count': 1,
  65. 'playlist': [{
  66. 'md5': 'b1428530c6e03904a8271e978007fc05',
  67. 'info_dict': {
  68. 'id': 'f4780044-6c4b-4ce0-8215-8a86cc66bff7',
  69. 'ext': 'mp3',
  70. 'title': 'md5:e6c05d44d59b6577a4145ac339de5040',
  71. 'description': 'md5:14152f7228c8a301a77e3d6bc891b145',
  72. 'series': 'SpaceCasts',
  73. 'series_id': '8e3e837d-7fe0-4a23-8e11-894917e07e17',
  74. 'upload_date': '20211026',
  75. 'timestamp': 1635271450,
  76. 'modified_date': '20230502',
  77. 'episode_id': 'f4780044-6c4b-4ce0-8215-8a86cc66bff7',
  78. 'modified_timestamp': 1683057500,
  79. 'release_date': '20211026',
  80. 'release_timestamp': 1635272124,
  81. 'duration': 2266.30531,
  82. 'thumbnail': r're:^https?://content\.production\.cdn\.art19\.com/images/.*\.jpeg$',
  83. },
  84. }],
  85. }]
  86. def _real_extract(self, url):
  87. article_id = self._match_id(url)
  88. webpage = self._download_webpage(url, article_id)
  89. urls = traverse_obj(
  90. get_elements_html_by_class('iframeContainer', webpage),
  91. (..., {extract_attributes}, lambda k, v: k == 'data-src' and Art19IE.suitable(v)))
  92. return self.playlist_from_matches(urls, article_id, ie=Art19IE)