aiguoli / qcourse_scripts Goto Github PK
View Code? Open in Web Editor NEW腾讯课堂,模拟登陆,获取课程信息,视频下载,视频解密。
腾讯课堂,模拟登陆,获取课程信息,视频下载,视频解密。
Traceback (most recent call last):
File "D:\qcourse_scripts\qcourse-venv\lib\site-packages\requests\models.py", line 971, in json
return complexjson.loads(self.text, **kwargs)
File "C:\Python\Python310\lib\json_init_.py", line 346, in loads
return _default_decoder.decode(s)
File "C:\Python\Python310\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Python\Python310\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\qcourse_scripts\qcourse.py", line 154, in
main()
File "D:\qcourse_scripts\qcourse.py", line 123, in main
asyncio.run(
File "C:\Python\Python310\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Python\Python310\lib\asyncio\base_events.py", line 646, in run_until_complete
return future.result()
File "D:\qcourse_scripts\qcourse.py", line 80, in download_selected_chapter
urls = get_download_urls(term_id, file_id, cid=cid)
File "D:\qcourse_scripts\utils.py", line 345, in get_download_urls
video_info = get_video_info(
File "D:\qcourse_scripts\utils.py", line 258, in get_video_info
response = requests.get(url, params=params, cookies=load_json_cookies(), proxies=PROXIES).json()
File "D:\qcourse_scripts\qcourse-venv\lib\site-packages\requests\models.py", line 975, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
下载全部课程视频时报错
请输入要下载的课程序号(回车结束):1
获取课程信息成功,准备下载!
Traceback (most recent call last):
File "qcourse.py", line 154, in <module>
main()
File "qcourse.py", line 131, in main
logger.info('cid: '+cid)
TypeError: can only concatenate str (not "int") to str
如果课程里边有章节的名称包含空格的话,应该可以正常下载下来ts文件,但是无法正确转码,看起来应该是调用ffmpeg转码的时候,参数没给好。
Traceback (most recent call last):
File "qcourse.py", line 140, in
main()
File "qcourse.py", line 134, in main
asyncio.run(download_selected_chapter(term_id, course_name, chapter_name, courses, cid))
File "D:\ProgramData\Anaconda3\envs\txkt\lib\asyncio\runners.py", line 43, in run
return loop.run_until_complete(main)
File "D:\ProgramData\Anaconda3\envs\txkt\lib\asyncio\base_events.py", line 587, in run_until_complete
return future.result()
File "qcourse.py", line 82, in download_selected_chapter
urls = get_download_urls(term_id, file_id, cid=cid)
File "D:\down\qcourse_scripts-main\qcourse_scripts-main\utils.py", line 243, in get_download_urls
return get_video_url(video_info, video_index, cid=cid, term_id=term_id)
File "D:\down\qcourse_scripts-main\qcourse_scripts-main\utils.py", line 222, in get_video_url
key_url = get_key_url_from_m3u8(video.get('url')) + '&token=' + get_token_for_key_url(term_id=term_id, cid=cid)
File "D:\down\qcourse_scripts-main\qcourse_scripts-main\utils.py", line 212, in get_token_for_key_url
.format(uin=uin, skey=skey, pskey=pskey, plskey=plskey, cid=cid, term_id=term_id)
UnboundLocalError: local variable 'uin' referenced before assignment
输入需要的功能:0
Traceback (most recent call last):
File "E:\python\qcourse_scripts\qcourse.py", line 169, in
main()
File "E:\python\qcourse_scripts\qcourse.py", line 115, in main
qq_course.login()
File "E:\python\qcourse_scripts\qcourse.py", line 40, in login
page.click('#js_login')
File "E:\python\qcourse_scripts\qcourse-venv\lib\site-packages\playwright\sync_api_generated.py", line 6791, in click
self._sync(
File "E:\python\qcourse_scripts\qcourse-venv\lib\site-packages\playwright_impl_sync_base.py", line 111, in _sync
return task.result()
File "E:\python\qcourse_scripts\qcourse-venv\lib\site-packages\playwright_impl_page.py", line 586, in click
return await self._main_frame.click(**locals_to_params(locals()))
File "E:\python\qcourse_scripts\qcourse-venv\lib\site-packages\playwright_impl_frame.py", line 403, in click
await self._channel.send("click", locals_to_params(locals()))
File "E:\python\qcourse_scripts\qcourse-venv\lib\site-packages\playwright_impl_connection.py", line 36, in send
return await self.inner_send(method, params, False)
File "E:\python\qcourse_scripts\qcourse-venv\lib\site-packages\playwright_impl_connection.py", line 54, in inner_send
result = next(iter(done)).result()
playwright._impl._api_types.TimeoutError: Timeout 30000ms exceeded.
======== logs ====
waiting for selector "#js_login"
selector resolved to hidden <a id="js_login" rel="nofollow" data-hook="login" h…>登录
attempting click action
waiting for element to be visible, enabled and stable
element is not visible - waiting...
Traceback (most recent call last):
File "D:/Users/Desktop/qcourse_scripts-main/qcourse.py", line 153, in
main()
File "D:/Users/Desktop/qcourse_scripts-main/qcourse.py", line 103, in main
qq_course = QCourse()
File "D:/Users/Desktop/qcourse_scripts-main/qcourse.py", line 32, in init
self.driver = Edge(executable_path='msedgedriver.exe', options=self.options)
File "D:\Program Files\Python38\lib\site-packages\msedge\selenium_tools\webdriver.py", line 103, in init
RemoteWebDriver.init(
File "D:\Program Files\Python38\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in init
self.start_session(capabilities, browser_profile)
File "D:\Program Files\Python38\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "D:\Program Files\Python38\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "D:\Program Files\Python38\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find MSEdge binary
Process finished with exit code 1
Traceback (most recent call last):
File "qcourse.py", line 138, in
main()
File "qcourse.py", line 132, in main
asyncio.run(download_selected_chapter(term_id, course_name, chapter_name, courses))
File "D:\develop\pythoninstaller3.8.1\lib\asyncio\runners.py", line 43, in run
return loop.run_until_complete(main)
File "D:\develop\pythoninstaller3.8.1\lib\asyncio\base_events.py", line 612, in run_until_complete
return future.result()
File "qcourse.py", line 80, in download_selected_chapter
urls = get_download_urls(term_id, file_id)
File "D:\develop\TencentPaChong\qcourse_scripts\qcourse_scripts\utils.py", line 218, in get_download_urls
video_info = get_video_info(file_id, tokens.get('t'), tokens.get('sign'), tokens.get('us'))
File "D:\develop\TencentPaChong\qcourse_scripts\qcourse_scripts\utils.py", line 166, in get_video_info
response = requests.get(url, params=params, cookies=load_json_cookies()).json()
File "D:\develop\TencentPaChong\qcourse_scripts\qcourse_scripts\qcourse-venv\lib\site-packages\requests\models.py", line 900, in json
return complexjson.loads(self.text, **kwargs)
File "D:\develop\pythoninstaller3.8.1\lib\json_init_.py", line 357, in loads
return _default_decoder.decode(s)
File "D:\develop\pythoninstaller3.8.1\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "D:\develop\pythoninstaller3.8.1\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
一直报这个错误,该怎么解决
Traceback (most recent call last):
File "qcourse.py", line 138, in
main()
File "qcourse.py", line 116, in main
asyncio.run(download_selected_chapter(term_id, course_name, chapter_name, courses))
File "D:\python\bin\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "D:\python\bin\lib\asyncio\base_events.py", line 616, in run_until_complete
return future.result()
File "qcourse.py", line 80, in download_selected_chapter
urls = get_download_urls(term_id, file_id)
File "D:\pycript\qcourse_scripts-main\qcourse_scripts-main\utils.py", line 218, in get_download_urls
video_info = get_video_info(file_id, tokens.get('t'), tokens.get('sign'), tokens.get('us'))
File "D:\pycript\qcourse_scripts-main\qcourse_scripts-main\utils.py", line 166, in get_video_info
response = requests.get(url, params=params, cookies=load_json_cookies()).json()
File "D:\pycript\qcourse_scripts-main\qcourse_scripts-main\qcourse-venv\lib\site-packages\requests\models.py", line 900, in json
return complexjson.loads(self.text, **kwargs)
File "D:\python\bin\lib\json_init_.py", line 357, in loads
return _default_decoder.decode(s)
File "D:\python\bin\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "D:\python\bin\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
感觉时json格式的问题。麻烦看一下了。
大佬的使用方法非常贴心了,我的python版本是3.10,前面三步均正常,到了第四步这里就
(qcourse-venv) C:\Users\l4115\Desktop\qcourse_scripts-main>pip install -Ur requirements.txt
Collecting aiohttp
Downloading aiohttp-3.8.1-cp310-cp310-win_amd64.whl (555 kB)
|████████████████████████████████| 555 kB 168 kB/s
Collecting anyio==3.3.0
Downloading anyio-3.3.0-py3-none-any.whl (77 kB)
|████████████████████████████████| 77 kB 204 kB/s
Collecting async-timeout==3.0.1
Downloading async_timeout-3.0.1-py3-none-any.whl (8.2 kB)
Collecting attrs==21.2.0
Downloading attrs-21.2.0-py2.py3-none-any.whl (53 kB)
|████████████████████████████████| 53 kB 231 kB/s
Collecting certifi==2020.12.5
Downloading certifi-2020.12.5-py2.py3-none-any.whl (147 kB)
|████████████████████████████████| 147 kB 159 kB/s
Collecting chardet==4.0.0
Downloading chardet-4.0.0-py2.py3-none-any.whl (178 kB)
|████████████████████████████████| 178 kB 159 kB/s
Collecting charset-normalizer==2.0.4
Downloading charset_normalizer-2.0.4-py3-none-any.whl (36 kB)
Collecting greenlet==1.1.0
Downloading greenlet-1.1.0.tar.gz (85 kB)
|████████████████████████████████| 85 kB 157 kB/s
Collecting h11==0.12.0
Downloading h11-0.12.0-py3-none-any.whl (54 kB)
|████████████████████████████████| 54 kB 196 kB/s
Collecting httpcore==0.13.6
Downloading httpcore-0.13.6-py3-none-any.whl (58 kB)
|████████████████████████████████| 58 kB 78 kB/s
Collecting httpx==0.19.0
Downloading httpx-0.19.0-py3-none-any.whl (77 kB)
|████████████████████████████████| 77 kB 97 kB/s
Collecting idna==2.10
Downloading idna-2.10-py2.py3-none-any.whl (58 kB)
|████████████████████████████████| 58 kB 114 kB/s
Collecting multidict==5.1.0
Downloading multidict-5.1.0.tar.gz (53 kB)
|████████████████████████████████| 53 kB 74 kB/s
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... done
Collecting Pillow==8.2.0
Downloading Pillow-8.2.0.tar.gz (47.9 MB)
|████████████████████████████████| 47.9 MB 28 kB/s
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/playwright/
Collecting playwright==1.13.1
Downloading playwright-1.13.1-py3-none-win_amd64.whl (15.2 MB)
|████████████████████████████████| 15.2 MB 84 kB/s
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/pycryptodome/
Collecting pycryptodome==3.10.1
Downloading pycryptodome-3.10.1-cp35-abi3-win_amd64.whl (1.6 MB)
|████████████████████████████████| 1.6 MB 79 kB/s
Collecting pyee==8.1.0
Downloading pyee-8.1.0-py2.py3-none-any.whl (12 kB)
Collecting requests==2.25.1
Downloading requests-2.25.1-py2.py3-none-any.whl (61 kB)
|████████████████████████████████| 61 kB 87 kB/s
Collecting rfc3986==1.5.0
Downloading rfc3986-1.5.0-py2.py3-none-any.whl (31 kB)
Collecting six==1.15.0
Downloading six-1.15.0-py2.py3-none-any.whl (10 kB)
Collecting sniffio==1.2.0
Downloading sniffio-1.2.0-py3-none-any.whl (10 kB)
Collecting typing-extensions==3.10.0.0
Downloading typing_extensions-3.10.0.0-py3-none-any.whl (26 kB)
Collecting urllib3==1.26.4
Downloading urllib3-1.26.4-py2.py3-none-any.whl (153 kB)
|████████████████████████████████| 153 kB 52 kB/s
Collecting websockets==9.1
Downloading websockets-9.1.tar.gz (76 kB)
|████████████████████████████████| 76 kB 58 kB/s
Collecting wincertstore==0.2
Downloading wincertstore-0.2-py2.py3-none-any.whl (8.8 kB)
Collecting yarl==1.6.3
Downloading yarl-1.6.3.tar.gz (176 kB)
|████████████████████████████████| 176 kB 49 kB/s
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... done
Collecting aiosignal>=1.1.2
Downloading aiosignal-1.2.0-py3-none-any.whl (8.2 kB)
Collecting aiohttp
Downloading aiohttp-3.8.0-cp310-cp310-win_amd64.whl (571 kB)
|████████████████████████████████| 571 kB 69 kB/s
Downloading aiohttp-3.7.4.post0.tar.gz (1.1 MB)
|████████████████████████████████| 1.1 MB 65 kB/s
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... done
Using legacy 'setup.py install' for greenlet, since package 'wheel' is not installed.
Using legacy 'setup.py install' for Pillow, since package 'wheel' is not installed.
Using legacy 'setup.py install' for websockets, since package 'wheel' is not installed.
Building wheels for collected packages: multidict, yarl, aiohttp
Building wheel for multidict (PEP 517) ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\l4115\Desktop\qcourse_scripts-main\qcourse-venv\Scripts\python.exe' 'C:\Users\l4115\Desktop\qcourse_scripts-main\qcourse-venv\lib\site-packages\pip_vendor\pep517\in_process_in_process.py' build_wheel 'C:\Users\l4115\AppData\Local\Temp\tmpbz0a8qua'
cwd: C:\Users\l4115\AppData\Local\Temp\pip-install-6kwf7fgq\multidict_d1498c5ac0524aff8124cbed94a2c140
Complete output (93 lines):
ERROR: Failed building wheel for multidict
Building wheel for yarl (PEP 517) ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\l4115\Desktop\qcourse_scripts-main\qcourse-venv\Scripts\python.exe' 'C:\Users\l4115\Desktop\qcourse_scripts-main\qcourse-venv\lib\site-packages\pip_vendor\pep517\in_process_in_process.py' build_wheel 'C:\Users\l4115\AppData\Local\Temp\tmpuojmmu2_'
cwd: C:\Users\l4115\AppData\Local\Temp\pip-install-6kwf7fgq\yarl_be64a5db3e5b47ce9114590f9b16ecb0
Complete output (87 lines):
ERROR: Failed building wheel for yarl
Building wheel for aiohttp (PEP 517) ... done
Created wheel for aiohttp: filename=aiohttp-3.7.4.post0-py3-none-any.whl size=451945 sha256=6cc6964f0350eaa1a9785817cae14b281afd85d2409e0f170c48929181dab111
Stored in directory: c:\users\l4115\appdata\local\pip\cache\wheels\fc\84\e0\52113c57eb9b09b6b187a0f369eaad6fc7fc64bb7247c83b89
Successfully built aiohttp
Failed to build multidict yarl
ERROR: Could not build wheels for multidict, yarl which use PEP 517 and cannot be installed directly
WARNING: You are using pip version 21.2.4; however, version 21.3.1 is available.
You should consider upgrading via the 'C:\Users\l4115\Desktop\qcourse_scripts-main\qcourse-venv\Scripts\python.exe -m pip install --upgrade pip' command.
然后我试图去做第五步,
(qcourse-venv) C:\Users\l4115\Desktop\qcourse_scripts-main>playwright install msedge
'playwright' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
然后是试图第六,
(qcourse-venv) C:\Users\l4115\Desktop\qcourse_scripts-main>python qcourse.py
Traceback (most recent call last):
File "C:\Users\l4115\Desktop\qcourse_scripts-main\qcourse.py", line 7, in
from playwright.sync_api import sync_playwright
ModuleNotFoundError: No module named 'playwright'
(qcourse-venv) C:\Users\l4115\Desktop\qcourse_scripts-main>
请教如何处理
(qcourse-venv) D:\qcourse_scripts-main>pip install -r requirements.txt Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple https://pypi.tuna.tsinghua.edu.cn/packages/c4/e5/63ca2c4edf4e00657584608bee1001302bbf8c5f569340b78304f2f446cb/rfc3986-1.5.0-py2.py3-none-any.whl (31 kB) ERROR: Could not find a version that satisfies the requirement setuptools==52.0.0.post20210125 (from versions: 0.6b1, 0.6b2, 0.6b3, 0.6b4, 0.6rc1, 0.6rc2, 0.6rc3, 0.6rc4, 0.6rc5, 0.6rc6, 0.6rc7, 0.6rc8, 0.6rc9, 0.6rc10, 0.6rc11, 0.7.2, 0.7.3, 0.7.4, 0.7.5, 0.7.6, 0.7.7, 0.7.8, 0.8, 0.9, 0.9.1, 0.9.2, 0.9.3, 0.9.4, 0.9.5, 0.9.6, 0.9.7, 0.9.8, 1.0, 1.1, 1.1.1, 1.1.2, 1.1.3, 1.1.4, 1.1.5, 1.1.6, 1.1.7, 1.2, 1.3, 1.3.1, 1.3.2, 1.4, 1.4.1, 1.4.2, 2.0, 2.0.1, 2.0.2, 2.1, 2.1.1, 2.1.2, 2.2, 3.0, 3.0.1, 3.0.2, 3.1, 3.2, 3.3, 3.4, 3.4.1, 3.4.2, 3.4.3, 3.4.4, 3.5, 3.5.1, 3.5.2, 3.6, 3.7, 3.7.1, 3.8, 3.8.1, 4.0, 4.0.1, 5.0, 5.0.1, 5.0.2, 5.1, 5.2, 5.3, 5.4, 5.4.1, 5.4.2, 5.5, 5.5.1, 5.6, 5.7, 5.8, 6.0.1, 6.0.2, 6.1, 7.0, 8.0, 8.0.1, 8.0.2, 8.0.3, 8.0.4, 8.1, 8.2, 8.2.1, 8.3, 9.0, 9.0.1, 9.1, 10.0, 10.0.1, 10.1, 10.2, 10.2.1, 11.0, 11.1, 11.2, 11.3, 11.3.1, 12.0, 12.0.1, 12.0.2, 12.0.3, 12.0.4, 12.0.5, 12.1, 12.2, 12.3, 12.4, 13.0.1, 13.0.2, 14.0, 14.1, 14.1.1, 14.2, 14.3, 14.3.1, 15.0, 15.1, 15.2, 16.0, 17.0, 17.1, 17.1.1, 18.0, 18.0.1, 18.1, 18.2, 18.3, 18.3.1, 18.3.2, 18.4, 18.5, 18.6, 18.6.1, 18.7, 18.7.1, 18.8, 18.8.1, 19.0, 19.1, 19.1.1, 19.2, 19.3, 19.4, 19.4.1, 19.5, 19.6, 19.6.1, 19.6.2, 19.7, 20.0, 20.1, 20.1.1, 20.2.2, 20.3, 20.3.1, 20.4, 20.6.6, 20.6.7, 20.6.8, 20.7.0, 20.8.0, 20.8.1, 20.9.0, 20.10.1, 21.0.0, 21.1.0, 21.2.0, 21.2.1, 21.2.2, 22.0.0, 22.0.1, 22.0.2, 22.0.4, 22.0.5, 23.0.0, 23.1.0, 23.2.0, 23.2.1, 24.0.0, 24.0.1, 24.0.2, 24.0.3, 24.1.0, 24.1.1, 24.2.0, 24.2.1, 24.3.0, 24.3.1, 25.0.0, 25.0.1, 25.0.2, 25.1.0, 25.1.1, 25.1.2, 25.1.3, 25.1.4, 25.1.5, 25.1.6, 25.2.0, 25.3.0, 25.4.0, 26.0.0, 26.1.0, 26.1.1, 27.0.0, 27.1.0, 27.1.2, 27.2.0, 27.3.0, 27.3.1, 28.0.0, 28.1.0, 28.2.0, 28.3.0, 28.4.0, 28.5.0, 28.6.0, 28.6.1, 28.7.0, 28.7.1, 28.8.0, 28.8.1, 29.0.0, 29.0.1, 30.0.0, 30.1.0, 30.2.0, 30.2.1, 30.3.0, 30.4.0, 31.0.0, 31.0.1, 32.0.0, 32.1.0, 32.1.1, 32.1.2, 32.1.3, 32.2.0, 32.3.0, 32.3.1, 33.1.0, 33.1.1, 34.0.0, 34.0.1, 34.0.2, 34.0.3, 34.1.0, 34.1.1, 34.2.0, 34.3.0, 34.3.1, 34.3.2, 34.3.3, 34.4.0, 34.4.1, 35.0.0, 35.0.1, 35.0.2, 36.0.1, 36.1.0, 36.1.1, 36.2.0, 36.2.1, 36.2.2, 36.2.3, 36.2.4, 36.2.5, 36.2.6, 36.2.7, 36.3.0, 36.4.0, 36.5.0, 36.6.0, 36.6.1, 36.7.0, 36.7.1, 36.7.2, 36.8.0, 37.0.0, 38.0.0, 38.1.0, 38.2.0, 38.2.1, 38.2.3, 38.2.4, 38.2.5, 38.3.0, 38.4.0, 38.4.1, 38.5.0, 38.5.1, 38.5.2, 38.6.0, 38.6.1, 38.7.0, 39.0.0, 39.0.1, 39.1.0, 39.2.0, 40.0.0, 40.1.0, 40.1.1, 40.2.0, 40.3.0, 40.4.0, 40.4.1, 40.4.2, 40.4.3, 40.5.0, 40.6.0, 40.6.1, 40.6.2, 40.6.3, 40.7.0, 40.7.1, 40.7.2, 40.7.3, 40.8.0, 40.9.0, 41.0.0, 41.0.1, 41.1.0, 41.2.0, 41.3.0, 41.4.0, 41.5.0, 41.5.1, 41.6.0, 42.0.0, 42.0.1, 42.0.2, 43.0.0, 44.0.0, 44.1.0, 44.1.1, 45.0.0, 45.1.0, 45.2.0, 45.3.0, 46.0.0, 46.1.0, 46.1.1, 46.1.2, 46.1.3, 46.2.0, 46.3.0, 46.3.1, 46.4.0, 47.0.0, 47.1.0, 47.1.1, 47.2.0, 47.3.0, 47.3.1, 47.3.2, 48.0.0, 49.0.0, 49.0.1, 49.1.0, 49.1.1, 49.1.2, 49.1.3, 49.2.0, 49.2.1, 49.3.0, 49.3.1, 49.3.2, 49.4.0, 49.5.0, 49.6.0, 50.0.0, 50.0.1, 50.0.2, 50.0.3, 50.1.0, 50.2.0, 50.3.0, 50.3.1, 50.3.2, 51.0.0, 51.1.0, 51.1.0.post20201221, 51.1.1, 51.1.2, 51.2.0, 51.3.0, 51.3.1, 51.3.2, 51.3.3, 52.0.0, 53.0.0, 53.1.0, 54.0.0, 54.1.0, 54.1.1, 54.1.2, 54.1.3, 54.2.0, 56.0.0, 56.1.0, 56.2.0, 57.0.0, 57.1.0, 57.2.0, 57.3.0, 57.4.0) ERROR: No matching distribution found for setuptools==52.0.0.post20210125
(qcourse-venv) D:\qcourse_scripts-main>playwright install msedge 'playwright' 不是内部或外部命令,也不是可运行的程序 或批处理文件。
前面的结果步骤ok,但是到了这一步:playwright install msedge
出现了如下的错误提示:
无法加载文件 D:\Users\Desktop\qcourse_scripts-main\qcourse-venv\Lib\site-packag
es\playwright\driver\package\bin\reinstall_msedge_stable_win.ps1,因为在此系统
中禁止执行脚本。有关详细信息,请参阅 "get-help about_signing"。
所在位置 行:1 字符: 131
Failed to install browsers
Error: Failed to install msedge
如果不理会它,继续进行最后一步:python qcourse.py,
得到这样的日志:
输入需要的功能:0
Traceback (most recent call last):
File "d:\Users\Desktop\qcourse_scripts-main\qcourse-venv\lib\site-packages\pla
ywright_impl_browser_type.py", line 86, in launch
return from_channel(await self._channel.send("launch", params))
File "d:\Users\Desktop\qcourse_scripts-main\qcourse-venv\lib\site-packages\pla
ywright_impl_connection.py", line 36, in send
return await self.inner_send(method, params, False)
File "d:\Users\Desktop\qcourse_scripts-main\qcourse-venv\lib\site-packages\pla
ywright_impl_connection.py", line 54, in inner_send
result = next(iter(done)).result()
playwright._impl._api_types.Error: Chromium distribution 'msedge' is not found a
t C:\Users\Administrator\AppData\Local\Microsoft\Edge\Application\msedge.exe
Run "npx playwright install msedge"
During handling of the above exception, another exception occurred:
"chromium" browser was not found.
Please complete Playwright installation via running
"python -m playwright install"
================================================================================
不知道出了什么问题……麻烦大佬给看看,谢谢♪(・ω・)ノ
Traceback (most recent call last):
File "qcourse.py", line 154, in
main()
File "qcourse.py", line 123, in main
asyncio.run(
File "D:\software\anaconda3\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "D:\software\anaconda3\lib\asyncio\base_events.py", line 616, in run_until_complete
return future.result()
File "qcourse.py", line 80, in download_selected_chapter
urls = get_download_urls(term_id, file_id, cid=cid)
File "D:\workspace\腾讯课堂下载器\qcourse_scripts\utils.py", line 345, in get_download_urls
video_info = get_video_info(
File "D:\workspace\腾讯课堂下载器\qcourse_scripts\utils.py", line 258, in get_video_info
response = requests.get(url, params=params, cookies=load_json_cookies(), proxies=PROXIES).json()
File "D:\workspace\腾讯课堂下载器\qcourse_scripts\qcourse-venv\lib\site-packages\requests\models.py", line 900, in json
return complexjson.loads(self.text, **kwargs)
File "D:\software\anaconda3\lib\json_init_.py", line 357, in loads
return _default_decoder.decode(s)
File "D:\software\anaconda3\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "D:\software\anaconda3\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
请问现在支持微信账号批量下载嘛
Traceback (most recent call last):
File "qcourse.py", line 162, in
main()
File "qcourse.py", line 152, in main
asyncio.run(
File "F:\python3.8.5\lib\asyncio\runners.py", line 43, in run
return loop.run_until_complete(main)
File "F:\python3.8.5\lib\asyncio\base_events.py", line 616, in run_until_complete
return future.result()
File "qcourse.py", line 92, in download_selected_chapter
urls = get_download_urls(term_id, file_id, cid=cid)
File "C:\Users\xx\Downloads\qcourse_scripts-main\utils.py", line 281, in get_download_urls
return get_video_url(video_info, video_index, cid=cid, term_id=term_id)
File "C:\Users\xx\Downloads\qcourse_scripts-main\utils.py", line 253, in get_video_url
+ get_token_for_key_url(term_id=term_id, cid=cid)
File "C:\Users\xx\Downloads\qcourse_scripts-main\utils.py", line 236, in get_token_for_key_url
uin=uin, skey=skey, pskey=pskey, plskey=plskey, cid=cid, term_id=term_id
UnboundLocalError: local variable 'uin' referenced before assignment
报这个错误,这是什么原因呀 拉取的最新代码的
显示如图,
Traceback (most recent call last):
File "E:\qcourse_scripts-main\qcourse.py", line 138, in
main()
File "E:\qcourse_scripts-main\qcourse.py", line 132, in main
asyncio.run(download_selected_chapter(term_id, course_name, chapter_name, courses))
File "C:\Users\lin\AppData\Local\Programs\Python\Python39\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Users\lin\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 642, in run_until_complete
return future.result()
File "E:\qcourse_scripts-main\qcourse.py", line 80, in download_selected_chapter
urls = get_download_urls(term_id, file_id)
File "E:\qcourse_scripts-main\utils.py", line 218, in get_download_urls
video_info = get_video_info(file_id, tokens.get('t'), tokens.get('sign'), tokens.get('us'))
AttributeError: 'NoneType' object has no attribute 'get'
Task exception was never retrieved
future: <Task finished name='Task-8' coro=<download_single() done, defined at E:\qcourse_scripts-main\downloader.py:76> exception=ValueError('Incorrect AES key length (31 bytes)')>
Traceback (most recent call last):
File "E:\qcourse_scripts-main\downloader.py", line 82, in download_single
decrypt_file(str(file) + '.ts', key)
File "E:\qcourse_scripts-main\downloader.py", line 26, in decrypt_file
dec = decrypt(ciphertext, key)
File "E:\qcourse_scripts-main\downloader.py", line 18, in decrypt
cipher = AES.new(key, AES.MODE_CBC, iv)
File "E:\qcourse_scripts-main\venv\lib\site-packages\Crypto\Cipher\AES.py", line 232, in new
return create_cipher(sys.modules[name], key, mode, *args, **kwargs)
File "E:\qcourse_scripts-main\venv\lib\site-packages\Crypto\Cipher_init.py", line 79, in _create_cipher
return modes[mode](factory, **kwargs)
File "E:\qcourse_scripts-main\venv\lib\site-packages\Crypto\Cipher_mode_cbc.py", line 274, in _create_cbc_cipher
cipher_state = factory._create_base_cipher(kwargs)
File "E:\qcourse_scripts-main\venv\lib\site-packages\Crypto\Cipher\AES.py", line 93, in _create_base_cipher
raise ValueError("Incorrect AES key length (%d bytes)" % len(key))
ValueError: Incorrect AES key length (31 bytes)
Task exception was never retrieved
future: <Task finished name='Task-9' coro=<download_single() done, defined at E:\qcourse_scripts-main\downloader.py:76> exception=ValueError('Incorrect AES key length (31 bytes)')>
Traceback (most recent call last):
File "E:\qcourse_scripts-main\downloader.py", line 82, in download_single
decrypt_file(str(file) + '.ts', key)
File "E:\qcourse_scripts-main\downloader.py", line 26, in decrypt_file
dec = decrypt(ciphertext, key)
File "E:\qcourse_scripts-main\downloader.py", line 18, in decrypt
cipher = AES.new(key, AES.MODE_CBC, iv)
File "E:\qcourse_scripts-main\venv\lib\site-packages\Crypto\Cipher\AES.py", line 232, in new
return create_cipher(sys.modules[name], key, mode, *args, **kwargs)
File "E:\qcourse_scripts-main\venv\lib\site-packages\Crypto\Cipher_init.py", line 79, in _create_cipher
return modes[mode](factory, **kwargs)
File "E:\qcourse_scripts-main\venv\lib\site-packages\Crypto\Cipher_mode_cbc.py", line 274, in _create_cbc_cipher
cipher_state = factory._create_base_cipher(kwargs)
File "E:\qcourse_scripts-main\venv\lib\site-packages\Crypto\Cipher\AES.py", line 93, in _create_base_cipher
raise ValueError("Incorrect AES key length (%d bytes)" % len(key))
ValueError: Incorrect AES key length (31 bytes)
Task exception was never retrieved
future: <Task finished name='Task-10' coro=<download_single() done, defined at E:\qcourse_scripts-main\downloader.py:76> exception=ValueError('Incorrect AES key length (31 bytes)')>
Traceback (most recent call last):
File "E:\qcourse_scripts-main\downloader.py", line 82, in download_single
decrypt_file(str(file) + '.ts', key)
File "E:\qcourse_scripts-main\downloader.py", line 26, in decrypt_file
dec = decrypt(ciphertext, key)
File "E:\qcourse_scripts-main\downloader.py", line 18, in decrypt
cipher = AES.new(key, AES.MODE_CBC, iv)
File "E:\qcourse_scripts-main\venv\lib\site-packages\Crypto\Cipher\AES.py", line 232, in new
return create_cipher(sys.modules[name], key, mode, *args, **kwargs)
File "E:\qcourse_scripts-main\venv\lib\site-packages\Crypto\Cipher_init.py", line 79, in _create_cipher
return modes[mode](factory, **kwargs)
File "E:\qcourse_scripts-main\venv\lib\site-packages\Crypto\Cipher_mode_cbc.py", line 274, in _create_cbc_cipher
cipher_state = factory._create_base_cipher(kwargs)
File "E:\qcourse_scripts-main\venv\lib\site-packages\Crypto\Cipher\AES.py", line 93, in _create_base_cipher
raise ValueError("Incorrect AES key length (%d bytes)" % len(key))
ValueError: Incorrect AES key length (31 bytes)
Task exception was never retrieved
future: <Task finished name='Task-11' coro=<download_single() done, defined at E:\qcourse_scripts-main\downloader.py:76> exception=ValueError('Incorrect AES key length (31 bytes)')>
Traceback (most recent call last):
File "E:\qcourse_scripts-main\downloader.py", line 82, in download_single
decrypt_file(str(file) + '.ts', key)
File "E:\qcourse_scripts-main\downloader.py", line 26, in decrypt_file
dec = decrypt(ciphertext, key)
File "E:\qcourse_scripts-main\downloader.py", line 18, in decrypt
cipher = AES.new(key, AES.MODE_CBC, iv)
File "E:\qcourse_scripts-main\venv\lib\site-packages\Crypto\Cipher\AES.py", line 232, in new
return create_cipher(sys.modules[name], key, mode, *args, **kwargs)
File "E:\qcourse_scripts-main\venv\lib\site-packages\Crypto\Cipher_init.py", line 79, in _create_cipher
return modes[mode](factory, **kwargs)
File "E:\qcourse_scripts-main\venv\lib\site-packages\Crypto\Cipher_mode_cbc.py", line 274, in _create_cbc_cipher
cipher_state = factory._create_base_cipher(kwargs)
File "E:\qcourse_scripts-main\venv\lib\site-packages\Crypto\Cipher\AES.py", line 93, in _create_base_cipher
raise ValueError("Incorrect AES key length (%d bytes)" % len(key))
ValueError: Incorrect AES key length (31 bytes)
Task exception was never retrieved
future: <Task finished name='Task-12' coro=<download_single() done, defined at E:\qcourse_scripts-main\downloader.py:76> exception=ValueError('Incorrect AES key length (31 bytes)')>
Traceback (most recent call last):
File "E:\qcourse_scripts-main\downloader.py", line 82, in download_single
decrypt_file(str(file) + '.ts', key)
File "E:\qcourse_scripts-main\downloader.py", line 26, in decrypt_file
dec = decrypt(ciphertext, key)
File "E:\qcourse_scripts-main\downloader.py", line 18, in decrypt
cipher = AES.new(key, AES.MODE_CBC, iv)
File "E:\qcourse_scripts-main\venv\lib\site-packages\Crypto\Cipher\AES.py", line 232, in new
return create_cipher(sys.modules[name], key, mode, *args, **kwargs)
File "E:\qcourse_scripts-main\venv\lib\site-packages\Crypto\Cipher_init.py", line 79, in _create_cipher
return modes[mode](factory, **kwargs)
File "E:\qcourse_scripts-main\venv\lib\site-packages\Crypto\Cipher_mode_cbc.py", line 274, in _create_cbc_cipher
cipher_state = factory._create_base_cipher(kwargs)
File "E:\qcourse_scripts-main\venv\lib\site-packages\Crypto\Cipher\AES.py", line 93, in _create_base_cipher
raise ValueError("Incorrect AES key length (%d bytes)" % len(key))
def get_chapters_from_file(filename, term_index):
# 从json文件内获取章节信息
with open(filename, 'r') as f:
course_info = json.loads(f.read())
chapters = course_info.get('result').get('course_detail').get('terms')[term_index].get('chapter_info')[0]\
.get('sub_info')
return chapters
$ python qcourse.py
0. 下载单个视频
1. 下载课程指定章节
2. 下载课程全部视频
输入需要的功能:2
请输入课程cid:310478
Traceback (most recent call last):
File "D:\Downloads\qcourse_scripts\qcourse.py", line 140, in <module>
main()
File "D:\Downloads\qcourse_scripts\qcourse.py", line 121, in main
course_name = get_course_from_api(cid)
File "D:\Downloads\qcourse_scripts\utils.py", line 20, in get_course_from_api
name = response.get('result').get('course_detail').get('name').replace('/', '/').replace('\\', '\')
AttributeError: 'NoneType' object has no attribute 'get'
似乎只支持msedge89啊,也不会msedge回退版本,请问有没有办法解决呢
ERROR - Task exception was never retrieved
future: <Task finished name='Task-11' coro=<download_single() done, defined at E:\Download\qcourse_scripts-main\downloader.py:138> exception=ValueError('Data must be padded to 16 byte boundary in CBC mode')>
Traceback (most recent call last):
File "E:\Download\qcourse_scripts-main\downloader.py", line 150, in download_single
decrypt_file(str(file) + '.ts', key)
File "E:\Download\qcourse_scripts-main\downloader.py", line 28, in decrypt_file
dec = decrypt(ciphertext, key)
File "E:\Download\qcourse_scripts-main\downloader.py", line 21, in decrypt
plaintext = cipher.decrypt(ciphertext[AES.block_size :])
File "E:\Download\qcourse_scripts-main\qcourse-venv\lib\site-packages\Crypto\Cipher\_mode_cbc.py", line 246, in decrypt
raise ValueError("Data must be padded to %d byte boundary in CBC mode" % self.block_size)
ValueError: Data must be padded to 16 byte boundary in CBC mode
[■■■■■■■■■■■■■■■■■■■■■■■■■■■ ] 91%Traceback (most recent call last): File "qcourse.py", line 154, in <module> main() File "qcourse.py", line 106, in main asyncio.run(parse_course_url_and_download(course_url)) File "C:\Users\admin\AppData\Local\Programs\Python\Python38\lib\asyncio\runners.py", line 44, in run return loop.run_until_complete(main) File "C:\Users\admin\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py", line 616, in run_until_complete return future.result() File "qcourse.py", line 68, in parse_course_url_and_download await download_single(urls[0], urls[1], filename, path) File "C:\Users\admin\Documents\qcourse_scripts-main\qcourse_scripts-main\downloader.py", line 150, in download_single decrypt_file(str(file) + '.ts', key) File "C:\Users\admin\Documents\qcourse_scripts-main\qcourse_scripts-main\downloader.py", line 28, in decrypt_file dec = decrypt(ciphertext, key) File "C:\Users\admin\Documents\qcourse_scripts-main\qcourse_scripts-main\downloader.py", line 20, in decrypt cipher = AES.new(key, AES.MODE_CBC, iv) File "C:\Users\admin\Documents\qcourse_scripts-main\qcourse_scripts-main\qcourse-venv\lib\site-packages\Crypto\Cipher\AES.py", line 232, in new return _create_cipher(sys.modules[__name__], key, mode, *args, **kwargs) File "C:\Users\admin\Documents\qcourse_scripts-main\qcourse_scripts-main\qcourse-venv\lib\site-packages\Crypto\Cipher\__init__.py", line 79, in _create_cipher return modes[mode](factory, **kwargs) File "C:\Users\admin\Documents\qcourse_scripts-main\qcourse_scripts-main\qcourse-venv\lib\site-packages\Crypto\Cipher\_mode_cbc.py", line 274, in _create_cbc_cipher cipher_state = factory._create_base_cipher(kwargs) File "C:\Users\admin\Documents\qcourse_scripts-main\qcourse_scripts-main\qcourse-venv\lib\site-packages\Crypto\Cipher\AES.py", line 93, in _create_base_cipher raise ValueError("Incorrect AES key length (%d bytes)" % len(key)) ValueError: Incorrect AES key length (39 bytes)
环境mac bigsur
Traceback (most recent call last):
File "/Users/zhaolong/qcourse_scripts/qcourse.py", line 138, in <module>
main()
File "/Users/zhaolong/qcourse_scripts/qcourse.py", line 132, in main
asyncio.run(download_selected_chapter(term_id, course_name, chapter_name, courses))
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
return future.result()
File "/Users/zhaolong/qcourse_scripts/qcourse.py", line 80, in download_selected_chapter
urls = get_download_urls(term_id, file_id)
File "/Users/zhaolong/qcourse_scripts/utils.py", line 218, in get_download_urls
video_info = get_video_info(file_id, tokens.get('t'), tokens.get('sign'), tokens.get('us'))
AttributeError: 'NoneType' object has no attribute 'get'
zhaolong@Orislands-MacBook-Air qcourse_scripts %
能否增加支持
Connected to pydev debugger (build 212.5284.44)
0. 下载单个视频
输入需要的功能:python-BaseException
Traceback (most recent call last):
File "C:\Users\Administrator\PycharmProjects\qcourse_scripts\venv\lib\site-packages\playwright_impl_browser_type.py", line 86, in launch
return from_channel(await self._channel.send("launch", params))
File "C:\Users\Administrator\PycharmProjects\qcourse_scripts\venv\lib\site-packages\playwright_impl_connection.py", line 36, in send
return await self.inner_send(method, params, False)
File "C:\Users\Administrator\PycharmProjects\qcourse_scripts\venv\lib\site-packages\playwright_impl_connection.py", line 54, in inner_send
result = next(iter(done)).result()
playwright._impl._api_types.Error: Chromium distribution 'msedge' is not found at C:\Users\Administrator\AppData\Local\Microsoft\Edge\Application\msedge.exe
Run "npx playwright install msedge"
During handling of the above exception, another exception occurred:
"chromium" browser was not found.
Please complete Playwright installation via running
"python -m playwright install"
================================================================================
Process finished with exit code 1
课堂网页更新,程序报错,求大神更新,错误如下
ValueError: Data must be padded to 16 byte boundary in CBC mode
(qcourse-venv) PS D:\qcourse_scripts-main> python qcourse.py
0. 下载单个视频
输入需要的功能:1
请输入课程cid:3138704
Traceback (most recent call last):
File "D:\qcourse_scripts-main\qcourse.py", line 140, in
main()
File "D:\qcourse_scripts-main\qcourse.py", line 105, in main
course_name = get_course_from_api(cid)
File "D:\qcourse_scripts-main\utils.py", line 20, in get_course_from_api
name = response.get('result').get('course_detail').get('name').replace('/', '/').replace('\', '\')
AttributeError: 'NoneType' object has no attribute 'get'
(qcourse-venv) PS D:\qcourse_scripts-main>
但是下载到第三个时,就无法自动合成视频为mp4了
https://ke.qq.com/cgi-bin/course/basic_info?cid=
上面这个接口要带防盗链,不然查询不到参数
错误的返回:{"msg":"refer错误","type":1,"retcode":100101}
建议解决办法:
在utils.py文件里,的get_course_from_api函数中,添加headers参数
如:
'''
headers = {
'referer': 'https://ke.qq.com/user/index/index.html',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) '
'Chrome/80.0.3987.132 Safari/537.36 '
}
'''
即可
完整函数:
''' python
def get_course_from_api(cid=None):
headers = {
'referer': 'https://ke.qq.com/user/index/index.html',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) '
'Chrome/80.0.3987.132 Safari/537.36 '
}
# 获取课程信息
if cid is None:
print('请输入cid!')
url = 'https://ke.qq.com/cgi-bin/course/basic_info?cid=' + str(cid)
response = requests.get(url=url, headers=headers).json()
name = response.get('result').get('course_detail').get('name').replace('/', '/').replace('\', '\')
with open(name + '.json', 'w') as f:
f.write(json.dumps(response))
return name
'''
cid:
qcourse-venv) F:\tx\qcourse_scripts-main>playwright install msedge
Failed to install browsers
Error:
╔═════════════════════════════════════════════════════════════════╗
║ ATTENTION: "msedge" is already installed on the system! ║
║ ║
║ "msedge" installation is not hermetic; installing newer version ║
║ requires removal of a current installation first. ║
║ ║
║ To uninstall current version and re-install latest "msedge": ║
║ ║
║ - Close all running instances of "msedge", if any ║
║ - Use "--force" to install browser: ║
║ ║
║ playwright install --force msedge ║
║ ║
║ <3 Playwright Team ║
╚═════════════════════════════════════════════════════════════════╝
在提问提前,建议先在issues页面的搜索框里找一下有没有一样的问题,这样可以节约大家时间
如果你解决了程序中问题,可以在其他人的issues里分享下你的解决方法,有能力的可以pr推给我,我看到会merge的
感谢各位对本脚本的支持😃
我 fork 了你的代码 https://github.com/LengGeng/qq_course
我尝试自己改了下(使用的是哪个新的get_rec_video_info接口),又发现很很多问题,不知道它又改接口了还是我的问题
key_url 也不知道为啥一直提示未登录
周期性地出现下列提示:
Task exception was never retrieved
future: <Task finished name='Task-26' coro=<download_single() done, defined at C:\xiaochengxu\qcourse_scripts\downloader.py:76> exception=ValueError('Incorrect AES key length (53 bytes)')>
Traceback (most recent call last):
File "C:\xiaochengxu\qcourse_scripts\downloader.py", line 82, in download_single
decrypt_file(str(file) + '.ts', key)
File "C:\xiaochengxu\qcourse_scripts\downloader.py", line 26, in decrypt_file
dec = decrypt(ciphertext, key)
File "C:\xiaochengxu\qcourse_scripts\downloader.py", line 18, in decrypt
cipher = AES.new(key, AES.MODE_CBC, iv)
File "C:\xiaochengxu\qcourse_scripts\qcourse-venv\lib\site-packages\Crypto\Cipher\AES.py", line 232, in new
return _create_cipher(sys.modules[__name__], key, mode, *args, **kwargs)
File "C:\xiaochengxu\qcourse_scripts\qcourse-venv\lib\site-packages\Crypto\Cipher\__init__.py", line 79, in _create_cipher
return modes[mode](factory, **kwargs)
File "C:\xiaochengxu\qcourse_scripts\qcourse-venv\lib\site-packages\Crypto\Cipher\_mode_cbc.py", line 274, in _create_cbc_cipher
cipher_state = factory._create_base_cipher(kwargs)
File "C:\xiaochengxu\qcourse_scripts\qcourse-venv\lib\site-packages\Crypto\Cipher\AES.py", line 93, in _create_base_cipher
raise ValueError("Incorrect AES key length (%d bytes)" % len(key))
ValueError: Incorrect AES key length (53 bytes)
这种情况,应该怎么解决呢?
ERROR - Task exception was never retrieved
future: <Task finished name='Task-15' coro=<download_single() done, defined at E:\Download\qcourse_scripts-main\qcourse_scripts-main\downloader.py:138> exception=ValueError('Incorrect AES key length (39 bytes)')>
Traceback (most recent call last):
File "E:\Download\qcourse_scripts-main\qcourse_scripts-main\downloader.py", line 150, in download_single
decrypt_file(str(file) + '.ts', key)
File "E:\Download\qcourse_scripts-main\qcourse_scripts-main\downloader.py", line 28, in decrypt_file
dec = decrypt(ciphertext, key)
File "E:\Download\qcourse_scripts-main\qcourse_scripts-main\downloader.py", line 20, in decrypt
cipher = AES.new(key, AES.MODE_CBC, iv)
File "E:\Download\qcourse_scripts-main\qcourse_scripts-main\qcourse-venv\lib\site-packages\Crypto\Cipher\AES.py", line 232, in new
return create_cipher(sys.modules[name], key, mode, *args, **kwargs)
File "E:\Download\qcourse_scripts-main\qcourse_scripts-main\qcourse-venv\lib\site-packages\Crypto\Cipher_init.py", line 79, in _create_cipher
return modes[mode](factory, **kwargs)
File "E:\Download\qcourse_scripts-main\qcourse_scripts-main\qcourse-venv\lib\site-packages\Crypto\Cipher_mode_cbc.py", line 274, in _create_cbc_cipher
cipher_state = factory._create_base_cipher(kwargs)
File "E:\Download\qcourse_scripts-main\qcourse_scripts-main\qcourse-venv\lib\site-packages\Crypto\Cipher\AES.py", line 93, in _create_base_cipher
raise ValueError("Incorrect AES key length (%d bytes)" % len(key))
ValueError: Incorrect AES key length (39 bytes)
输入需要的功能:0
输入课程链接:https://ke.qq.com/webcourse/4355298/104519918#taid=45766197&lite=1&vid=387702296971725976
dad1ae2e-aac8-11ec-aa00-98fa9b0b8394 开始下载
Traceback (most recent call last):
File "D:\A\qcourse_scripts\qcourse.py", line 162, in <module>
main()
File "D:\A\qcourse_scripts\qcourse.py", line 118, in main
asyncio.run(parse_course_url_and_download(course_url))
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2800.0_x64__qbz5n2kfra8p0\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2800.0_x64__qbz5n2kfra8p0\lib\asyncio\base_events.py", line 642, in run_until_complete
return future.result()
File "D:\A\qcourse_scripts\qcourse.py", line 80, in parse_course_url_and_download
await download_single(urls[0], urls[1], filename, path)
File "D:\A\qcourse_scripts\downloader.py", line 149, in download_single
decrypt_file(str(file) + '.ts', key)
File "D:\A\qcourse_scripts\downloader.py", line 27, in decrypt_file
dec = decrypt(ciphertext, key)
File "D:\A\qcourse_scripts\downloader.py", line 20, in decrypt
plaintext = cipher.decrypt(ciphertext[AES.block_size :])
File "D:\A\qcourse_scripts\qcourse-venv\lib\site-packages\Crypto\Cipher\_mode_cbc.py", line 246, in decrypt
raise ValueError("Data must be padded to %d byte boundary in CBC mode" % self.block_size)
ValueError: Data must be padded to 16 byte boundary in CBC mode
试了下其他两个功能,在线课程的课程回放批量下载应该不支持?于是手动单个视频下载。。
貌似只有上面这个链接会出问题,该课程其他回放正常下载并转码(只是最后说shell出现异常
windows10环境:
获取课程信息成功,准备下载!
Traceback (most recent call last):
File "C:\Users\xxx\Desktop\qcourse_scripts-main\qcourse.py", line 147, in
main()
File "C:\Users\xxx\Desktop\qcourse_scripts-main\qcourse.py", line 130, in main
qq_course = QCourse()
File "C:\Users\xxx\Desktop\qcourse_scripts-main\qcourse.py", line 32, in init
self.driver = Edge(executable_path='msedgedriver.exe', options=self.options)
File "C:\Users\xxx\AppData\Local\Programs\Python\Python39\lib\site-packages\msedge\selenium_tools\webdriver.py", line 103, in init
RemoteWebDriver.init(
File "C:\Users\xxx\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in init
self.start_session(capabilities, browser_profile)
File "C:\Users\xxx\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "C:\Users\xxx\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\xxx\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find MSEdge binary
Traceback (most recent call last):
File "D:\study\3\qcourse_scripts\qcourse.py", line 162, in
main()
File "D:\study\3\qcourse_scripts\qcourse.py", line 118, in main
asyncio.run(parse_course_url_and_download(course_url))
File "C:\Python39\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Python39\lib\asyncio\base_events.py", line 642, in run_until_complete
return future.result()
File "D:\study\3\qcourse_scripts\qcourse.py", line 78, in parse_course_url_and_download
urls = get_download_url_from_course_url(video_url, -1)
File "D:\study\3\qcourse_scripts\utils.py", line 273, in get_download_url_from_course_url
tokens = get_video_token(term_id, file_id)
File "D:\study\3\qcourse_scripts\utils.py", line 198, in get_video_token
response = requests.get(
File "D:\study\3\qcourse_scripts\qcourse-venv\lib\site-packages\requests\api.py", line 76, in get
return request('get', url, params=params, **kwargs)
File "D:\study\3\qcourse_scripts\qcourse-venv\lib\site-packages\requests\api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "D:\study\3\qcourse_scripts\qcourse-venv\lib\site-packages\requests\sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "D:\study\3\qcourse_scripts\qcourse-venv\lib\site-packages\requests\sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "D:\study\3\qcourse_scripts\qcourse-venv\lib\site-packages\requests\adapters.py", line 439, in send
resp = conn.urlopen(
File "D:\study\3\qcourse_scripts\qcourse-venv\lib\site-packages\urllib3\connectionpool.py", line 696, in urlopen
self._prepare_proxy(conn)
File "D:\study\3\qcourse_scripts\qcourse-venv\lib\site-packages\urllib3\connectionpool.py", line 964, in _prepare_proxy
conn.connect()
File "D:\study\3\qcourse_scripts\qcourse-venv\lib\site-packages\urllib3\connection.py", line 359, in connect
conn = self._connect_tls_proxy(hostname, conn)
File "D:\study\3\qcourse_scripts\qcourse-venv\lib\site-packages\urllib3\connection.py", line 500, in connect_tls_proxy
return ssl_wrap_socket(
File "D:\study\3\qcourse_scripts\qcourse-venv\lib\site-packages\urllib3\util\ssl.py", line 432, in ssl_wrap_socket
ssl_sock = ssl_wrap_socket_impl(sock, context, tls_in_tls)
File "D:\study\3\qcourse_scripts\qcourse-venv\lib\site-packages\urllib3\util\ssl.py", line 474, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock)
File "C:\Python39\lib\ssl.py", line 500, in wrap_socket
return self.sslsocket_class._create(
File "C:\Python39\lib\ssl.py", line 997, in _create
raise ValueError("check_hostname requires server_hostname")
ValueError: check_hostname requires server_hostname
\qcourse_scripts-main\utils.py", line 18, in
from logger import logger
ModuleNotFoundError: No module named 'logger'
提示没utils文件引用的包中没有logger这个文件
老哥,咋肥事啊
大佬好!请教一下,我在pip install -Ur requirements.txt这一步报错,按照一个已关闭的issue(https://github.com/aiguoli/qcourse_scripts/issues/21) 里的换源的方法未解决
设备版本:
win10 21H2,python3.10.5
没放在C盘,放在文件夹:E:\qcourse_scripts-main
复现过程:
我先在cmd里执行了cd E:\qcourse_scripts-main,然后python -m venv qcourse-venv、qcourse-venv\scripts\activate
此进入到了一个新的命令行界面,然后执行pip install -Ur E:\qcourse_scripts-main\requirements.txt,出现和一个已关闭的issue(https://github.com/aiguoli/qcourse_scripts/issues/21) 里相同错误,于是执行了永久换源pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple ,然后再pip install -Ur E:\qcourse_scripts-main\requirements.txt,没有任何变化,仍然出现相同错误。
请问如何解决呢?
报错如下:
Using legacy 'setup.py install' for greenlet, since package 'wheel' is not installed.
Using legacy 'setup.py install' for Pillow, since package 'wheel' is not installed.
Using legacy 'setup.py install' for websockets, since package 'wheel' is not installed.
Building wheels for collected packages: multidict, yarl, aiohttp
Building wheel for multidict (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for multidict (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [67 lines of output]
*********************
* Accelerated build *
*********************
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-cpython-310
creating build\lib.win-amd64-cpython-310\multidict
copying multidict_abc.py -> build\lib.win-amd64-cpython-310\multidict
copying multidict_compat.py -> build\lib.win-amd64-cpython-310\multidict
copying multidict_multidict_base.py -> build\lib.win-amd64-cpython-310\multidict
copying multidict_multidict_py.py -> build\lib.win-amd64-cpython-310\multidict
copying multidict_init_.py -> build\lib.win-amd64-cpython-310\multidict
running egg_info
writing multidict.egg-info\PKG-INFO
writing dependency_links to multidict.egg-info\dependency_links.txt
writing top-level names to multidict.egg-info\top_level.txt
reading manifest file 'multidict.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '*.pyc' found anywhere in distribution
warning: no previously-included files found matching 'multidict_multidict.html'
warning: no previously-included files found matching 'multidict*.so'
warning: no previously-included files found matching 'multidict*.pyd'
warning: no previously-included files found matching 'multidict*.pyd'
no previously-included directories found matching 'docs_build'
adding license file 'LICENSE'
writing manifest file 'multidict.egg-info\SOURCES.txt'
C:\Users\Yunjiao\AppData\Local\Temp\pip-build-env-ktti29ps\overlay\Lib\site-packages\setuptools\command\build_py.py:153: SetuptoolsDeprecationWarning: Installing 'multidict._multilib' as data is deprecated, please list it in packages
.
!!
############################
# Package would be ignored #
############################
Python recognizes 'multidict._multilib' as an importable package,
but it is not listed in the `packages` configuration of setuptools.
'multidict._multilib' has been automatically added to the distribution only
because it may contain data files, but this behavior is likely to change
in future versions of setuptools (and therefore is considered deprecated).
Please make sure that 'multidict._multilib' is included as a package by using
the `packages` configuration field or the proper discovery methods
(for example by using `find_namespace_packages(...)`/`find_namespace:`
instead of `find_packages(...)`/`find:`).
You can read more about "package discovery" and "data files" on setuptools
documentation page.
!!
check.warn(importable)
copying multidict\__init__.pyi -> build\lib.win-amd64-cpython-310\multidict
copying multidict\_multidict.c -> build\lib.win-amd64-cpython-310\multidict
copying multidict\py.typed -> build\lib.win-amd64-cpython-310\multidict
creating build\lib.win-amd64-cpython-310\multidict\_multilib
copying multidict\_multilib\defs.h -> build\lib.win-amd64-cpython-310\multidict\_multilib
copying multidict\_multilib\dict.h -> build\lib.win-amd64-cpython-310\multidict\_multilib
copying multidict\_multilib\istr.h -> build\lib.win-amd64-cpython-310\multidict\_multilib
copying multidict\_multilib\iter.h -> build\lib.win-amd64-cpython-310\multidict\_multilib
copying multidict\_multilib\pair_list.h -> build\lib.win-amd64-cpython-310\multidict\_multilib
copying multidict\_multilib\views.h -> build\lib.win-amd64-cpython-310\multidict\_multilib
running build_ext
building 'multidict._multidict' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for multidict
Building wheel for yarl (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for yarl (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [38 lines of output]
C:\Users\Yunjiao\AppData\Local\Temp\pip-build-env-h9nyg2us\overlay\Lib\site-packages\setuptools\config\setupcfg.py:463: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
warnings.warn(msg, warning_class)
**********************
* Accellerated build *
**********************
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-cpython-310
creating build\lib.win-amd64-cpython-310\yarl
copying yarl_quoting.py -> build\lib.win-amd64-cpython-310\yarl
copying yarl_quoting_py.py -> build\lib.win-amd64-cpython-310\yarl
copying yarl_url.py -> build\lib.win-amd64-cpython-310\yarl
copying yarl_init_.py -> build\lib.win-amd64-cpython-310\yarl
running egg_info
writing yarl.egg-info\PKG-INFO
writing dependency_links to yarl.egg-info\dependency_links.txt
writing requirements to yarl.egg-info\requires.txt
writing top-level names to yarl.egg-info\top_level.txt
reading manifest file 'yarl.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '.pyc' found anywhere in distribution
warning: no previously-included files matching '.cache' found anywhere in distribution
warning: no previously-included files found matching 'yarl*.html'
warning: no previously-included files found matching 'yarl*.so'
warning: no previously-included files found matching 'yarl*.pyd'
no previously-included directories found matching 'docs_build'
adding license file 'LICENSE'
writing manifest file 'yarl.egg-info\SOURCES.txt'
copying yarl_init_.pyi -> build\lib.win-amd64-cpython-310\yarl
copying yarl_quoting_c.c -> build\lib.win-amd64-cpython-310\yarl
copying yarl_quoting_c.pyi -> build\lib.win-amd64-cpython-310\yarl
copying yarl_quoting_c.pyx -> build\lib.win-amd64-cpython-310\yarl
copying yarl\py.typed -> build\lib.win-amd64-cpython-310\yarl
running build_ext
building 'yarl._quoting_c' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for yarl
Building wheel for aiohttp (pyproject.toml) ... done
Created wheel for aiohttp: filename=aiohttp-3.7.4.post0-py3-none-any.whl size=451929 sha256=0288973d36fcbc49aa0bf515aea84a11ec600ddbb79229cd38d6dab991a97228
Stored in directory: c:\users\yunjiao\appdata\local\pip\cache\wheels\a3\57\55\959e243754be9b2979a138ba11d22a4a5538b1b1620d0510cd
Successfully built aiohttp
Failed to build multidict yarl
ERROR: Could not build wheels for multidict, yarl, which is required to install pyproject.toml-based projects
WARNING: You are using pip version 22.0.4; however, version 22.1.2 is available.
You should consider upgrading via the 'C:\Users\Yunjiao\qcourse-venv\Scripts\python.exe -m pip install --upgrade pip' command.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.