39 lines
1.3 KiB
Python
39 lines
1.3 KiB
Python
import datetime
|
|
|
|
from database.tinformationsource.model import TInformationSource
|
|
from log.log_manager import logger
|
|
from seek.the_paper_com.base import Base
|
|
|
|
|
|
class Tech(Base):
|
|
def __init__(self, information_source: TInformationSource):
|
|
super().__init__(information_source)
|
|
|
|
|
|
def get_news(information_source: TInformationSource) -> list:
|
|
instance = Tech(information_source)
|
|
news_list = instance.get_news()
|
|
instance.finish()
|
|
return news_list
|
|
|
|
|
|
def news_task(information_source: TInformationSource):
|
|
logger.info(f'{information_source.title} news_task start execute at {datetime.datetime.now()}', )
|
|
instance = Tech(information_source)
|
|
instance.do_seek_task()
|
|
instance.finish()
|
|
logger.info(f'{information_source.title} news_task end execute at {datetime.datetime.now()}')
|
|
|
|
|
|
if __name__ == '__main__':
|
|
logger.info('This module is not for direct call!')
|
|
information_source_ = TInformationSource()
|
|
information_source_.is_static = True
|
|
information_source_.url = 'https://www.thepaper.cn/channel_119908'
|
|
information_source_.title = '科技_澎湃新闻'
|
|
news_task(information_source_)
|
|
# news_list_ = get_news(information_source_)
|
|
# for news in news_list_:
|
|
# print(news)
|
|
logger.info('Done.')
|