Skip to content

Conversation

bel0v
Copy link

@bel0v bel0v commented Sep 17, 2019

Hi! thanks for the lib. captionTracks method doesn't work for some videos, tho.
After some investigation I found there is an alternative solution. So I added code to fallback to that.

Tested on this video:
https://www.youtube.com/watch?v=62xdACKITrE

It seems that it has to do with modern html5 captions, or sth like that. Cheers!

@bel0v
Copy link
Author

bel0v commented Sep 18, 2019

Also used an xml parser lib instead of scraping xml by hand, pls check it out.

I'm not sure about striptags and decode that was used for text strings, I've never come across encoded symbols or tags in YT captions. Can you confirm those are needed pls?


// * ensure we have access to captions data
if (!decodedData.includes('captionTracks'))
throw new Error(`Could not find captions for video: ${videoID}`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this error need to continue existing if there's nothing alternative found?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well I check and throw from this alternative method, but it might be a good thing to check here as well to reduce coupling

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bel0v how to avoid throwing error at all?

@Haroenv
Copy link
Contributor

Haroenv commented Sep 18, 2019

Are you interested in maintaining this library? We are not currently using it in production, so it is easy to lose track of if it's working correctly

@bel0v
Copy link
Author

bel0v commented Sep 18, 2019

@Haroenv do you mind if i refactor the whole thing if I do? :)

@Haroenv
Copy link
Contributor

Haroenv commented Sep 18, 2019

That's fine, knowing that I'm not too sure i'll find time to properly review this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants