r0oth3x49 / udemy-dl

A cross-platform python based utility to download courses from udemy for personal offline use.
MIT License
4.83k stars 1.19k forks source link

json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) #529

Closed xd003 closed 3 years ago

xd003 commented 3 years ago

Describe the bug I tried to get info of all lectures and also tried downloading the lectures but getting the same error always. The login through cookies is successful but its unable to fetch any info from udemy

To Reproduce Steps to reproduce the behavior:

  1. udemy course url: https://www.udemy.com/course/the-web-developer-bootcamp

  2. Comand Used: ( Getting these errors on every command for this course )

python3 udemy-dl.py https://www.udemy.com/course/the-web-developer-bootcamp -k cookie.txt --info python3 udemy-dl.py https://www.udemy.com/course/the-web-developer-bootcamp/ -k cookie.txt -q 720 -o "/home/xd003/udemy"

[xd003@xd003 udemy-dl]$ python3 udemy-dl.py https://www.udemy.com/course/the-web-developer-bootcamp -k cookie.txt --info

              __                               ____  
   __  ______/ /__  ____ ___  __  __      ____/ / /  
  / / / / __  / _ \/ __ `__ \/ / / /_____/ __  / /   
 / /_/ / /_/ /  __/ / / / / / /_/ /_____/ /_/ / /    
 \__,_/\__,_/\___/_/ /_/ /_/\__, /      \__,_/_/     
                           /____/
                                 Version : 0.5
                                 Author  : Nasir Khan (r0ot h3x49)
                                 Github  : https://github.com/r0oth3x49

[*] : Trying to login using cookies ...
[+] : Logged in successfully.
Traceback (most recent call last):on .. 
  File "udemy-dl.py", line 1453, in <module>
    main()
  File "udemy-dl.py", line 968, in main
    udemy.course_list_down(chapter_number=options.chapter, lecture_number=options.lecture, unsafe=options.unsafe)
  File "udemy-dl.py", line 143, in course_list_down
    course = udemy.course(url=self.url, username=self.username, password=self.password, cookies=self.cookies)
  File "/home/xd003/udemy-dl/udemy/_udemy.py", line 38, in course
    return Udemy(url, username, password, cookies, basic, callback)
  File "/home/xd003/udemy-dl/udemy/_internal.py", line 44, in __init__
    super(InternUdemyCourse, self).__init__(*args, **kwargs)
  File "/home/xd003/udemy-dl/udemy/_shared.py", line 258, in __init__
    self._fetch_course()
  File "/home/xd003/udemy-dl/udemy/_internal.py", line 56, in _fetch_course
    self._info              =       self._real_extract(self._url)
  File "/home/xd003/udemy-dl/udemy/_extract.py", line 469, in _real_extract
    course_json = self._extract_course_json(url, course_id, portal_name)
  File "/home/xd003/udemy-dl/udemy/_extract.py", line 270, in _extract_course_json
    resp = self._extract_large_course_content(url=url)
  File "/home/xd003/udemy-dl/udemy/_extract.py", line 234, in _extract_large_course_content
    data = self._session._get(url).json()
  File "/usr/lib/python3.8/site-packages/requests/models.py", line 898, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.8/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)

Screenshots If applicable, add screenshots to help explain your problem. g

Python Environment (please complete the following information):

Update - i tried this same command on another course i have in my account and didnt got error on it . I dont know if that matters but this course on which i have got this error is kinda big in size - it has 41 chapters/sections and 405 lectures

kumarnipun commented 3 years ago

Can u please share me ur credentials so can try to download.

On Sat, 18 Jul 2020 at 9:37 PM, xd003 notifications@github.com wrote:

Update - i tried this same command on another course i have in my account and didnt got error on it . I dont know if that matters but this course on which i have got this error is kinda big in size - it has 41 chapters/sections and 405 lectures

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/r0oth3x49/udemy-dl/issues/529#issuecomment-660503753, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF33XP2WUTKZSL5UWJSNRXDR4HCERANCNFSM4PAB7EVA .

r0oth3x49 commented 3 years ago

Can u please share me ur credentials so can try to download. On Sat, 18 Jul 2020 at 9:37 PM, xd003 @.***> wrote: Update - i tried this same command on another course i have in my account and didnt got error on it . I dont know if that matters but this course on which i have got this error is kinda big in size - it has 41 chapters/sections and 405 lectures — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#529 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF33XP2WUTKZSL5UWJSNRXDR4HCERANCNFSM4PAB7EVA .

are you for real asking credentials from others on this repository?

@xd003 if you share your creds with strangers instead of real owner of the repository then i 'm not responsible for any miss use.

xd003 commented 3 years ago

@r0oth3x49 yes i understand ,no point in sharing with anyone else as eventually you only is gonna fix it , i have emailed you creds for this issue as well as the int() argument .. error .. also mentioned course link for both separately

xd003 commented 3 years ago

These might help - https://stackoverflow.com/questions/16573332/jsondecodeerror-expecting-value-line-1-column-1-char-0

https://stackoverflow.com/questions/34579327/jsondecodeerror-expecting-value-line-1-column-1/34579607

r0oth3x49 commented 3 years ago

These might help - https://stackoverflow.com/questions/16573332/jsondecodeerror-expecting-value-line-1-column-1-char-0 https://stackoverflow.com/questions/34579327/jsondecodeerror-expecting-value-line-1-column-1/34579607

thanks bro

xDevagya commented 3 years ago

im getting the same issue as well

xd003 commented 3 years ago

@notdevagya which is the course you are facing it on ? Asking because it seems this issue doesn't seem to happen on all courses

xDevagya commented 3 years ago

@notdevagya which is the course you are facing it on ? Asking because it seems this issue doesn't seem to happen on all courses

https://www.udemy.com/course/the-web-developer-bootcamp

i haven't tested it on others but i will check back and report

xd003 commented 3 years ago

@r0oth3x49 any update ?

consuman commented 3 years ago

I have the same issue, but I can confirm, its not a problem on all courses. For me it was one out of three. Would appreciate any update on this too.

Thank you for this awsome software! :+1:

Krytical13 commented 3 years ago

Same issue for the same course.

I'm only just starting to learn to read code... So this is likely just me rambling and not helping at all, but just in case...

From what I can gather, this seems to work something like this:

  1. Login
  2. Get course info and convert data to json for usage with other arguments
  3. Download data using json per configuration/directives

I think from the previous posts the problem is that some courses have a type of note page. I'm assuming that note page unable to be converted to json in the same way or produces invalid results for this tool, giving us the error.

I'm not sure what would be easier... Fixing the code to handle these pages and somehow output the content to a txt or something? or Avoid gathering the entire course data at the start and only download as needed per user instruction, Then users can skip problematic pages on their own if necessary.

maybe something else entirely...

Either way, I really appreciate what you've made here!

r0oth3x49 commented 3 years ago

@r0oth3x49 any update ?

i will work on this weekend.

Yitao-jin commented 3 years ago

Describe the bug I tried to get info of all lectures and also tried downloading the lectures but getting the same error always. The login through cookies is successful but its unable to fetch any info from udemy

To Reproduce Steps to reproduce the behavior:

1. **udemy course url**: https://www.udemy.com/course/the-web-developer-bootcamp

2. **Comand Used**:  ( Getting these errors on every command for this course )

python3 udemy-dl.py https://www.udemy.com/course/the-web-developer-bootcamp -k cookie.txt --info python3 udemy-dl.py https://www.udemy.com/course/the-web-developer-bootcamp/ -k cookie.txt -q 720 -o "/home/xd003/udemy"

[xd003@xd003 udemy-dl]$ python3 udemy-dl.py https://www.udemy.com/course/the-web-developer-bootcamp -k cookie.txt --info

              __                               ____  
   __  ______/ /__  ____ ___  __  __      ____/ / /  
  / / / / __  / _ \/ __ `__ \/ / / /_____/ __  / /   
 / /_/ / /_/ /  __/ / / / / / /_/ /_____/ /_/ / /    
 \__,_/\__,_/\___/_/ /_/ /_/\__, /      \__,_/_/     
                           /____/
                                 Version : 0.5
                                 Author  : Nasir Khan (r0ot h3x49)
                                 Github  : https://github.com/r0oth3x49

