neuronalism / edxdlr

edx Downloader 课程视频工具
GNU General Public License v3.0
18 stars 6 forks source link

Can not download subtitle #11

Open kaiserphong opened 1 year ago

kaiserphong commented 1 year ago

First, I want to say thank you so much to you for this tool, it help me a lot to download video and pdf file. but it can not download subtitle of some my courses; For example: course ID: course-v1:MITx+3.032.1x+3T2019

File "C:\Users\Kaiser\Desktop\edxdlr-master\edxdlr.py", line 841, in main() File "C:\Users\Kaiser\Desktop\edxdlr-master\edxdlr.py", line 834, in main download_course(args, course_block, runtime.headers, file_formats) File "C:\Users\Kaiser\Desktop\edxdlr-master\edxdlr.py", line 718, in download_course download_unit(unitobj, args, target_dir, filename_prefix, headers) File "C:\Users\Kaiser\Desktop\edxdlr-master\edxdlr.py", line 687, in download_unit download_video(unit, args, target_dir, filename_prefix, headers) File "C:\Users\Kaiser\Desktop\edxdlr-master\edxdlr.py", line 650, in download_video sub_downloads = _build_subtitles_downloads(video_unit, target_dir, filename_prefix, headers) File "C:\Users\Kaiser\Desktop\edxdlr-master\edxdlr.py", line 515, in _build_subtitles_downloads subtitles_download_urls = get_subtitles_urls(video.subs_available_url, File "C:\Users\Kaiser\Desktop\edxdlr-master\edxdlr.py", line 455, in get_subtitles_urls available_subs = get_page_contents_as_json(available_subs_url, File "C:\Users\Kaiser\Desktop\edxdlr-master\utils.py", line 91, in get_page_contents_as_json json_string = get_page_contents(url, headers, params) File "C:\Users\Kaiser\Desktop\edxdlr-master\utils.py", line 72, in get_page_contents response = runtime.session.get(url, params=params, headers=headers) File "C:\Users\Kaiser\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\requests\sessions.py", line 543, in get return self.request('GET', url, kwargs) File "C:\Users\Kaiser\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\requests\sessions.py", line 530, in request resp = self.send(prep, send_kwargs) File "C:\Users\Kaiser\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\requests\sessions.py", line 637, in send adapter = self.get_adapter(url=request.url) File "C:\Users\Kaiser\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\requests\sessions.py", line 730, in get_adapter raise InvalidSchema("No connection adapters were found for {!r}".format(url)) requests.exceptions.InvalidSchema: No connection adapters were found for '/courses/course-v1:MITx+3.032.1x+3T2019/xblock/block-v1:MITx+3.032.1x+3T2019+type@video+block@e69dd0e13c6f4d568506b402a8e7b54d/handler/transcript/available_translations'

I need to download subtitle of this video by manual and this is link: https://courses.edx.org/courses/course-v1:MITx+3.032.1x+3T2019/xblock/block-v1:MITx+3.032.1x+3T2019+type@video+block@e69dd0e13c6f4d568506b402a8e7b54d/handler/transcript/download

I am looking forward to your support!

kaiserphong commented 1 year ago

@neuronalism I saw your update but it still can not download subtiles

File "C:\Users\Kaiser\Desktop\edxdlr-master\edxdlr.py", line 859, in main() File "C:\Users\Kaiser\Desktop\edxdlr-master\edxdlr.py", line 852, in main download_course(args, course_block, runtime.headers, file_formats) File "C:\Users\Kaiser\Desktop\edxdlr-master\edxdlr.py", line 736, in download_course download_unit(unitobj, args, target_dir, filename_prefix, headers) File "C:\Users\Kaiser\Desktop\edxdlr-master\edxdlr.py", line 699, in download_unit download_video(unit, args, target_dir, filename_prefix, headers) File "C:\Users\Kaiser\Desktop\edxdlr-master\edxdlr.py", line 662, in download_video sub_downloads = _build_subtitles_downloads(args, video_unit, target_dir, filename_prefix, headers) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Kaiser\Desktop\edxdlr-master\edxdlr.py", line 524, in _build_subtitles_downloads subtitles_download_urls = get_subtitles_urls(video.subs_available_url, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Kaiser\Desktop\edxdlr-master\edxdlr.py", line 461, in get_subtitles_urls available_subs = get_page_contents_as_json(available_subs_url, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Kaiser\Desktop\edxdlr-master\utils.py", line 91, in get_page_contents_as_json json_string = get_page_contents(url, headers, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Kaiser\Desktop\edxdlr-master\utils.py", line 72, in get_page_contents response = runtime.session.get(url, params=params, headers=headers) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Kaiser\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\requests\sessions.py", line 602, in get return self.request("GET", url, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Kaiser\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\requests\sessions.py", line 589, in request resp = self.send(prep, send_kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Kaiser\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\requests\sessions.py", line 697, in send adapter = self.get_adapter(url=request.url) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Kaiser\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\requests\sessions.py", line 794, in get_adapter raise InvalidSchema(f"No connection adapters were found for {url!r}") requests.exceptions.InvalidSchema: No connection adapters were found for '/courses/course-v1:USMx+ENES608.1+2T2020/xblock/block-v1:USMx+ENES608.1+2T2020+type@video+block@6d78e87f52f54a028b92ee57cf506457/handler/transcript/available_translations'

neuronalism commented 1 year ago

Yeah this is a known issue I currently have no solution for. I'll leave it here till I got some time to debug and fix this.