Skip to content


Subversion checkout URL

You can clone with
Download ZIP
tree: 9de21094a8
Fetching contributors…

Cannot retrieve contributors at this time

19 lines (14 sloc) 0.61 kB
Remap all images to take advantage of the Coral Content Distribution
Network <>.
import re, sys, urlparse, xml.dom.minidom
entry = xml.dom.minidom.parse(sys.stdin).documentElement
for node in entry.getElementsByTagName('img'):
if node.hasAttribute('src'):
component = list(urlparse.urlparse(node.getAttribute('src')))
if component[0] == 'http':
component[1] = re.sub(r':(\d+)$', r'.\1', component[1])
component[1] += ''
node.setAttribute('src', urlparse.urlunparse(component))
print entry.toxml('utf-8')
Jump to Line
Something went wrong with that request. Please try again.