import peter
This commit is contained in:
38
seek/the_paper_com/international.py
Normal file
38
seek/the_paper_com/international.py
Normal file
@ -0,0 +1,38 @@
|
||||
import datetime
|
||||
|
||||
from database.tinformationsource.model import TInformationSource
|
||||
from log.log_manager import logger
|
||||
from seek.the_paper_com.base import Base
|
||||
|
||||
|
||||
class International(Base):
|
||||
def __init__(self, information_source: TInformationSource):
|
||||
super().__init__(information_source)
|
||||
|
||||
|
||||
def get_news(information_source: TInformationSource) -> list:
|
||||
instance = International(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 = International(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_122908'
|
||||
information_source_.title = '国际_澎湃新闻'
|
||||
# news_task(information_source_)
|
||||
news_list_ = get_news(information_source_)
|
||||
for news in news_list_:
|
||||
print(news)
|
||||
logger.info('Done.')
|
||||
Reference in New Issue
Block a user