Closed aulianov closed 5 years ago
Hey, thanks for these. I'm holding this back for a little bit as I am working on a new major version. Once done, I'll post here so you can rebase your code.
@aulianov Sorry for the delay. The video parser is now in lib/video. I've changed the API:
const youtubeInfo = require('youtube-info')
youtubeInfo.video('abc123').then(...)
I have one concern regarding this PR. The lang
prop on <html>
will always correspond to what was requested in the "Accept-Language" header. So it will be set to the requested language even if the title and description are not available in that language. I think that's incorrect, because the user might think they have translated data when they do not.
I haven't yet found another way to determine whether the title and description are translated, other than going through the API. think we should remove the field language in the result until we can find a way to do this.
Thank you. I do not see problems with missing languages. If I send a request for Rb0UmrCXxVA {language: 'jp'}, then the answer comes to me with the default language parameter, not 'jp'. It works fine.
@aulianov That's true, but only because 'jp'
is not a valid locale. Japanese is 'ja'
.
If you try {language: 'de'}
for example you'll see <html lang="de">
, yet the title and description of the video are still in English.
Ahh, I see But for my case, it works great. I think it makes no sense to request a language that does not exist.
get title from h1 title container if exist and decodeEntities set to false