-
Notifications
You must be signed in to change notification settings - Fork 0
/
yafr.py
50 lines (40 loc) · 1.25 KB
/
yafr.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
"""
This is example script about how to use this project as a simple RSS reader
"""
from webtools import (
WebConfig,
HttpPageHandler,
FeedClientParser,
FeedClient,
ScrapingClient,
)
from sqlalchemy import (
create_engine,
)
from utils.logger import Logger
def main():
WebConfig.init()
# we do not want to be swamped with web requests
#WebConfig.use_print_logging()
Logger.use_print_logging()
parser = FeedClientParser()
parser.parse()
engine = create_engine("sqlite:///feedclient.db")
p = FeedClient(day_limit=7, engine=engine, parser=parser)
if p.parser.args.verbose:
WebConfig.use_print_logging()
# if scraping server is running, use it
c = ScrapingClient()
c.set_scraping_script("poetry run python crawleebeautifulsoup.py")
if c.connect():
c.close()
WebConfig.crawling_server_port = c.port
else:
WebConfig.crawling_server_port = 0
# scraping server is not running, we do not use port
#WebConfig.crawling_full_script = None
#WebConfig.crawling_headless_script = None
WebConfig.crawling_full_script = "poetry run python crawleebeautifulsoup.py"
WebConfig.crawling_headless_script = "poetry run python crawleebeautifulsoup.py"
p.run()
main()