26 lines
1007 B
Python
26 lines
1007 B
Python
import xml.etree.ElementTree as ET
|
|
|
|
tree = ET.parse('/home/x79/sisvietnamvn_01/sisvietnamvn_Trang chính thức hiện tại/bnhvinakhoaquctsiscnth.WordPress.2026-07-28 (5).xml')
|
|
root = tree.getroot()
|
|
|
|
ns = {
|
|
'wp': 'http://wordpress.org/export/1.2/',
|
|
'content': 'http://purl.org/rss/1.0/modules/content/',
|
|
'dc': 'http://purl.org/dc/elements/1.1/'
|
|
}
|
|
|
|
for channel in root.findall('channel'):
|
|
for item in channel.findall('item'):
|
|
post_type = item.find('wp:post_type', ns)
|
|
if post_type is None or post_type.text != 'doctor':
|
|
continue
|
|
print('Title:', item.find('title').text)
|
|
print('Post Type:', post_type.text)
|
|
|
|
for meta in item.findall('wp:postmeta', ns):
|
|
key = meta.find('wp:meta_key', ns)
|
|
val = meta.find('wp:meta_value', ns)
|
|
if key is not None and val is not None and key.text and not key.text.startswith('_'):
|
|
print(f' Meta: {key.text} = {str(val.text)[:100]}')
|
|
break
|