19 lines
705 B
Python
19 lines
705 B
Python
import os
|
|
from bs4 import BeautifulSoup
|
|
|
|
file_path = "/home/x79/sisvietnamvn_01/sisvietnamvn_Trang chính thức hiện tại/UMass Amherst _ UMass Amherst.html"
|
|
|
|
with open(file_path, "r", encoding="utf-8") as f:
|
|
soup = BeautifulSoup(f, "html.parser")
|
|
|
|
content_top = soup.find(class_="content-top")
|
|
|
|
if content_top:
|
|
# Let's save it to an artifact directly via python, or just print it and I will grab it.
|
|
output_path = "/home/x79/sisvietnamvn_01/sisvietnamvn_main/content_top_snippet.html"
|
|
with open(output_path, "w", encoding="utf-8") as f:
|
|
f.write(content_top.prettify())
|
|
print(f"Extracted content-top to {output_path}")
|
|
else:
|
|
print("Could not find class='content-top'")
|