publishAccountAssociationArticles.py 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. """
  2. @author: luojunhui
  3. 发布i2u2i文章
  4. """
  5. import pandas as pd
  6. from applications import DeNetMysql
  7. class I2U2I(object):
  8. """
  9. 发布账号联想文章
  10. """
  11. db = DeNetMysql()
  12. @classmethod
  13. def getAccountPositionArticles(cls, gh_id, position):
  14. """
  15. 获取联想账号的某个位置的所有文章
  16. :return:
  17. """
  18. sql = f"""
  19. select title, read_cnt, link
  20. from crawler_meta_article
  21. where out_account_id = '{gh_id}' and article_index = {position};
  22. """
  23. article_list = cls.db.select(sql)
  24. # df = pd.DataFrame(article_list, columns=['title', 'read_cnt', 'link'])
  25. # read_mean = df['read_cnt'].mean()
  26. # filter_response = df[
  27. # (df['read_cnt'] > read_mean * 1.3)
  28. # & (df['read_cnt'] > 5000)
  29. # ]
  30. # return filter_response
  31. return article_list
  32. @classmethod
  33. def filter(cls):
  34. """
  35. :return:
  36. """
  37. return
  38. if __name__ == '__main__':
  39. job = I2U2I()
  40. article_list = job.getAccountPositionArticles(gh_id='gh_e6be5a12e83c', position=1)
  41. for article in article_list:
  42. print(article)