kallqvist / skillshare-downloader

MIT License
313 stars 105 forks source link

Failed to read video ID from data #55

Open VikasRana opened 3 years ago

VikasRana commented 3 years ago

Downloading C:\Users...\data\theawwwesomes\boost-personal-branding-by-coding-your-own-website-html-css-basics/01 - intro.mp4... [==================================================]

Traceback (most recent call last): File "C:\Users...\Downloads\skillshare-downloader-master\skillshare-downloader-master\code\example.py", line 10, in dl.download_course_by_url('https://www.skillshare.com/classes/Boost-Personal-Branding-by-Coding-Your-Own-Website-HTML-CSS-Basics/1551945410') File "C:\Users...\Downloads\skillshare-downloader-master\skillshare-downloader-master\code\downloader.py", line 36, in download_course_by_url self.download_course_by_class_id(m.group(1)) File "C:\Users...\Downloads\skillshare-downloader-master\skillshare-downloader-master\code\downloader.py", line 83, in download_course_by_class_id raise Exception('Failed to read video ID from data') Exception: Failed to read video ID from data

Sam-Online commented 3 years ago

I found that replacing if 'video_hashed_id' in s and s['video_hashed_id']: video_id = s['video_hashed_id'].split(':')[1]

with

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]

in download.py did the trick which is a simple fix, if the video_hashed_id is empty, use the id from the thumbnail :P

leuldereje commented 3 years ago

I found that replacing if 'video_hashed_id' in s and s['video_hashed_id']: video_id = s['video_hashed_id'].split(':')[1]

with

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]

in download.py did the trick which is a simple fix, if the video_hashed_id is empty, use the id from the thumbnail :P

thank you. this worked perfectly.

Please make a pull request so that the dev (hopefully) merge it.

ravinot commented 3 years ago

I found that the code change above definitely helped, but about halfway through downloading videos it errors with the following message:

Traceback (most recent call last): File "example.py", line 10, in dl.download_course_by_url('https://www.skillshare.com/classes/Brand-Strategy-Build-a-Business-that-Lasts/2083092514') File "/Users/ravisundram/Sites/skillshare-downloader-python/code/downloader.py", line 36, in download_course_by_url self.download_course_by_class_id(m.group(1)) File "/Users/ravisundram/Sites/skillshare-downloader-python/code/downloader.py", line 100, in download_course_by_class_id self.download_video( File "/Users/ravisundram/Sites/skillshare-downloader-python/code/downloader.py", line 143, in download_video raise Exception('Failed to fetch video meta') Exception: Failed to fetch video meta

Any ideas?

leuldereje commented 3 years ago

@ravinot try updating your cookies, that also worked for me

secretmove commented 3 years ago

I found that replacing if 'video_hashed_id' in s and s['video_hashed_id']: video_id = s['video_hashed_id'].split(':')[1]

with

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]

in download.py did the trick which is a simple fix, if the video_hashed_id is empty, use the id from the thumbnail :P

I tried this but I'm getting an "IndentationError: expected an indented block". I'm a python noob lol so I'm not sure what's wrong.

Edit: Tried re-pasting it.

raise Exception('Failed to fetch video meta') Exception: Failed to fetch video meta

Now I'm getting that error.

Edit2: I was able to make it work by renewing the cookie but it seems I have to this often since the cookie doesn't last like it used to.

mage1k99 commented 3 years ago

@ravinot try updating your cookies, that also worked for me

That worked for me! Thanks

mage1k99 commented 3 years ago

Answer by @Sam-Online Formatted I found that replacing

if 'video_hashed_id' in s and s['video_hashed_id']:
    video_id = s['video_hashed_id'].split(':')[1]

with

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]

in download.py did the trick which is a simple fix, if the video_hashed_id is empty, use the id from the thumbnail 😜

I have formatted the answer by @Sam-Online

ravinot commented 3 years ago

@ravinot try updating your cookies, that also worked for me

Thanks @leuldereje, clearing my cache and re-generating the cookie worked. However, as @secretmove mentioned in his comment, it looks like I have to generate a new cookie after each completed download for the next download to work.

ogeeDeveloper commented 3 years ago

I fetched another cookie and the problem was solved for me

THEASH22 commented 2 years ago

I found that replacing if 'video_hashed_id' in s and s['video_hashed_id']: video_id = s['video_hashed_id'].split(':')[1]

with

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]

in download.py did the trick which is a simple fix, if the video_hashed_id is empty, use the id from the thumbnail :P

I'm new to this, how do I replace the code?

mayabeggin commented 2 years ago

I found that replacing if 'video_hashed_id' in s and s['video_hashed_id']: video_id = s['video_hashed_id'].split(':')[1]

with

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]

in download.py did the trick which is a simple fix, if the video_hashed_id is empty, use the id from the thumbnail :P

Hey bro can u help me pls.i get same error.failed to read video id from data.idk coding even a little bit.fix it for me or make detailed tutorial pls.Would appreciate that.

mayabeggin commented 2 years ago

did u found something helpfull ?

nil55 commented 2 years ago

Traceback (most recent call last): File "/root/.Skillshare-DL/dl.py", line 16, in main() File "/root/.Skillshare-DL/dl.py", line 11, in main dl.download_course_by_url(course_url) File "/root/.Skillshare-DL/skillshare.py", line 32, in download_course_by_url self.download_course_by_class_id(m.group(1)) File "/root/.Skillshare-DL/skillshare.py", line 72, in download_course_by_class_id raise Exception('Failed to read video ID from data') Exception: Failed to read video ID from data anyone can help i want to download https://www.skillshare.com/classes/Contours-Drawing-with-Compelling-Contours-Foreshortening/1618762074 previously it was working but now its showing above error tried with other drive also but nothing happens