]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/groupon.py
   1 from __future__ 
import unicode_literals
 
   3 from .common 
import InfoExtractor
 
   6 class GrouponIE(InfoExtractor
): 
   7     _VALID_URL 
= r
'https?://www\.groupon\.com/deals/(?P<id>[^?#]+)' 
  10         'url': 'https://www.groupon.com/deals/bikram-yoga-huntington-beach-2#ooid=tubGNycTo_9Uxg82uESj4i61EYX8nyuf', 
  12             'id': 'bikram-yoga-huntington-beach-2', 
  13             'title': '$49 for 10 Yoga Classes or One Month of Unlimited Classes at Bikram Yoga Huntington Beach ($180 Value)', 
  14             'description': 'Studio kept at 105 degrees and 40% humidity with anti-microbial and anti-slip Flotex flooring; certified instructors', 
  18                 'id': 'tubGNycTo_9Uxg82uESj4i61EYX8nyuf', 
  20                 'title': 'Bikram Yoga Huntington Beach | Orange County', 
  24             'skip_download': 'HLS', 
  28     def _real_extract(self
, url
): 
  29         playlist_id 
= self
._match
_id
(url
) 
  30         webpage 
= self
._download
_webpage
(url
, playlist_id
) 
  32         payload 
= self
._parse
_json
(self
._search
_regex
( 
  33             r
'var\s+payload\s*=\s*(.*?);\n', webpage
, 'payload'), playlist_id
) 
  34         videos 
= payload
['carousel'].get('dealVideos', []) 
  37             if v
.get('provider') != 'OOYALA': 
  39                     '%s: Unsupported video provider %s, skipping video' % 
  40                     (playlist_id
, v
.get('provider'))) 
  42             entries
.append(self
.url_result('ooyala:%s' % v
['media'])) 
  48             'title': self
._og
_search
_title
(webpage
), 
  49             'description': self
._og
_search
_description
(webpage
),