Created
May 12, 2014 19:51
-
-
Save pypetey/089332e8bed73890e20f to your computer and use it in GitHub Desktop.
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
1. My input is: | |
https://www.youtube.com/watch?v=6qNW7yRsqAM | |
Result is: | |
<iframe width="480" height="270" frameborder="0" allowfullscreen="" src="http://www.youtube.com/embed/6qNW7yRsqAM?feature=oembed"></iframe> | |
# Code | |
def get_description(self): | |
providers = micawber.bootstrap_basic() | |
description = bleach.clean(self.description) | |
description = micawber.parse_text(description, providers) | |
Result is valid but I did not linkify the content so non embeddable links will not have nofollow/target _blank | |
2. My input is: | |
https://www.youtube.com/watch?v=6qNW7yRsqAM | |
My result is | |
<iframe width="480" height="270" src="&lt;a href=" http:="" <a="" href="http://www.youtube.com" rel="nofollow">www.youtube.com="" embed="" 6qNW7yRsqAM?feature="oembed"" rel="nofollow"><a rel="nofollow" href="http://www.youtube.com/embed/6qNW7yRsqAM?feature=oembed">http://www.youtube.com/embed/6qNW7yRsqAM?feature=oembed</a>" frameborder="0" allowfullscreen=""></iframe> | |
# Code | |
def get_description(self): | |
providers = micawber.bootstrap_basic() | |
description = bleach.clean(self.description) | |
description = micawber.parse_text(description, providers) | |
description = bleach.linkify(description) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment