1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- import os
- import random
- import sys
- sys.path.append(os.getcwd())
- from common.db import MysqlHelper
- from common.feishu import Feishu
- class Material():
-
- @classmethod
- def insert_user(cls):
-
- douyin = Feishu.get_values_batch("prod", "succinct", "iYbVis")
-
- channel = '抖音'
- for row in douyin[2:]:
- platform = row[0]
- if platform == channel:
- account_name = row[2]
- account_link = row[3]
- user_id = account_link.split("user/")[1]
- insert_sql = f"""INSERT INTO video_user_id (name, user_id, channel) values ('{account_name}', '{user_id}', '{channel}')"""
- MysqlHelper.update_values(
- sql=insert_sql,
- env="prod",
- machine="",
- )
-
- @classmethod
- def get_title(cls):
- title = Feishu.get_values_batch("prod", "succinct", "meGnsz")
- random_item = random.choice(title)
- cleaned_item = random_item[0].strip("[]'")
- return cleaned_item
-
- @classmethod
- def get_audio(cls):
- audio = Feishu.get_values_batch("prod", "succinct", "zucQUM")
- list = []
- for row in audio[1:]:
- account_name = row[0]
- text = row[2]
- number = {"audio_id": account_name,"text": text}
- list.append(number)
- list = random.choice(list)
- audio_id = list['audio_id']
- srt = list['text']
- return audio_id, srt
-
- @classmethod
- def get_douyin_cookie(cls):
- douyin_token = Feishu.get_values_batch("prod", "succinct", "OpE35G")
- for item in douyin_token:
- if item[0] == '抖音':
- return item[1]
- @classmethod
- def get_houtai_cookie(cls):
- douyin_token = Feishu.get_values_batch("prod", "succinct", "OpE35G")
- for item in douyin_token:
- if item[0] == '管理后台':
- return item[1]
|