1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- """
- @author: luojunhui
- """
- import requests
- import pymysql
- class Functions(object):
- """
- functions class
- """
- @classmethod
- def getTitleScore(cls, title_list, account_name):
- """
- 标题打分
- :param title_list:
- :param account_name:
- :return:
- """
- url = "http://192.168.100.31:6060/score_list"
- body = {
- "account_nickname_list": [account_name],
- "text_list": title_list,
- "max_time": None,
- "min_time": None,
- "interest_type": "avg",
- "sim_type": "mean",
- "rate": 0.1
- }
- response = requests.post(url=url, headers={}, json=body).json()
- return response
- @classmethod
- def matchLinkById(cls, channel_content_id):
- """
- Use channelContentId to match articleUrl
- :param channel_content_id:
- :return:
- """
- connection = pymysql.connect(
- host='rm-bp12k5fuh5zyx31d28o.mysql.rds.aliyuncs.com',
- port=3306,
- user='wx2023_ad',
- password='wx2023_adP@assword1234',
- db='adplatform',
- charset='utf8mb4'
- )
- sql = f"""select account_id, link, item_index from changwen_article where id = '{channel_content_id}';"""
- cursor = connection.cursor()
- cursor.execute(sql)
- article_link = cursor.fetchone()
- return article_link
|