philbot9 / youtube-info

Fetch meta information about YouTube videos
ISC License
43 stars 20 forks source link

Include "Like" and "Dislike" counts #2

Closed SaferIT closed 6 years ago

SaferIT commented 6 years ago

1) commentCount doesn't work 2) Is there a way to fetches like and dislike information?

philbot9 commented 6 years ago

1. commentCount doesn't work Could you be a bit more specific? As far as I can tell the commentCount is being fetched.

2. Is there a way to fetches like and dislike information? Probably yes. I don't have time to work on this right now but pull requests are always welcome.

SaferIT commented 6 years ago

for any video I get zero "commentoCount: 0" I don't know if this method is nowadays available https://www.youtube.com/watch_fragments_ajax

philbot9 commented 6 years ago

The watch_fragments_ajax endpoint is available with a POST request. I believe the problem is that the content is in a different language for you (not English), and thus the relevant comment count can't be found. YouTube localizes requests based on your IP.

Adding an accept-language header in the request should solve this problem: https://github.com/philbot9/youtube-info/commit/fed7485dc3acbfae011d138a7b9aa931eb5a6426. I've included that commit in version 1.1.3 and published it to npm.

Can you try again with version 1.1.3?

SaferIT commented 6 years ago

Solved. Good job. Now it works well for my location too. I hope that someone in the future can add the fetch of like and dislike information

philbot9 commented 6 years ago

Great! Thanks for confirming.

What's required is adding two new fields to the result: likeCount and dislikeCount.