lazyad 0.0.46__tar.gz → 0.0.47__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of lazyad might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lazyad
3
- Version: 0.0.46
3
+ Version: 0.0.47
4
4
  Summary: 基于Python的懒人包-适用于广告投放模块
5
5
  Home-page: https://gitee.com/ZeroSeeker/lazyad
6
6
  Author: ZeroSeeker
@@ -272,6 +272,24 @@ def performance(
272
272
  timeout=timeout
273
273
  )
274
274
 
275
+ def sanitize_entities(
276
+ xml_content
277
+ ):
278
+ """
279
+ 将非XML预定义实体全部替换
280
+ """
281
+ import re
282
+ # 匹配非XML预定义实体
283
+ from html.entities import entitydefs
284
+ combined_map = {f'&{k};': v for k, v in entitydefs.items()}
285
+ pattern = re.compile(r'&(?!lt;|gt;|amp;|apos;|quot;)\w+;')
286
+
287
+ def replace_entity(match):
288
+ entity = match.group(0)
289
+ return combined_map.get(entity, entity) # 未定义则保持原样
290
+
291
+ return pattern.sub(replace_entity, xml_content)
292
+
275
293
 
276
294
  def xml_to_dict(xml_str):
277
295
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lazyad
3
- Version: 0.0.46
3
+ Version: 0.0.47
4
4
  Summary: 基于Python的懒人包-适用于广告投放模块
5
5
  Home-page: https://gitee.com/ZeroSeeker/lazyad
6
6
  Author: ZeroSeeker
@@ -13,7 +13,7 @@ with open("README.md", "r", encoding='utf-8') as fh:
13
13
 
14
14
  setuptools.setup(
15
15
  name="lazyad",
16
- version="0.0.46",
16
+ version="0.0.47",
17
17
  description="基于Python的懒人包-适用于广告投放模块",
18
18
  long_description=long_description,
19
19
  long_description_content_type="text/markdown",
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes