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.

17 lines
533 B

# import requests
# webhook = "https://oapi.dingtalk.com/robot/send?access_token=c8c8d7d42c4eecd449dd303025ef968f647d1d8e8694e3fabc0ab5770d646dcb"
# jsonData = {
# "msgtype": "text",
# "text": {
# "content": "[Youtube]aaaa"
# }
# }
# requests.post(webhook, json=jsonData)
import pysrt
srtFile = "E:/code/youtube_prod/test/1.srt"
subs = pysrt.open(srtFile)
for sub in subs:
print("Text: {} duration: {}-{}".format(sub.text,
str(sub.start.to_time()).rstrip("0"), str(sub.end.to_time()).rstrip("0")))