You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.9 KiB

  1. from __future__ import unicode_literals
  2. from .common import InfoExtractor
  3. class GrouponIE(InfoExtractor):
  4. _VALID_URL = r'https?://www\.groupon\.com/deals/(?P<id>[^?#]+)'
  5. _TEST = {
  6. 'url': 'https://www.groupon.com/deals/bikram-yoga-huntington-beach-2#ooid=tubGNycTo_9Uxg82uESj4i61EYX8nyuf',
  7. 'info_dict': {
  8. 'id': 'bikram-yoga-huntington-beach-2',
  9. 'title': '$49 for 10 Yoga Classes or One Month of Unlimited Classes at Bikram Yoga Huntington Beach ($180 Value)',
  10. 'description': 'Studio kept at 105 degrees and 40% humidity with anti-microbial and anti-slip Flotex flooring; certified instructors',
  11. },
  12. 'playlist': [{
  13. 'info_dict': {
  14. 'id': 'tubGNycTo_9Uxg82uESj4i61EYX8nyuf',
  15. 'ext': 'mp4',
  16. 'title': 'Bikram Yoga Huntington Beach | Orange County',
  17. },
  18. }],
  19. 'params': {
  20. 'skip_download': 'HLS',
  21. }
  22. }
  23. def _real_extract(self, url):
  24. playlist_id = self._match_id(url)
  25. webpage = self._download_webpage(url, playlist_id)
  26. payload = self._parse_json(self._search_regex(
  27. r'var\s+payload\s*=\s*(.*?);\n', webpage, 'payload'), playlist_id)
  28. videos = payload['carousel'].get('dealVideos', [])
  29. entries = []
  30. for v in videos:
  31. if v.get('provider') != 'OOYALA':
  32. self.report_warning(
  33. '%s: Unsupported video provider %s, skipping video' %
  34. (playlist_id, v.get('provider')))
  35. continue
  36. entries.append(self.url_result('ooyala:%s' % v['media']))
  37. return {
  38. '_type': 'playlist',
  39. 'id': playlist_id,
  40. 'entries': entries,
  41. 'title': self._og_search_title(webpage),
  42. 'description': self._og_search_description(webpage),
  43. }