示例#1
0
 def test_valid_bitchute_embed(self):
     parser = build_parser(('VIDEO',))
     bbc = '[video]https://www.bitchute.com/video/8cHD9kgLTCzq/[/video]'
     expected = (
         '<iframe width="640" height="480" class="yt-embed" '
         'src="https://www.bitchute.com/embed/8cHD9kgLTCzq" frameborder="0"'
         ' allowfullscreen></iframe>'
     )
     actual = parser.format(bbc)
     self.assertEqual(expected, actual)
示例#2
0
def get_closure_bbc_parser():
    """
    BBCode parser that renders BBCode to BBCode, stripping quotes and easter
    eggs tags and removing PGP signatures, and . Typically used when quoting a
    post.
    """

    return iss_bbcode.build_parser(
        ('STRIP_PGP', 'STRIP_QUOTE', 'STRIP_COOL_TAG'),
        escape_html=False, newline='\n',
        install_defaults=False,
        replace_links=False,
        replace_cosmetic=False)
示例#3
0
def get_standard_bbc_parser(embed_images=True, embed_video=True,
                            allow_js=True, escape_html=True):
    return iss_bbcode.build_parser((
            'IMG' if embed_images else 'NO_IMG',
            'VIDEO' if embed_video else 'NO_VIDEO',
            'BYUSINGTHISTAGIAFFIRMLANNYISSUPERCOOL',
            'QUOTE',
            'CODE',
            'BC',
            'LINK',
            'SPOILER' if allow_js else 'NOJS_SPOILER',
            'SHORTCODE'
        ), escape_html=escape_html)
示例#4
0
 def test_slightly_trickier_XSS(self):
     parser = build_parser(('VIDEO',))
     bbc = '[video]javascript:(alert("haiiii"), {}).mp4[/video]'
     expected = '[video]javascript:(alert(&quot;haiiii&quot;), {}).mp4[/video]'
     actual = parser.format(bbc)
     self.assertEqual(expected, actual)
示例#5
0
 def test_simple_video_XSS(self):
     parser = build_parser(('VIDEO',))
     bbc = '[video]javascript:alert("haiiii")[/video]'
     expected = '[video]javascript:alert(&quot;haiiii&quot;)[/video]'
     actual = parser.format(bbc)
     self.assertEqual(expected, actual)