forked from GeneralNewsExtractor/GeneralNewsExtractor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample_visiable.py
22 lines (20 loc) · 1.01 KB
/
example_visiable.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import json
import glob
from gne import GeneralNewsExtractor
if __name__ == '__main__':
html_list = glob.glob('visiable_test/**/*.html', recursive=True)
for html_file in html_list:
with open(html_file, encoding='utf-8') as f:
html = f.read()
extractor = GeneralNewsExtractor()
result = extractor.extract(html,
host='https://www.xxx.com',
# body_xpath='//div[@class="show_text"]',
noise_node_list=['//div[@class="comment-list"]',
'//*[@style="display:none"]',
'//div[@class="statement"]'
],
use_visiable_info=True)
print(f'>>>>>>>>>>>>>{html_file}>>>>>>>>>>>>>')
print(json.dumps(result, indent=2, ensure_ascii=False))
print('<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<')