3 from bs4
import BeautifulSoup
5 url=os.path.abspath(sys.argv[1])
6 report_dir = os.path.dirname(url)
10 tables=soup.find_all(
'table',recursive=
True)
12 rowheader=tables[2].
find(
'thead')
13 rowheaders=rowheader.find_all(
'tr')
14 htag = soup.new_tag(
'td')
15 htag.string=
'Num reports'
17 rowheaders[-1].
insert(7,htag)
19 rowsbody = tables[2].
find(
'tbody')
20 rows=rowsbody.find_all(
'tr')
22 cells=row.find_all(
'td')
24 if key
in seen.keys():
26 href = cells[6].
find(
'a',href=
True)
28 report = href[
'href'].
split(
"#")[0]
29 report_file = os.path.join(report_dir, report)
30 if report.startswith(
"report-")
and os.path.exists(report_file):
31 os.remove(report_file)
37 rowsbody = tables[2].
find(
'tbody')
38 rows=rowsbody.find_all(
'tr')
40 cells=row.find_all(
'td')
41 key=
str(cells[2])+
str(cells[3])+
str(cells[4])
42 tag = soup.new_tag(
'td')
43 tag.string=
'{}'.
format(seen[key])
46 print(soup.prettify(
"latin1"))