Puyodead1 / udemy-downloader

A Udemy downloader that can download lectures, with DRM support.
MIT License
1.19k stars 276 forks source link

[Bug]: 'NoneType' object has no attribute 'group' #227

Open jaan143 opened 3 weeks ago

jaan143 commented 3 weeks ago

What happened?

while downloading course i am getting this error in reaching specific lecture. i re-run script but still script giving error when reaching on this lecture.

[04:38:09] [udemy-downloader] [parse_new:1788] INFO: > Processing 0 asset(s) for lecture... Traceback (most recent call last): File "D:\data\downloader-master\main.py", line 2068, in if name == "main": ^^^^^^ File "D:\data\downloader-master\main.py", line 2061, in main

File "D:\data\downloader-master\main.py", line 1745, in parse_new index = lecture.get("index") # this is lecture_counter ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\data\downloader-master\main.py", line 1006, in _parse_lecture if stream_urls and isinstance(stream_urls, dict): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\data\downloader-master\main.py", line 523, in _extract_sources out = self._extract_m3u8(download_url) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\data\downloader-master\main.py", line 587, in _extract_m3u8 asset_id = asset_id_re.search(url).group("id") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'group'

D:\data\downloader-master>

Expected Result

it will be great if can fix this issue and i can download this lecture

Branch

master/main

What operating systems are you seeing the problem on?

Windows

Relevant log output

No response

Other information

No response

jaan143 commented 2 weeks ago

@Puyodead1

something is wrong with only some courses which are giving this type of error

[06:14:03] [udemy-downloader] [_get:1115] ERROR: 403 Forbidden, retrying (attempt 8 )... [06:14:08] [udemy-downloader] [_get:1114] ERROR: Failed request https://www.udemy.com/course/dumisnetwork-javascript-basico/learn/ [06:14:08] [udemy-downloader] [_get:1115] ERROR: 403 Forbidden, retrying (attempt 9 )... Traceback (most recent call last): File "M:\data\downloader-master\main.py", line 2072, in main() File "M:\data\downloader-master\main.py", line 1942, in main course_id, course_info = udemy._extract_course_info(course_url) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "M:\data\downloader-master\main.py", line 956, in _extract_course_info course_id = self._extract_subscription_course_info(url) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "M:\data\downloader-master\main.py", line 925, in _extract_subscription_course_info course_html = self.session._get(url).text ^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'text'

Puyodead1 commented 2 weeks ago

@Puyodead1

something is wrong with only some courses which are giving this type of error

[06:14:03] [udemy-downloader] [_get:1115] ERROR: 403 Forbidden, retrying (attempt 8 )... [06:14:08] [udemy-downloader] [_get:1114] ERROR: Failed request https://www.udemy.com/course/dumisnetwork-javascript-basico/learn/ [06:14:08] [udemy-downloader] [_get:1115] ERROR: 403 Forbidden, retrying (attempt 9 )... Traceback (most recent call last): File "M:\data\downloader-master\main.py", line 2072, in main() File "M:\data\downloader-master\main.py", line 1942, in main course_id, course_info = udemy._extract_course_info(course_url) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "M:\data\downloader-master\main.py", line 956, in _extract_course_info course_id = self._extract_subscription_course_info(url) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "M:\data\downloader-master\main.py", line 925, in _extract_subscription_course_info course_html = self.session._get(url).text ^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'text'

use the feat/refactor branch

jaan143 commented 2 weeks ago

@Puyodead1 same text error in this branch also. may be you think it is because other language issue but some english courses also giving the same error.

swahpy commented 1 week ago

hi, I have the same issue and it worked after switch to feat/refactor branch.

jaan143 commented 30 minutes ago

@swahpy can you give me link of feat/refactor branch ? evan i am getting error in this branch also and personal plan also geting text error in feat/refactor branch evan i am using browser command

Puyodead1 commented 27 minutes ago

@swahpy can you give me link of feat/refactor branch ? evan i am getting error in this branch also and personal plan also geting text error in feat/refactor branch evan i am using browser command

It doesn't exist anymore. Use master

jaan143 commented 25 minutes ago

@Puyodead1 master branch is still not supporting personal pro plan account i am trying but getting 'Text' error. if you want i can show you full log file

Puyodead1 commented 23 minutes ago

@Puyodead1 master branch is still not supporting personal pro plan account i am trying but getting 'Text' error. if you want i can show you full log file

