You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

88 lines
3.7 KiB

12 months ago
import argparse
import Contant
import LoggerUtils
import Orm
11 months ago
from Orm import Video
12 months ago
from VideoService import VideoService
from YouTubeUtils import YouTubeUtil
from ChannelService import ChannelService
import requests
# py .\main.py --db=../db/youtube_prod.db --logDir=./logs --start="2023-09-10T00:00:01Z" --end="2023-09-11T00:00:01Z"
# python3 ./main.py --db="../db/youtube_prod.db" --logDir="./logs" --start="2024-03-25T00:10:01Z" --end="2024-03-26T00:10:01Z"
# python3 ./main.py --db="../db/youtube_prod.db" --logDir="./logs" --start="111" --end="222"
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="")
parser.add_argument("--db", type=str, default="")
parser.add_argument("--logDir", type=str, default="")
parser.add_argument("--start", type=str, default="")
parser.add_argument("--end", type=str, default="")
args = parser.parse_args()
Contant.db = args.db
Contant.logDir = args.logDir
Contant.startTime = args.start
Contant.endTime = args.end
LoggerUtils.initLogger()
Orm.ormInit()
11 months ago
LoggerUtils.Logger.info(
"db:{},logDir:{}".format(Contant.db, Contant.logDir))
LoggerUtils.Logger.info("starTime:{},endTime:{}".format(
Contant.startTime, Contant.endTime))
12 months ago
11 months ago
channelIds = ["UCUopc5tlSTMgBsZaP4PItRA",
"UC25CsqDNQv6CdzDq_hsazIw",
"UC4douYiP0O4ABtxoMuo9yNA",
"UCaT01FqK7SuPyqR8d2gvuiQ",
"UCA_hK5eRICBdSOLlXKESvEg",
"UCrZzlE9f9aR6yjvIy6-hggg",
"UCrm095p7ZHRS1njmQ1wkgCg",
"UCDDneQi63kJAdr3i5VCPzHg",
"UCwWXGnvVmi-6Sfx2wf8S8tQ",
"UCuzqko_GKcj9922M1gUo__w",
"UCwIdAI4fCV4lisP3TZzOGuw",
"UCYDaGPmMfSXViITpPYDKIcw",
"UCqULpqYsoBDTc_QswJOwMdQ",
"UC3GeULpLgXi1TNDAv0nyN5Q",
"UCYIVkruUoN04UjV9pkBTswg",
"UCya5E2GyEep6HuEsmLUcyWA",
"UC26mgnC13yyRANhG8bEf26g",
"UCJcPWs0gpYMx_CghPdELUhw",
"UCyF2mDq-XtPbhgTXwz1p93A",
"UC7v5yfvZhs-d5opF575AEhA",
"UCCHUPcdmSP-jqAkh4eh96yg",
"UC4G8Si5IBGy9k_1Oo04DMVg",
"UCAwfc603xR0xXQN58x4uWeA",
"UCHOLdIRhuGvY6EcpmDno3Iw",
"UChQ2W327SnjTlYZwCijCFYw",
"UCOjQAwkxNOY76-_zPqOWziA",
"UCkx8tfePUl__VGvNDNOKqRw",
"UCGAbl3E1aqqgrjwIaiDDdqQ",
"UC15Qrw0HKAMf2RG9PMNRPLg",
"UCilwQlk62k1z7aUEZPOB6yw",
"UCNRdj1WX-bxm5GPJtR2cM5Q",
"UCdWNwPuaS1o2dIzugNMXWtw"]
query=(Video.select().where(Video.channelId.in_(channelIds)))
videos = query.execute()
LoggerUtils.Logger.info(len(videos))
12 months ago
# 执行查询
11 months ago
# channelList = ChannelService.getChannelList()
# LoggerUtils.Logger.info("list size:{}".format(len(channelList)))
# for channel in channelList:
# channelId = channel.channelId
# LoggerUtils.Logger.info(
# "channelId:{},startTime:{},endTime:{}".format(
# channelId, Contant.startTime, Contant.endTime
# )
# )
# YouTubeUtil.getByChannelId(channelId, Contant.startTime, Contant.endTime)
# # 发送钉钉消息
# webhook = "https://oapi.dingtalk.com/robot/send?access_token=c8c8d7d42c4eecd449dd303025ef968f647d1d8e8694e3fabc0ab5770d646dcb"
# jsonData = {
# "msgtype": "text",
# "text": {
# "content": "[Youtube]src finished"
# }
# }
# requests.post(webhook, json=jsonData)
# LoggerUtils.Logger.info("src发送钉钉消息成功...")