Anon-Exploiter / ine-dl

Python script to download INE courses including labs, exercises, quizzes, slides, and, videos!
MIT License
17 stars 8 forks source link

First run ine.py -lct resulted in error #17

Closed LOLCATATONIA closed 4 months ago

LOLCATATONIA commented 7 months ago

ine.py -lct


| SUCCESS   | Logged in!

| INFO      | Fetching course contents, this might take some time!
| SUCCESS   | Got the course contents, placing them in all_courses_metadata.json
| INFO      | Total number of courses: 990

| INFO      | Fetching the user paid subscriptions and access levels
| ERROR     | An error has been caught in function '<module>', process 'MainProcess' (127624), thread 'MainThread' (137567617902400):
Traceback (most recent call last):

File "/ine-dl/ine.py", line 1074, in <module>
main()
└ <function main at 0x7d1df2fb1f80>

File "/ine-dl/ine.py", line 1026, in main
user_subscriptions = fetch_user_subscriptions(all_course_contents, courses_with_access, all_courses_metadata)
│                        │                    │                    └ 'all_courses_metadata.json'
│                        │                    └ 'all_courses_with_access.json'
│                        └ [{'id': 'bfba41be-429a-11e4-a79f-22000b3582a3', 'tags': ['CCNA', 'Cisco', 'Security'], 'images': {'main_image_url': 'https://...
└ <function fetch_user_subscriptions at 0x7d1df2fb1800>

File "/ine-dl/ine.py", line 306, in fetch_user_subscriptions
subscriptions = json.loads(user_subs.text).get("data")[0].get("passes").get("data")
│    │     │         └ <property object at 0x7d1df3443240>
│    │     └ <Response [200]>
│    └ <function loads at 0x7d1df3783f60>
└ <module 'json' from '/usr/lib/python3.11/json/__init__.py'>

IndexError: list index out of range

Tried to make script work on Garuda Linux. Will try Ubuntu later.

Anon-Exploiter commented 4 months ago

Could you share the output of locally created files all_courses_metadata.json and all_courses_with_access.json?

gromula commented 4 months ago

Hi Anon,

We encountered an issue while trying to use your CLI, and it seems we faced the same problem. Upon debugging for a few minutes, we pinpointed the issue to this line:

l:307: subscriptions = json.loads(user_subs.text).get("data")[0].get("passes").get("data")

It appears that there is no data available to retrieve as the first element from the array.

Endpoint: https://subscriptions.ine.com/subscriptions/subscriptions

Response: {"data":[],"meta":{"cursor":{"current":1,"prev":null,"next":null,"count":0}}}

Let me know if you need further information or assistance.

Best regards,

Anon-Exploiter commented 4 months ago

Are you able to view the courses just fine in the web application? What subscription do you have?

gromula commented 4 months ago

Yep I'm able, sub: B2B Enterprise + Lab experience

Anon-Exploiter commented 4 months ago

I reckon it's the enterprise subscription. I can't really help without a valid account. Happy to look into it if you can share your account.

breakingartixz commented 4 months ago

I reckon it's the enterprise subscription. I can't really help without a valid account. Happy to look into it if you can share your account.

Hi Anon, Can you contact me on Discord? We can take a look on that.

Anon-Exploiter commented 4 months ago

https://github.com/Anon-Exploiter/ine-dl/commit/93f19a9f659f6d50b8ab1655d02806c244e25f71 closes this,

Thanks @breakingartixz for the creds.

@gromula, @LOLCATATONIA - Do a git pull and let me know if you face any other issues.

I've commented out subscriptions function the user has access to. Now, it'll just download all the courses, if a course isn't accessible. It'll just respond with you do not have access to this course.

gromula commented 4 months ago

Thanks, it's working right now!