Skip to content

Problem playing last item: HTTP Error 403: Forbidden #1071

@tchernomax

Description

@tchernomax

When a forbidden video is encounter in a playlist, mps-youtube stop there.

Issue / Suggestion

Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/mps_youtube/main.py", line 70, in matchfunction
    func(*matches)
  File "/usr/lib/python3.8/site-packages/mps_youtube/commands/play.py", line 121, in play_all
    play(options, "1-" + str(len(g.model)))
  File "/usr/lib/python3.8/site-packages/mps_youtube/commands/play.py", line 102, in play
    g.PLAYER_OBJ.play(songlist, shuffle, repeat, override)
  File "/usr/lib/python3.8/site-packages/mps_youtube/player.py", line 79, in play
    self._playsong()
  File "/usr/lib/python3.8/site-packages/mps_youtube/player.py", line 132, in _playsong
    size = streams.get_size(self.song.ytid, self.stream['url'])
  File "/usr/lib/python3.8/site-packages/mps_youtube/streams.py", line 142, in get_size
    stream['size'] = _get_content_length(url, preloading=preloading)
  File "/usr/lib/python3.8/site-packages/mps_youtube/streams.py", line 152, in _get_content_length
    response = urlopen(url)
  File "/usr/lib/python3.8/urllib/request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.8/urllib/request.py", line 531, in open
    response = meth(req, response)
  File "/usr/lib/python3.8/urllib/request.py", line 640, in http_response
    response = self.parent.error(
  File "/usr/lib/python3.8/urllib/request.py", line 569, in error
    return self._call_chain(*args)
  File "/usr/lib/python3.8/urllib/request.py", line 502, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.8/urllib/request.py", line 649, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: Forbidden

Problem playing last item: HTTP Error 403: Forbidden
> ERROR: zu5xfnUz7c0: YouTube said: This video contains content from SME, who has blocked it in your country on copyright grounds.

This error is fixed by #872

Your Environment

max@mde-oxalide % mpsyt --version
mpsyt version      : 0.2.8
   notes           : released 17 February 2018
pafy version       : 0.5.5 (youtube-dl backend)
youtube-dl version : 2020.03.24
Python version     : 3.8.2 (default, Feb 26 2020, 22:21:03)
[GCC 9.2.1 20200130]
Processor          :
Machine type       : x86_64
Architecture       : 64bit, ELF
Platform           : Linux-5.5.13-arch2-1-x86_64-with-glibc2.2.5
sys.stdout.enc     : utf-8
default enc        : utf-8
Config dir         : /home/max/.config/mps-youtube
env:TERM           : screen-256color
env:SHELL          : /usr/bin/zsh
env:LANG           : fr_FR.UTF-8

Archlinux

max@mde-oxalide % yay -Qi mps-youtube-git
Name            : mps-youtube-git
Version         : 0.2.8.r146.gafab9fb-1
…

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions