diff options
| author | Sergey M․ <dstftw@gmail.com> | 2015-05-08 22:18:43 +0600 | 
|---|---|---|
| committer | Sergey M․ <dstftw@gmail.com> | 2015-05-08 22:18:43 +0600 | 
| commit | 0ceab8474924c4e7a6e28497c8da40cc5002c8d3 (patch) | |
| tree | 9951442675df5995b59f04b46ae84a422a5b186c | |
| parent | 34e7dc81a94d39d48c5b4aac8cddcca46edba94d (diff) | |
[vgtv] Add support for bt.no articles (#5620)
| -rw-r--r-- | youtube_dl/extractor/__init__.py | 5 | ||||
| -rw-r--r-- | youtube_dl/extractor/vgtv.py | 39 | 
2 files changed, 42 insertions, 2 deletions
| diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py index 5dfa781f8..587a45940 100644 --- a/youtube_dl/extractor/__init__.py +++ b/youtube_dl/extractor/__init__.py @@ -587,7 +587,10 @@ from .veoh import VeohIE  from .vessel import VesselIE  from .vesti import VestiIE  from .vevo import VevoIE -from .vgtv import VGTVIE +from .vgtv import ( +    BTArticleIE, +    VGTVIE, +)  from .vh1 import VH1IE  from .vice import ViceIE  from .viddler import ViddlerIE diff --git a/youtube_dl/extractor/vgtv.py b/youtube_dl/extractor/vgtv.py index b0f0b3bc2..ad07e54c9 100644 --- a/youtube_dl/extractor/vgtv.py +++ b/youtube_dl/extractor/vgtv.py @@ -9,7 +9,18 @@ from ..utils import float_or_none  class VGTVIE(InfoExtractor):      IE_DESC = 'VGTV and BTTV' -    _VALID_URL = r'http://(?:www\.)?(?P<host>vgtv|bt)\.no/(?:(?:tv/)?#!/(?:video|live)/(?P<id>[0-9]+)|(?:[^/]+/)*(?P<path>[^/]+))' +    _VALID_URL = r'''(?x) +                    (?: +                        vgtv:| +                        http://(?:www\.)? +                    ) +                    (?P<host>vgtv|bt) +                    (?: +                        :| +                        \.no/(?:tv/)?#!/(?:video|live)/ +                    ) +                    (?P<id>[0-9]+) +                    '''      _TESTS = [          {              # streamType: vod @@ -129,3 +140,29 @@ class VGTVIE(InfoExtractor):              'view_count': data['displays'],              'formats': formats,          } + + +class BTArticleIE(InfoExtractor): +    IE_DESC = 'Bergens Tidende' +    _VALID_URL = 'http://(?:www\.)?bt\.no/(?:[^/]+/)+(?P<id>[^/]+)-\d+\.html' +    _TEST = { +        'url': 'http://www.bt.no/nyheter/lokalt/Kjemper-for-internatet-1788214.html', +        'md5': 'd055e8ee918ef2844745fcfd1a4175fb', +        'info_dict': { +            'id': '23199', +            'ext': 'mp4', +            'title': 'Alrekstad internat', +            'description': 'md5:dc81a9056c874fedb62fc48a300dac58', +            'thumbnail': 're:^https?://.*\.jpg', +            'duration': 191, +            'timestamp': 1289991323, +            'upload_date': '20101117', +            'view_count': int, +        }, +    } + +    def _real_extract(self, url): +        webpage = self._download_webpage(url, self._match_id(url)) +        video_id = self._search_regex( +            r'SVP\.Player\.load\(\s*(\d+)', webpage, 'video id') +        return self.url_result('vgtv:bt:%s' % video_id, 'VGTV') | 