Yes it does, I can confirm that because I am using a trial account right now. You might not be using the latest version. Make sure you have the /learn part in the url

jaan143 commented 22 minutes ago

@Puyodead1 i am using url in this format https://www.udemy.com/course/my-master-system/learn/

yes i am using latest version of master branch and one more thing this new updated script is not removing enc files after dec.

jaan143 commented 16 minutes ago

@Puyodead1 please check this. this is with your latest script

M:\udemy-downloader-master_3>python main.py -c https://www.udemy.com/course/excel-for-analysts/learn -o M:\Tut --download-assets [06:09:56] [udemy-downloader] [pre_run:332] INFO: Output directory set to M:\Tut [06:09:57] [udemy-downloader] [main:1839] INFO: > Fetching course information, this may take a minute... [06:10:04] [udemy-downloader] [_get:1118] ERROR: Failed request https://www.udemy.com/course/excel-for-analysts/learn [06:10:04] [udemy-downloader] [_get:1119] ERROR: 403 Forbidden, retrying (attempt 0 )... [06:10:06] [udemy-downloader] [_get:1118] ERROR: Failed request https://www.udemy.com/course/excel-for-analysts/learn [06:10:06] [udemy-downloader] [_get:1119] ERROR: 403 Forbidden, retrying (attempt 1 )... [06:10:09] [udemy-downloader] [_get:1118] ERROR: Failed request https://www.udemy.com/course/excel-for-analysts/learn [06:10:09] [udemy-downloader] [_get:1119] ERROR: 403 Forbidden, retrying (attempt 2 )... [06:10:11] [udemy-downloader] [_get:1118] ERROR: Failed request https://www.udemy.com/course/excel-for-analysts/learn [06:10:11] [udemy-downloader] [_get:1119] ERROR: 403 Forbidden, retrying (attempt 3 )... [06:10:14] [udemy-downloader] [_get:1118] ERROR: Failed request https://www.udemy.com/course/excel-for-analysts/learn [06:10:14] [udemy-downloader] [_get:1119] ERROR: 403 Forbidden, retrying (attempt 4 )... [06:10:17] [udemy-downloader] [_get:1118] ERROR: Failed request https://www.udemy.com/course/excel-for-analysts/learn [06:10:17] [udemy-downloader] [_get:1119] ERROR: 403 Forbidden, retrying (attempt 5 )... [06:10:19] [udemy-downloader] [_get:1118] ERROR: Failed request https://www.udemy.com/course/excel-for-analysts/learn [06:10:19] [udemy-downloader] [_get:1119] ERROR: 403 Forbidden, retrying (attempt 6 )... [06:10:22] [udemy-downloader] [_get:1118] ERROR: Failed request https://www.udemy.com/course/excel-for-analysts/learn [06:10:22] [udemy-downloader] [_get:1119] ERROR: 403 Forbidden, retrying (attempt 7 )... [06:10:25] [udemy-downloader] [_get:1118] ERROR: Failed request https://www.udemy.com/course/excel-for-analysts/learn [06:10:25] [udemy-downloader] [_get:1119] ERROR: 403 Forbidden, retrying (attempt 8 )... [06:10:27] [udemy-downloader] [_get:1118] ERROR: Failed request https://www.udemy.com/course/excel-for-analysts/learn [06:10:27] [udemy-downloader] [_get:1119] ERROR: 403 Forbidden, retrying (attempt 9 )... Traceback (most recent call last): File "M:\udemy-downloader-master_3\main.py", line 2016, in main() File "M:\udemy-downloader-master_3\main.py", line 1841, in main course_id, course_info = udemy._extract_course_info(course_url) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "M:\udemy-downloader-master_3\main.py", line 960, in _extract_course_info course_id = self._extract_subscription_course_info(url) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "M:\udemy-downloader-master_3\main.py", line 927, in _extract_subscription_course_info course_html = self.session._get(url).text ^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'text'

M:\udemy-downloader-master_3>

Puyodead1 commented 12 minutes ago

You're not using -sc or specifying a browser to extract cookies from

jaan143 commented 1 minute ago

@Puyodead1 same error when i am using this command python main.py -c https://www.udemy.com/course/excel-for-analysts/learn/ -o M:\Tut -sc --download-assets

same error i am getting when using this command python main.py -c https://www.udemy.com/course/excel-for-analysts/learn/ -o M:\Tut -sc --download-assets --browser chrome

evan my bearer token is correct and working and i added it also in .env file but getting same above error