A snippet of code from the Washington Post's internal story API to process iframes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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() |
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
Use a mapper... =(