I need to parse apart CSS using Python 2.7, but only looking for image requests within url(), such as:
background:url(/images/myimg.jpg)
Since the only thing I'm concerned about are values within url(), I don't need a large CSS parser to break apart every property within the CSS rules (and I'm not really seeing any that can correctly get the url() values anyways).
So since this will be custom code, what's the best method to break apart a large string of a CSS rules and gather each of the url() values into a list?
Below is what I'm hoping to get, and as fast and efficiently as possible (especially if the css file is 80K or more)
css = "body { background:url(/image/body-bg.png) } #content { background-image:url('../graphics/content-bg.jpg') }"
... magic goes here...
urls = [ '/image/body-bg.png', '../graphics/content-bg.jpg' ]