webcode-tk 1.2.9__tar.gz → 1.2.11__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.
- {webcode_tk-1.2.9 → webcode_tk-1.2.11}/PKG-INFO +1 -1
- {webcode_tk-1.2.9 → webcode_tk-1.2.11}/pyproject.toml +1 -1
- {webcode_tk-1.2.9 → webcode_tk-1.2.11}/webcode_tk/__init__.py +1 -1
- {webcode_tk-1.2.9 → webcode_tk-1.2.11}/webcode_tk/html_tools.py +23 -0
- {webcode_tk-1.2.9 → webcode_tk-1.2.11}/LICENSE.rst +0 -0
- {webcode_tk-1.2.9 → webcode_tk-1.2.11}/README.rst +0 -0
- {webcode_tk-1.2.9 → webcode_tk-1.2.11}/webcode_tk/animation_tools.py +0 -0
- {webcode_tk-1.2.9 → webcode_tk-1.2.11}/webcode_tk/cascade_tools.py +0 -0
- {webcode_tk-1.2.9 → webcode_tk-1.2.11}/webcode_tk/color_keywords.py +0 -0
- {webcode_tk-1.2.9 → webcode_tk-1.2.11}/webcode_tk/color_tools.py +0 -0
- {webcode_tk-1.2.9 → webcode_tk-1.2.11}/webcode_tk/contrast_tools.py +0 -0
- {webcode_tk-1.2.9 → webcode_tk-1.2.11}/webcode_tk/css_tools.py +0 -0
- {webcode_tk-1.2.9 → webcode_tk-1.2.11}/webcode_tk/font_tools.py +0 -0
- {webcode_tk-1.2.9 → webcode_tk-1.2.11}/webcode_tk/sample_report.json +0 -0
- {webcode_tk-1.2.9 → webcode_tk-1.2.11}/webcode_tk/utils.py +0 -0
- {webcode_tk-1.2.9 → webcode_tk-1.2.11}/webcode_tk/ux_tools.py +0 -0
- {webcode_tk-1.2.9 → webcode_tk-1.2.11}/webcode_tk/validator_tools.py +0 -0
|
@@ -50,6 +50,29 @@ def get_all_html_files(dir_path: str) -> list:
|
|
|
50
50
|
return html_files
|
|
51
51
|
|
|
52
52
|
|
|
53
|
+
def get_image_hotlinks(soup: BeautifulSoup) -> list:
|
|
54
|
+
"""Returns a list of all img src values that are external (hotlinked) URLs.
|
|
55
|
+
|
|
56
|
+
Hotlinked images are those with src attributes pointing to external
|
|
57
|
+
domains rather than local/relative paths. I ask that all students avoid
|
|
58
|
+
hotlinking images, as it's bad form and generally frowned upon.
|
|
59
|
+
|
|
60
|
+
Args:
|
|
61
|
+
soup: html soupt object.
|
|
62
|
+
|
|
63
|
+
Returns:
|
|
64
|
+
hotlinks: a list of hotlinked image srcs"""
|
|
65
|
+
hotlinks = []
|
|
66
|
+
# Get all img urls
|
|
67
|
+
image_elements = soup.find_all("img")
|
|
68
|
+
image_srcs = [img["src"] for img in image_elements]
|
|
69
|
+
for src in image_srcs:
|
|
70
|
+
if "http" in src[:4]:
|
|
71
|
+
hotlinks.append(src)
|
|
72
|
+
|
|
73
|
+
return hotlinks
|
|
74
|
+
|
|
75
|
+
|
|
53
76
|
def get_html(file_path: str) -> BeautifulSoup:
|
|
54
77
|
"""Returns an html document (from file_path) as a BeautifulSoup object
|
|
55
78
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|