GeezerVison is showing github.com — Allows iframes containing youtube or vimeo videos. People like them · thusoy/python-readability@f1759c1
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: readability/readability.py +7-2Lines changed: 7 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 32 | 32 | #'trimRe': re.compile('^\s+|\s+$/'), | 33 | 33 | #'normalizeRe': re.compile('\s{2,}/'), | 34 | 34 | #'killBreaksRe': re.compile('(<br\s*\/?>(\s| ?)*){1,}/'), | 35 | | - #'videoRe': re.compile('http:\/\/(www\.)?(youtube|vimeo)\.com', re.I), | | 35 | + 'videoRe': re.compile('http:\/\/(www\.)?(youtube|vimeo)\.com', re.I), | 36 | 36 | #skipFootnoteLink: /^\s*(\[?[a-z0-9]{1,2}\]?|^|edit|citation needed)\s*$/i, | 37 | 37 | } | 38 | 38 |
| @@ -428,8 +428,13 @@ def sanitize(self, node, candidates): | 428 | 428 | if self.class_weight(header) < 0 or self.get_link_density(header) > 0.33: | 429 | 429 | header.drop_tree() | 430 | 430 |
| 431 | | - for elem in self.tags(node, "form", "iframe", "textarea"): | | 431 | + for elem in self.tags(node, "form", "textarea"): | 432 | 432 | elem.drop_tree() | | 433 | + | | 434 | + for elem in self.tags(node, "iframe"): | | 435 | + if not ("src" in elem.attrib and REGEXES["videoRe"].search(elem.attrib["src"])): | | 436 | + elem.drop_tree() | | 437 | + | 433 | 438 | allowed = {} | 434 | 439 | # Conditionally clean <table>s, <ul>s, and <div>s | 435 | 440 | for el in self.reverse_tags(node, "table", "ul", "div"): | |
|