This commit is contained in:
Kovid Goyal 2024-09-09 11:03:29 +05:30
parent ecf9f7b4cb
commit 83ad6604bf
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -4,9 +4,8 @@ scmp.com
"""
import json
import re
from datetime import datetime
import time
from datetime import datetime
from html5_parser import parse
from lxml import etree
@ -23,8 +22,8 @@ def E(parent, name, text='', **attrs):
def process_node(node, html_parent):
ntype = node.get('type')
if not ntype in {'track-viewed-percentage', 'inline-ad-slot', 'inline-widget', 'text'}:
if ntype not in {'track-viewed-percentage', 'inline-ad-slot', 'inline-widget', 'text'}:
c = html_parent.makeelement(ntype)
if ntype != 'p':
c.attrib.update({k: v or '' for k, v in node.get('attribs', {}).items()})