mps-youtube / yewtube

yewtube, forked from mps-youtube , is a Terminal based YouTube player and downloader. No Youtube API key required.
GNU General Public License v3.0
8.12k stars 642 forks source link

Continue with next item in playlist if item not available #987

Open vnckppl opened 5 years ago

vnckppl commented 5 years ago

Is it possible to automatically continue with the next item in the playlist if the current item is not available (e.g., after receiving the message 'Problem playing last item: HTTP Error 403: Forbidden').

Jeronimo17 commented 4 years ago

mps-youtube-develop/mps_youtube/commands/search.py

@command(r'url\s(.*[-_a-zA-Z0-9]{11}.*)', 'url')
def yt_url(url, print_title=0):
    """ Acess videos by urls. """
    url_list = url.split()

    g.model.songs = []

    for u in url_list:
        try:
            p = util.get_pafy(u)

            g.browse_mode = "normal"
            v = Video(p.videoid, p.title, p.length)
            g.model.songs.append(v)

        except (IOError, ValueError) as e:
            g.message = c.r + str(e) + c.w
            g.content = g.content or content.generate_songlist_display(
                    zeromsg=g.message)

    if not g.command_line:
        g.content = content.generate_songlist_display()

    if print_title:
        util.xprint(v.title)

That has to be fixed, I'm also interested in importing a list of urls and not stopping at the first failure.