Created
July 31, 2014 08:33
-
-
Save DeronW/674581890b19c605b72a to your computer and use it in GitHub Desktop.
youku video url convert
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
url = urlparse('http://v.youku.com/v_show/id_XNzQ4MTcyMDE2.html?f=22598191') | |
if url.netloc == 'v.youku.com': | |
try: | |
video_id = url.path.split('/')[-1].split('.')[0][3:] | |
except: | |
pass | |
else: | |
video = 'http://player.youku.com/embed/%s' % video_id |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment