Skip to content

Commit

Permalink
feat: capture the summary of each video
Browse files Browse the repository at this point in the history
photos are saved in the programme directory under `capture`
  • Loading branch information
PerssonBrown committed Jul 21, 2023
1 parent 9a9bcc7 commit d050498
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,6 @@ dmypy.json
username
password
users.json

# Capture Directory
capture/
19 changes: 19 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import time
import os

from api import *

Expand Down Expand Up @@ -30,6 +31,8 @@
This program is a part of Yangcong-tools.
'''

CAPTURE_IMG = False

print(INTRO_S)

def bug_report(msg, **kwargs):
Expand Down Expand Up @@ -188,6 +191,14 @@ def complete_homework(hw):
print('已完成', hw['name'], hwid)


def download_img(url, name):
print('Downloading:' + url + ", storage: " + name)
res = requests.get(url)
with open('capture/' + name, 'wb') as f:
f.write(res.content)
f.close


def complete_vacation(vc):
print('正在完成', vc['name'])
timelines = get_vacation_timelines(vc['id'])
Expand All @@ -200,6 +211,8 @@ def complete_vacation(vc):
# print(t)
if t['type'] == 1:
topic = get_vacation_video_detail(t['topicId'], t['id'])
if CAPTURE_IMG == True:
download_img(topic['video']['thumbnail'] + '.png', topic['video']['name'] + '.png')
if t['videoState'] == 0:
submit_vacation_video(
topic['id'],
Expand Down Expand Up @@ -252,6 +265,12 @@ def run():


if __name__ == '__main__':
a = input('是否截取每个视频的总结(y/n): ')
if a == 'y' or a == 'Y':
CAPTURE_IMG = True
if os.path.exists('capture') == False:
os.mkdir('capture')

userinfo = []
try:
with open('users.json', 'r', encoding='utf-8') as f:
Expand Down

0 comments on commit d050498

Please sign in to comment.