diff options
| author | remitamine <remitamine@gmail.com> | 2015-10-08 18:39:24 +0100 | 
|---|---|---|
| committer | remitamine <remitamine@gmail.com> | 2015-10-08 18:39:24 +0100 | 
| commit | 7faf7e752342b21772c8647902bbf4f13cc57956 (patch) | |
| tree | a2dd55f95d5bd1ba3a9a517196f898db66818b1b | |
| parent | 4356d907c1afae09ff67a17c90b53be466b13623 (diff) | |
[pbs] detect errors from http error code
| -rw-r--r-- | youtube_dl/extractor/pbs.py | 23 | 
1 files changed, 15 insertions, 8 deletions
diff --git a/youtube_dl/extractor/pbs.py b/youtube_dl/extractor/pbs.py index 6923c6094..82218b933 100644 --- a/youtube_dl/extractor/pbs.py +++ b/youtube_dl/extractor/pbs.py @@ -39,6 +39,7 @@ class PBSIE(InfoExtractor):              'params': {                  'skip_download': True,  # requires ffmpeg              }, +            'skip': 'Expired',          },          {              'url': 'http://www.pbs.org/wgbh/pages/frontline/losing-iraq/', @@ -108,12 +109,12 @@ class PBSIE(InfoExtractor):          {              'url': 'http://www.pbs.org/wgbh/americanexperience/films/death/player/',              'info_dict': { -                'id': '2280706814', +                'id': '2276541483',                  'display_id': 'player',                  'ext': 'mp4', -                'title': 'American Experience - Death and the Civil War', +                'title': 'American Experience - Death and the Civil War, Chapter 1',                  'description': 'American Experience, TV’s most-watched history series, brings to life the compelling stories from our past that inform our understanding of the world today.', -                'duration': 6705, +                'duration': 682,                  'thumbnail': 're:^https?://.*\.jpg$',              },              'params': { @@ -134,6 +135,7 @@ class PBSIE(InfoExtractor):              'params': {                  'skip_download': True,  # requires ffmpeg              }, +            'skip': 'Expired',          },          {              # Video embedded in iframe containing angle brackets as attribute's value (e.g. @@ -231,13 +233,18 @@ class PBSIE(InfoExtractor):                  'Downloading %s video url info' % encoding_name)              if redirect_info['status'] == 'error': -                if redirect_info['http_code'] == 403: -                    message = ( -                        'The video is not available in your region due to ' -                        'right restrictions') +                http_code = redirect_info['http_code'] +                if http_code == 403: +                    message = 'We\'re sorry, but this video is not available in your region due to right restrictions.' +                elif http_code == 101: +                    message = 'We\'re sorry, but this video is not yet available.' +                elif http_code == 404: +                    message = 'We are experiencing technical difficulties that are preventing us from playing the video at this time. Please check back again soon.' +                elif http_code == 410: +                    message = 'This video has expired and is no longer available for online streaming.'                  else:                      message = redirect_info['message'] -                raise ExtractorError(message, expected=True) +                raise ExtractorError('PBS said: %s' % message, expected=True)              format_url = redirect_info.get('url')              if not format_url:  | 
