Created
June 4, 2013 17:12
-
-
Save mortymacs/5707738 to your computer and use it in GitHub Desktop.
Fetch youtube href(src) from html source code
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
#!/usr/bin/env python | |
import re | |
pattern = '.*<(iframe|param).*(src|value)="(?P<link>http://www.youtube.com/(embed|v)/[a-zA-Z0-9/\.\?&;=\+_-]+);?.*".*>.*</(iframe|param)>.*' | |
action = re.compile(pattern) | |
result = action.findall('<div><iframe.....></iframe><param......></param></div>') | |
print result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment