Created
August 30, 2012 00:19
-
-
Save hcarvalhoalves/3520875 to your computer and use it in GitHub Desktop.
Regex to extract YouTube video ids
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
YOUTUBE_REGEX = re.compile(r'"http://.+?(/v/|/watch\\?v=)(?P<videoId>[A-Za-z0-9_-]{11}).+?"') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment