ceopirate Posted March 17, 2014 Share Posted March 17, 2014 Im working on a little project to retrieve videos from certain sites. Im trying to findout how to save a video file that i and if i am parsing the html correctly I am new to this side of python.. import urllib import re url = "https://www.videourl" htmlfile = urllib.urlopen(url) htmltext = htmlfile.read() regex = '<meta property="og:video" content="http://www.urlinpagesource;version=3">' video = re.compile(regex) Quote Link to comment Share on other sites More sharing options...
Elk Posted May 20, 2014 Share Posted May 20, 2014 Well first off that's now how you use regex: import re my_string = 'Test string to parse' #Either pre-compile the regex if you are going to reuse it regex = re.compile('Test') m = regex.match(my_string) # Or just use a regex once m = re.match('test', my_string) but apart from that you do not want to be parsing HTML with regular expressions. Take a look at http://www.crummy.com/software/BeautifulSoup/ which will make your life a lot easier. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.