]>
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', 
  21                 'description': 'md5:d41d8cd98f00b204e9800998ecf8427e', 
  26             'skip_download': 'HLS', 
  30     def _real_extract(self
, url
): 
  31         playlist_id 
= self
._match
_id
(url
) 
  32         webpage 
= self
._download
_webpage
(url
, playlist_id
) 
  34         payload 
= self
._parse
_json
(self
._search
_regex
( 
  35             r
'var\s+payload\s*=\s*(.*?);\n', webpage
, 'payload'), playlist_id
) 
  36         videos 
= payload
['carousel'].get('dealVideos', []) 
  39             if v
.get('provider') != 'OOYALA': 
  41                     '%s: Unsupported video provider %s, skipping video' % 
  42                     (playlist_id
, v
.get('provider'))) 
  44             entries
.append(self
.url_result('ooyala:%s' % v
['media'])) 
  50             'title': self
._og
_search
_title
(webpage
), 
  51             'description': self
._og
_search
_description
(webpage
),