Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NBC API sometimes missing data #18581

Closed
acmay opened this issue Dec 19, 2018 · 0 comments
Closed

NBC API sometimes missing data #18581

acmay opened this issue Dec 19, 2018 · 0 comments

Comments

@acmay
Copy link

@acmay acmay commented Dec 19, 2018

Please follow the guide below

  • You will be asked some questions and requested to provide some information, please read them carefully and answer honestly
  • Put an x into all the boxes [ ] relevant to your issue (like this: [x])
  • Use the Preview tab to see what your issue will actually look like

Make sure you are using the latest version: run youtube-dl --version and ensure your version is 2018.12.17. If it's not, read this FAQ entry and update. Issues with outdated version will be rejected.

  • I've verified and I assure that I'm running youtube-dl 2018.12.17

No, Sorry, this happened a few days ago before 12.17.

Before submitting an issue make sure you have:

  • At least skimmed through the README, most notably the FAQ and BUGS sections
  • Searched the bugtracker for similar issues including closed ones
  • Checked that provided video/audio/playlist URLs (if any) are alive and playable in a browser

What is the purpose of your issue?

  • Bug report (encountered problems with youtube-dl)
  • Site support request (request for adding support for a new site)
  • Feature request (request for a new functionality)
  • Question
  • Other

I manually added a print of the response data before the exception was thrown instead of doing the full debug output.

.local/bin/youtube-dl https://www.nbc.com/saturday-night-live/video/december-15-matt-damon/3843219
[NBC] 3843219: Downloading JSON metadata
{u'meta': {u'count': 0, u'version': u'v3.0.0'}, u'data': [], u'links': {u'self': u'https://api.nbc.com/v3/videos?filter%5Bpermalink%5D=http%3A//www.nbc.com/saturday-night-live/video/december-15-matt-damon/3843219&include=show%2Cshow.shortTitle&page%5Bnumber%5D=1'}}
Traceback (most recent call last):
  File ".local/bin/youtube-dl", line 11, in <module>
    sys.exit(main())
  File "/home/acmay/.local/lib/python2.7/site-packages/youtube_dl/__init__.py", line 472, in main
    _real_main(argv)
  File "/home/acmay/.local/lib/python2.7/site-packages/youtube_dl/__init__.py", line 462, in _real_main
    retcode = ydl.download(all_urls)
  File "/home/acmay/.local/lib/python2.7/site-packages/youtube_dl/YoutubeDL.py", line 2002, in download
    url, force_generic_extractor=self.params.get('force_generic_extractor', False))
  File "/home/acmay/.local/lib/python2.7/site-packages/youtube_dl/YoutubeDL.py", line 793, in extract_info
    ie_result = ie.extract(url)
  File "/home/acmay/.local/lib/python2.7/site-packages/youtube_dl/extractor/common.py", line 508, in extract
    ie_result = self._real_extract(url)
  File "/home/acmay/.local/lib/python2.7/site-packages/youtube_dl/extractor/nbc.py", line 95, in _real_extract
    video_data = response['data'][0]['attributes']
IndexError: list index out of range

Description of your issue, suggested solution and other information

The first couple of days after the Dec, 15th 2018 SNL episode came out, it seems the API server was not returning the full details of the episode. This caused the above exception in youtube dl. I was able to work around the issue with try/except block since the video_id was already known. I didn't try to find the title. I have only just started to use this, so I have no idea how frequently this problem occurs.
The API server is now sending me the correct data so I no longer need this code. But it will be awhile before the next episode where I may try again. Maybe other new shows have the same issue but I have not yet tried.

This maybe similar to #12576

index 3282f84ee..0fcac8c2b 100644
--- a/youtube_dl/extractor/nbc.py
+++ b/youtube_dl/extractor/nbc.py
@@ -91,7 +91,14 @@ class NBCIE(AdobePassIE):
                 'fields[shows]': 'shortTitle',
                 'include': 'show.shortTitle',
             })
-        video_data = response['data'][0]['attributes']
+        try:
+            video_data = response['data'][0]['attributes']
+        except:
+            print(video_data)
+            video_data = dict()
+            video_data['guid'] = video_id
+            video_data['title'] = 'none'
+
         query = {
             'mbr': 'true',
             'manifest': 'm3u',

@acmay acmay changed the title NBC API NBC API sometimes missing data Dec 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.