Files
sisvietnamvn_01/sisvietnamvn_main/parse_url.py
T

29 lines
1.1 KiB
Python

import sys
from bs4 import BeautifulSoup
import traceback
try:
with open('/home/x79/.gemini/antigravity-ide/brain/53991324-2cf9-45f5-8177-0e9acab31498/.system_generated/steps/939/content.md', 'r') as f:
html = f.read()
soup = BeautifulSoup(html, 'html.parser')
# In WordPress, the main content is often in an article tag or div with class containing 'content'
# For elementor, it's usually inside 'elementor-widget-theme-post-content'
content = soup.find('div', class_='elementor-widget-theme-post-content')
if not content:
# Let's try to find an elementor text editor div
content = soup.find('div', class_='elementor-text-editor')
if not content:
# Let's just grab the whole body
content = soup.find('body')
if content:
html_str = str(content)
with open('temp_agenda.html', 'w') as out:
out.write(html_str)
print("Success, wrote", len(html_str), "bytes to temp_agenda.html")
else:
print("Could not find any content")
except Exception as e:
traceback.print_exc()