mirror of
https://github.com/Hamza417/Inure.git
synced 2025-08-06 18:49:41 +08:00
Build94
- changelogs.html cleanup // skip build apk
This commit is contained in:
27
scripts/html_cleaner.py
Normal file
27
scripts/html_cleaner.py
Normal file
@ -0,0 +1,27 @@
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
|
||||
def replace_collapsible_tags_with_h2(html_file):
|
||||
with open(html_file, 'r', encoding='utf-8') as file:
|
||||
soup = BeautifulSoup(file, 'html.parser')
|
||||
|
||||
collapsible_divs = soup.find_all(class_='wrap-collapsible')
|
||||
|
||||
for div in collapsible_divs:
|
||||
build_label = div.find(class_='lbl-toggle')
|
||||
content = div.find(class_='content-inner')
|
||||
|
||||
if build_label and content:
|
||||
build_number = build_label.get_text()
|
||||
h2_tag = soup.new_tag('h2')
|
||||
h2_tag.string = build_number
|
||||
div.replace_with(h2_tag, content)
|
||||
|
||||
with open(html_file, 'w', encoding='utf-8') as file:
|
||||
file.write(str(soup))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
input_html_file = 'input.html' # Replace with your input HTML file
|
||||
replace_collapsible_tags_with_h2(input_html_file)
|
||||
print(f'Replaced collapsible tags with h2 tags in {input_html_file}')
|
Reference in New Issue
Block a user