[*] : Trying to login using cookies ...
[+] : Logged in successfully.
Traceback (most recent call last):on .. 
  File "udemy-dl.py", line 1453, in <module>
    main()
  File "udemy-dl.py", line 968, in main
    udemy.course_list_down(chapter_number=options.chapter, lecture_number=options.lecture, unsafe=options.unsafe)
  File "udemy-dl.py", line 143, in course_list_down
    course = udemy.course(url=self.url, username=self.username, password=self.password, cookies=self.cookies)
  File "/home/xd003/udemy-dl/udemy/_udemy.py", line 38, in course
    return Udemy(url, username, password, cookies, basic, callback)
  File "/home/xd003/udemy-dl/udemy/_internal.py", line 44, in __init__
    super(InternUdemyCourse, self).__init__(*args, **kwargs)
  File "/home/xd003/udemy-dl/udemy/_shared.py", line 258, in __init__
    self._fetch_course()
  File "/home/xd003/udemy-dl/udemy/_internal.py", line 56, in _fetch_course
    self._info              =       self._real_extract(self._url)
  File "/home/xd003/udemy-dl/udemy/_extract.py", line 469, in _real_extract
    course_json = self._extract_course_json(url, course_id, portal_name)
  File "/home/xd003/udemy-dl/udemy/_extract.py", line 270, in _extract_course_json
    resp = self._extract_large_course_content(url=url)
  File "/home/xd003/udemy-dl/udemy/_extract.py", line 234, in _extract_large_course_content
    data = self._session._get(url).json()
  File "/usr/lib/python3.8/site-packages/requests/models.py", line 898, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.8/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)

