-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
133 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ build/ | |
dist/ | ||
*.spec | ||
whisper_models/ | ||
release-downloader/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from PyInstaller.utils.hooks import collect_data_files | ||
|
||
datas = collect_data_files("whisper") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from PyInstaller.utils.hooks import collect_data_files | ||
|
||
datas = collect_data_files("whisper") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,55 +6,82 @@ | |
import json | ||
import os | ||
import cProfile | ||
headers={ | ||
'Origin': 'https://www.yanhekt.cn', | ||
|
||
headers = { | ||
"Origin": "https://www.yanhekt.cn", | ||
"xdomain-client": "web_user", | ||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 Edg/107.0.1418.26' | ||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 Edg/107.0.1418.26", | ||
} | ||
|
||
|
||
# courseID = 31425 | ||
def main(): | ||
if len(sys.argv) == 1: | ||
courseID = eval(input('Please input course ID: ')) | ||
courseID = eval(input("Please input course ID: ")) | ||
else: | ||
courseID = sys.argv[1] | ||
|
||
course = requests.get(f'https://cbiz.yanhekt.cn/v1/course?id={courseID}&with_professor_badges=true', headers=headers) | ||
req = requests.get(f'https://cbiz.yanhekt.cn/v2/course/session/list?course_id={courseID}', headers=headers) | ||
if course.json()['code'] != '0' and course.json()['code'] != 0: | ||
print(course.json()['code']) | ||
print(course.json()['message']) | ||
raise Exception("Please Check your course ID, note that it should be started with yanhekt.cn/course/***, not yanhekt.cn/session/***") | ||
print(course.json()['data']['name_zh']) | ||
videoList = req.json()['data'] | ||
course = requests.get( | ||
f"https://cbiz.yanhekt.cn/v1/course?id={courseID}&with_professor_badges=true", | ||
headers=headers, | ||
) | ||
req = requests.get( | ||
f"https://cbiz.yanhekt.cn/v2/course/session/list?course_id={courseID}", | ||
headers=headers, | ||
) | ||
if course.json()["code"] != "0" and course.json()["code"] != 0: | ||
print(course.json()["code"]) | ||
print(course.json()["message"]) | ||
raise Exception( | ||
"Please Check your course ID, note that it should be started with yanhekt.cn/course/***, not yanhekt.cn/session/***" | ||
) | ||
print(course.json()["data"]["name_zh"]) | ||
videoList = req.json()["data"] | ||
# print(json.dumps(videoList, indent=2)) | ||
for i, c in enumerate(videoList): | ||
print(i, ":", c['title']) | ||
print(f"[{i}]: ", c["title"]) | ||
|
||
index = eval('[' + input('select(split by \',\', such as: 0,2,4):') + ']') | ||
vga = input('video(1) or screen(2)?(input 1 or 2, default video):') | ||
if not os.path.exists('output/'): | ||
os.mkdir('output/') | ||
index = eval("[" + input("select(split by ',', such as: 0,2,4): ") + "]") | ||
vga = input("video(1) or screen(2)?(input 1 or 2, default video):") | ||
if not os.path.exists("output/"): | ||
os.mkdir("output/") | ||
for i in index: | ||
c = videoList[i] | ||
name = course.json()['data']['name_zh'].strip() + '-' + course.json()['data']['professors'][0]['name'] + '-' + c['title'] | ||
name = ( | ||
course.json()["data"]["name_zh"].strip() | ||
+ "-" | ||
+ course.json()["data"]["professors"][0]["name"] | ||
+ "-" | ||
+ c["title"] | ||
) | ||
print(name) | ||
if vga == "2": | ||
print("Downloading screen...") | ||
m3u8dl.M3u8Download(c['videos'][0]['vga'], 'output/' + course.json()['data']['name_zh'].strip() + '-screen', name) | ||
m3u8dl.M3u8Download( | ||
c["videos"][0]["vga"], | ||
"output/" + course.json()["data"]["name_zh"].strip() + "-screen", | ||
name, | ||
) | ||
else: | ||
print("Downloading video...") | ||
m3u8dl.M3u8Download(c['videos'][0]['main'], 'output/'+ course.json()['data']['name_zh'].strip() + '-video', name) | ||
m3u8dl.M3u8Download( | ||
c["videos"][0]["main"], | ||
"output/" + course.json()["data"]["name_zh"].strip() + "-video", | ||
name, | ||
) | ||
|
||
|
||
if __name__ == '__main__': | ||
if __name__ == "__main__": | ||
try: | ||
main() | ||
# cProfile.run('main()', 'output/profile.txt') | ||
except Exception as e: | ||
print(e) | ||
print("If the problem is still not solved, you can report an issue in https://github.com/AuYang261/BIT_yanhe_download/issues.") | ||
print( | ||
"If the problem is still not solved, you can report an issue in https://github.com/AuYang261/BIT_yanhe_download/issues." | ||
) | ||
print("Or contact with the author [email protected]. Thanks for your report!") | ||
print("如果问题仍未解决,您可以在https://github.com/AuYang261/BIT_yanhe_download/issues 中报告问题。") | ||
print( | ||
"如果问题仍未解决,您可以在https://github.com/AuYang261/BIT_yanhe_download/issues 中报告问题。" | ||
) | ||
print("或者联系作者[email protected]。感谢您的报告!") |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.