Skip to content

Instantly share code, notes, and snippets.

@kieranjol
Created May 26, 2022 10:41
Show Gist options
  • Save kieranjol/7c0574c9b451fd1715cc671e1a808822 to your computer and use it in GitHub Desktop.
Save kieranjol/7c0574c9b451fd1715cc671e1a808822 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import os
import sys
from bs4 import BeautifulSoup
brunnhilde_report = sys.argv[1]
with open(brunnhilde_report, 'r', encoding='utf8') as fo:
bla = fo.read()
soup = BeautifulSoup(bla, 'html.parser')
forks = soup.find_all('ul')
for fork in forks:
# there is surely a better way to do this
content = fork.contents
for data in content:
for items in data:
if 'AppleDouble' in items:
fork.decompose()
dotfiles = soup.find_all('tr')
for dotfile in dotfiles:
content = dotfile.contents
for data in content:
for items in data:
if '/.' in items:
dotfile.decompose()
with open("output1.html", "w", encoding='utf-8') as file:
file.write(str(soup))
print("%s created" % os.path.join(os.getcwd(), "output1.html"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment