1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- """
- @author: luojunhui
- """
- import time
- from applications import PQMySQL
- class AccountArticleProducer(object):
- """
- step1: 获取已有账号历史表现好的文章list
- step2: 每篇文章搜索一个文章list,获取最好的文章所对应的账号信息
- step3: 对于该账号的历史文章进行抓取,把数据更新的文章库
- step4: 根据该账号历史文章的表现,返回该账号的优质文章
- """
- pq_mysql = PQMySQL()
- @classmethod
- def getHistoryArticles(cls, gh_id, latest_time_stamp):
- """
- 获取账号的历史文章
- :param latest_time_stamp:
- :param gh_id:
- :return:
- """
- twenty_hours_ago = int(time.time()) - 3600 * 20
- sql = f"""
- select title, show_view_count from official_articles
- where ghId = '{gh_id}' and updateTime > {latest_time_stamp} and updateTime < {twenty_hours_ago};
- """
- history_article_list = cls.pq_mysql.select(sql)
- return history_article_list
- @classmethod
- def findGoodArticles(cls, gh_id):
- """
- :param gh_id:
- :return:
- """
- return
- @classmethod
- def updateArticlesToMysql(cls):
- """
- :return:
- """
|