regisb/spotify-onthego

Videos blocked by country fail

Dan-Wood opened this issue · 5 comments

If a certain matching video is blocked it fails the entire run, instead of looking for a similar video.

ERROR: xIIqYqtR1lY: YouTube said: This video contains content from SME, who has blocked it in your country on copyright grounds.
Traceback (most recent call last):
  File "/usr/local/bin/spotify-playlist", line 11, in <module>
    sys.exit(download_playlist())
  File "/usr/local/lib/python2.7/site-packages/onthego/cli.py", line 44, in download_playlist
    youtube_downloader.audio(track)
  File "/usr/local/lib/python2.7/site-packages/onthego/youtube.py", line 51, in audio
    audio_file_path = self.download_to_tmp(track)
  File "/usr/local/lib/python2.7/site-packages/onthego/youtube.py", line 81, in download_to_tmp
    video = pafy.new(video_url)
  File "/usr/local/lib/python2.7/site-packages/pafy/pafy.py", line 122, in new
    return Pafy(url, basic, gdata, size, callback, ydl_opts)
  File "/usr/local/lib/python2.7/site-packages/pafy/backend_youtube_dl.py", line 29, in __init__
    super(YtdlPafy, self).__init__(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/pafy/backend_shared.py", line 96, in __init__
    self._fetch_basic()
  File "/usr/local/lib/python2.7/site-packages/pafy/backend_youtube_dl.py", line 41, in _fetch_basic
    raise IOError(str(e).replace('YouTube said', 'Youtube says'))
IOError: ERROR: xIIqYqtR1lY: Youtube says: This video contains content from SME, who has blocked it in your country on copyright grounds.

Interesting... Which video are you trying to download in which country?

Australia

I also proxied to the US, didn't seem to like it.

++ Processing The Mash - Suicide Is Painless (From the 20th Century-Fox film "MAS*H")
ERROR: xIIqYqtR1lY: YouTube said: This video contains content from SME, who has blocked it in your country on copyright grounds.
Traceback (most recent call last):
File "/usr/local/bin/spotify-playlist", line 11, in
sys.exit(download_playlist())
File "/usr/local/lib/python2.7/site-packages/onthego/cli.py", line 44, in download_playlist
youtube_downloader.audio(track)
File "/usr/local/lib/python2.7/site-packages/onthego/youtube.py", line 51, in audio
audio_file_path = self.download_to_tmp(track)
File "/usr/local/lib/python2.7/site-packages/onthego/youtube.py", line 81, in download_to_tmp
video = pafy.new(video_url)
File "/usr/local/lib/python2.7/site-packages/pafy/pafy.py", line 122, in new
return Pafy(url, basic, gdata, size, callback, ydl_opts)
File "/usr/local/lib/python2.7/site-packages/pafy/backend_youtube_dl.py", line 29, in init
super(YtdlPafy, self).init(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/pafy/backend_shared.py", line 96, in init
self._fetch_basic()
File "/usr/local/lib/python2.7/site-packages/pafy/backend_youtube_dl.py", line 41, in _fetch_basic
raise IOError(str(e).replace('YouTube said', 'Youtube says'))
IOError: ERROR: xIIqYqtR1lY: Youtube says: This video contains content from SME, who has blocked it in your country on copyright grounds.

https://open.spotify.com/track/6fVAG0GceRlhCyBZaKzQJE - Spotify link

First search result shows - https://www.youtube.com/watch?v=xIIqYqtR1lY

Returns "This video contains content from SME, who has blocked it in your country on copyright grounds."

And another

++ Processing Melanie - Brand New Key
ERROR: Y5LzOlNZPCc: YouTube said: This video contains content from SME, who has blocked it in your country on copyright grounds.
Traceback (most recent call last):
File "/usr/local/bin/spotify-playlist", line 11, in
sys.exit(download_playlist())
File "/usr/local/lib/python2.7/site-packages/onthego/cli.py", line 44, in download_playlist
youtube_downloader.audio(track)
File "/usr/local/lib/python2.7/site-packages/onthego/youtube.py", line 51, in audio
audio_file_path = self.download_to_tmp(track)
File "/usr/local/lib/python2.7/site-packages/onthego/youtube.py", line 81, in download_to_tmp
video = pafy.new(video_url)
File "/usr/local/lib/python2.7/site-packages/pafy/pafy.py", line 122, in new
return Pafy(url, basic, gdata, size, callback, ydl_opts)
File "/usr/local/lib/python2.7/site-packages/pafy/backend_youtube_dl.py", line 29, in init
super(YtdlPafy, self).init(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/pafy/backend_shared.py", line 96, in init
self._fetch_basic()
File "/usr/local/lib/python2.7/site-packages/pafy/backend_youtube_dl.py", line 41, in _fetch_basic
raise IOError(str(e).replace('YouTube said', 'Youtube says'))
IOError: ERROR: Y5LzOlNZPCc: Youtube says: This video contains content from SME, who has blocked it in your country on copyright grounds.

Thanks for the thorough reporting, as always! I managed to reproduce your issue and fixed it in release 1.0.3 (or so I think). Can you try to update and see if you still have the same problem? If not, please close this issue.

Nice one, seems to have done the trick. Thanks!