Screenshots If applicable, add screenshots to help explain your problem. g

Python Environment (please complete the following information):

* OS Platform: Manjaro Linux x86_64

* Python Version: 3.8.3

Update - i tried this same command on another course i have in my account and didnt got error on it . I dont know if that matters but this course on which i have got this error is kinda big in size - it has 41 chapters/sections and 405 lectures

Hi bro, do you successfully download it cause when I entered the same url, the bug still exists, quite confused me.

xd003 commented 3 years ago

Describe the bug I tried to get info of all lectures and also tried downloading the lectures but getting the same error always. The login through cookies is successful but its unable to fetch any info from udemy To Reproduce Steps to reproduce the behavior:

1. **udemy course url**: https://www.udemy.com/course/the-web-developer-bootcamp

2. **Comand Used**:  ( Getting these errors on every command for this course )

python3 udemy-dl.py https://www.udemy.com/course/the-web-developer-bootcamp -k cookie.txt --info python3 udemy-dl.py https://www.udemy.com/course/the-web-developer-bootcamp/ -k cookie.txt -q 720 -o "/home/xd003/udemy"

[xd003@xd003 udemy-dl]$ python3 udemy-dl.py https://www.udemy.com/course/the-web-developer-bootcamp -k cookie.txt --info

              __                               ____  
   __  ______/ /__  ____ ___  __  __      ____/ / /  
  / / / / __  / _ \/ __ `__ \/ / / /_____/ __  / /   
 / /_/ / /_/ /  __/ / / / / / /_/ /_____/ /_/ / /    
 \__,_/\__,_/\___/_/ /_/ /_/\__, /      \__,_/_/     
                           /____/
                                 Version : 0.5
                                 Author  : Nasir Khan (r0ot h3x49)
                                 Github  : https://github.com/r0oth3x49

[*] : Trying to login using cookies ...
[+] : Logged in successfully.
Traceback (most recent call last):on .. 
  File "udemy-dl.py", line 1453, in <module>
    main()
  File "udemy-dl.py", line 968, in main
    udemy.course_list_down(chapter_number=options.chapter, lecture_number=options.lecture, unsafe=options.unsafe)
  File "udemy-dl.py", line 143, in course_list_down
    course = udemy.course(url=self.url, username=self.username, password=self.password, cookies=self.cookies)
  File "/home/xd003/udemy-dl/udemy/_udemy.py", line 38, in course
    return Udemy(url, username, password, cookies, basic, callback)
  File "/home/xd003/udemy-dl/udemy/_internal.py", line 44, in __init__
    super(InternUdemyCourse, self).__init__(*args, **kwargs)
  File "/home/xd003/udemy-dl/udemy/_shared.py", line 258, in __init__
    self._fetch_course()
  File "/home/xd003/udemy-dl/udemy/_internal.py", line 56, in _fetch_course
    self._info              =       self._real_extract(self._url)
  File "/home/xd003/udemy-dl/udemy/_extract.py", line 469, in _real_extract
    course_json = self._extract_course_json(url, course_id, portal_name)
  File "/home/xd003/udemy-dl/udemy/_extract.py", line 270, in _extract_course_json
    resp = self._extract_large_course_content(url=url)
  File "/home/xd003/udemy-dl/udemy/_extract.py", line 234, in _extract_large_course_content
    data = self._session._get(url).json()
  File "/usr/lib/python3.8/site-packages/requests/models.py", line 898, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.8/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)

Screenshots If applicable, add screenshots to help explain your problem. g Python Environment (please complete the following information):

* OS Platform: Manjaro Linux x86_64

* Python Version: 3.8.3

Update - i tried this same command on another course i have in my account and didnt got error on it . I dont know if that matters but this course on which i have got this error is kinda big in size - it has 41 chapters/sections and 405 lectures

Hi bro, do you successfully download it cause when I entered the same url, the bug still exists, quite confused me.

Yes it did work for me after it had got fixed , i haven't tried it recently but there's no reason for it to not work now that it has been addressed already

sl1nkZz commented 3 years ago

@r0oth3x49 getting the same error when i try to download courses

sl1nkZz commented 3 years ago

@r0oth3x49 nvm i haven't downloaded the actuall source, it's working now