Skip to content

Instantly share code, notes, and snippets.

@willvanwazer
Created September 23, 2015 01:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save willvanwazer/4e02de545eec211ebcb3 to your computer and use it in GitHub Desktop.
Save willvanwazer/4e02de545eec211ebcb3 to your computer and use it in GitHub Desktop.
A snippet of code from the Washington Post's internal story API to process iframes.
# And now we get into the fun rando ones
# First up, vevo! https://www.eff.org/https-everywhere/atlas/domains/vevo.com.html
elif 'http://cache.vevo.com/' in iframe['src']:
iframe['src'] = iframe['src'].replace('http://cache.vevo.com/', 'https://scache.vevo.com/')
# Next up YouTube
elif 'http://www.youtube.com/' in iframe['src']:
iframe['src'] = iframe['src'].replace('http://www.youtube.com/', 'https://www.youtube.com/')
# Gfycat http://gfycat.com
elif 'http://gfycat.com' in iframe['src']:
iframe['src'] = iframe['src'].replace('http://gfycat.com/', 'https://gfycat.com/')
elif 'http://www.dailymotion.com' in iframe['src']:
iframe['src'] = iframe['src'].replace('http://www.dailymotion.com', 'https://www.dailymotion.com')
elif 'http://apps.washingtonpost.com' in iframe['src']:
iframe['src'] = iframe['src'].replace('http://apps.washingtonpost.com', '//www.washingtonpost.com/apps/')
elif 'http://data-wrapper.s3.amazonaws.com' in iframe['src']:
iframe['src'] = iframe['src'].replace('http://data-wrapper.s3.amazonaws.com', 'https://data-wrapper.s3.amazonaws.com')
elif 'http://www.washingtonpost.com/wp-srv/graphics/' in iframe['src']:
iframe['src'] = iframe['src'].replace('http://www.washingtonpost.com/wp-srv/graphics/', '//www.washingtonpost.com/wp-srv/graphics/')
elif 'http://www.washingtonpost.com/graphics/' in iframe['src']:
iframe['src'] = iframe['src'].replace('http://www.washingtonpost.com/graphics/', '//www.washingtonpost.com/graphics/')
elif '//cdnapisec.kaltura.com/' in iframe['src']:
iframe.decompose()
elif 'http://' in iframe['src']:
iframe.decompose()
@kura
Copy link

kura commented Dec 13, 2015

Use a mapper... =(

@hguillermo
Copy link

You could just remove the "http:" part

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment