mirror of
https://gitlab.com/octtspacc/staticoso
synced 2025-06-05 22:09:23 +02:00
Strip scripts
This commit is contained in:
19
Source/Modules/HTML.py
Normal file
19
Source/Modules/HTML.py
Normal file
@ -0,0 +1,19 @@
|
||||
""" ================================= |
|
||||
| This file is part of |
|
||||
| staticoso |
|
||||
| Just a simple Static Site Generator |
|
||||
| |
|
||||
| Licensed under the AGPLv3 license |
|
||||
| Copyright (C) 2022, OctoSpacc |
|
||||
| ================================= """
|
||||
|
||||
from Libs.bs4 import BeautifulSoup
|
||||
from Modules.Utils import *
|
||||
|
||||
def StripTags(HTML, ToStrip):
|
||||
Soup = BeautifulSoup(HTML, 'html.parser')
|
||||
Tags = Soup.find_all()
|
||||
for t in Tags:
|
||||
if t.name in ToStrip:
|
||||
t.replace_with('')
|
||||
return str(Soup)
|
Reference in New Issue
Block a user