Skip to content

Instantly share code, notes, and snippets.

@DeronW
Created July 31, 2014 08:33
Show Gist options
  • Save DeronW/674581890b19c605b72a to your computer and use it in GitHub Desktop.
Save DeronW/674581890b19c605b72a to your computer and use it in GitHub Desktop.
youku video url convert
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