Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import bs4, urllib2, webbrowser
starturl = raw_input('url: ')
#handle redirects, in case of shortened url
url = urllib2.urlopen(urllib2.Request(starturl)).geturl()
#keepvid page url
url = ''+url.split('&feature')[0]
#beautifulsoup object of keepvid page
soup = bs4.BeautifulSoup(urllib2.urlopen(url).read())
#find valid links
links = []
for l in'a'):
if l.get('href'):
if '' in l.get('href'):
#Open the link'safari-'+links[0].get('href'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment