Skip to content

Valid links #5

Answered by t0ry003
t0ry003 asked this question in Q&A
Discussion options

You must be logged in to vote
# check if a link is a YouTube link
def check_link(link, playlist=False):
    if playlist:
        if re.search('www.youtube.com/playlist', link):
            return True
        else:
            return False
    else:
        if re.search('www.youtube.com/watch', link):
            return True
        else:
            return False

Well the answer is simple and clear:

  • Playlist: link need to include www.youtube.com/playlist;
  • Song: link need to include www.youtube.com/watch;

Replies: 1 comment

Comment options

t0ry003
Jul 2, 2022
Maintainer Author

You must be logged in to vote
0 replies
Answer selected by t0ry003
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant