It only works for class id that is 9 digits long
Opened this issue · 2 comments
TheOnlyDGS commented
The newer Skillshare classes have 10 digits and it does not download. Works only for courses with class id that is 9 digits long.
Any workarounds? It fails at line 70 of the downloader.py file saying:
Typeerror list indices must be integers or slices not str.
EV0LV3 commented
It looks like line 70 is not working anymore. When you print the data from line 39. It looks like it's looking for a "unit" value.
But when you check the output. "unit" gives a "none" as a return.
You need to command out / delete line 70 and fix the tab/spacing for the other lines. Then the error is gone.
`for s in data['_embedded']['sessions']['_embedded']['sessions']:
video_id = None
if 'video_hashed_id' in s and s['video_hashed_id']:
video_id = s['video_hashed_id'].split(':')[1]
elif 'video_thumbnail_url' in s and s['video_thumbnail_url']:
video_id = s['video_thumbnail_url'].split('/')[6]
if not video_id:
raise Exception('Failed to read video ID from data')
s_title = s['title']
if self.is_unicode_string(s_title):
s_title = s_title.encode('ascii', 'replace') # ignore any weird char
file_name = '{} - {}'.format(str(s['index'] + 1).zfill(2),
slugify(s_title))
self.download_video(fpath='{base_path}/{session}.mp4'.format(base_path=base_path,
session=file_name), video_id=video_id)`
TheOnlyDGS commented
Thank you, it works :)