YouTube Sentiment Analysis API. On each item you fetch.
The overall feeling the author expresses: positive, negative, neutral, or mixed (clearly both). Add analysis=sentiment to any of 13 YouTube endpoints that offer it.
GET /v1/youtube/post?analysis=sentiment
One param on the request. Sentiment on each item.
The YouTube Video API returns each post with analysis.sentiment beside its fields.
curl -G 'https://socialtap.dev/v1/youtube/post' \
--data-urlencode 'url=https://youtube.com/shorts/3cWm9B_0_kI?feature=share' \
--data-urlencode 'analysis=sentiment' \
-H "x-api-key: $SOCIALTAP_API_KEY"// Node 18+: save this as app.mjs (an ES module) and run: node app.mjs
const params = new URLSearchParams({
url: "https://youtube.com/shorts/3cWm9B_0_kI?feature=share",
analysis: "sentiment",
});
const res = await fetch(`https://socialtap.dev/v1/youtube/post?${params}`, {
headers: { "x-api-key": process.env.SOCIALTAP_API_KEY ?? "" },
});
const body = await res.json();
if (!res.ok) throw new Error(`${body.error.code}: ${body.error.message}`);
const { data, meta } = body;
console.log(data, meta.credits_charged);import os
import requests
res = requests.get(
"https://socialtap.dev/v1/youtube/post",
params={"url": "https://youtube.com/shorts/3cWm9B_0_kI?feature=share", "analysis": "sentiment"},
headers={"x-api-key": os.environ["SOCIALTAP_API_KEY"]},
)
body = res.json()
if not res.ok:
raise RuntimeError(f"{body['error']['code']}: {body['error']['message']}")
data, meta = body["data"], body["meta"]
print(data, meta["credits_charged"]){
"sentiment": "positive",
"sentiment_probability": 0.85
}Values are examples.
GET https://socialtap.dev/v1/youtube/postDocs What the value means.
One of the values below. sentiment_probability beside it: how sure the value is, from 0 to 1.
| Value | Meaning |
|---|---|
positive | favorable, pleased, enthusiastic |
negative | unfavorable, displeased, critical, complaining |
neutral | factual, a plain question, or no feeling either way |
mixed | clearly positive about some things and clearly negative about others |
Keep only what matches.
On a list, where keeps the items that pass. Every item judged is charged whether or not it passes, so a page can be short.
https://socialtap.dev/v1/youtube/posts?handle=@jawed&analysis=sentiment&where=analysis.sentiment=positive,analysis.sentiment_probability>=0.713 YouTube endpoints offer it.
Each adds the analysis to the posts, comments and transcripts it returns. Text analyses cost one flat amount per request, or per page on a list, however many you ask for.
-
Post
YouTube Video API
Video, short or community post with exact counts
1 credit$0.75–$1.97 per 1,000 requestsGET /v1/youtube/post -
Post
YouTube Channel Videos API
Videos, shorts and live streams of a channel
From 1 credit / page$0.75–$1.97 per 1,000 pagesGET /v1/youtube/posts -
Post
YouTube Community Posts API
Community posts of a channel: text, images, polls
1 credit / page$0.75–$1.97 per 1,000 pagesGET /v1/youtube/channel_posts -
Post
YouTube Hashtag Videos API
Videos and shorts under a hashtag with exact views
1 credit / page$0.75–$1.97 per 1,000 pagesGET /v1/youtube/hashtag_posts -
Post
YouTube Playlist Videos API
Videos of any playlist with channel and views
1 credit / page$0.75–$1.97 per 1,000 pagesGET /v1/youtube/playlist_posts -
Post
YouTube Related Videos API
Videos YouTube recommends next, with views
From 1 credit / page$0.75–$1.97 per 1,000 pagesGET /v1/youtube/post_related_posts -
Post
YouTube Search API
Videos, shorts and live streams by keyword
1 credit / page$0.75–$1.97 per 1,000 pagesGET /v1/youtube/search_posts -
Post
YouTube Sound Shorts API
Shorts that use a sound, with views and channels
1 credit / page$0.75–$1.97 per 1,000 pagesGET /v1/youtube/sound_posts -
Post
YouTube Trending Videos API
Trending and top music videos by country
1 credit / page$0.75–$1.97 per 1,000 pagesGET /v1/youtube/top_posts -
Post
YouTube Trending Shorts API
The Shorts feed a new visitor sees, by country
1 credit / page$0.75–$1.97 per 1,000 pagesGET /v1/youtube/trending_posts -
Comment
YouTube Comments API
Newest or top first, with likes and reply counts
1 credit / page$0.75–$1.97 per 1,000 pagesGET /v1/youtube/comments -
Comment
YouTube Comment Replies API
Replies under a comment, with likes and authors
1 credit / page$0.75–$1.97 per 1,000 pagesGET /v1/youtube/replies -
Transcript
YouTube Transcript API
Timed transcript from captions or audio
From 1 credit$0.75–$1.97 per 1,000 requestsGET /v1/youtube/transcript
| Endpoint | Adds |
|---|---|
| YouTube Video API | +2 credits per request |
| YouTube Channel Videos API | +84 credits per page of 48 |
| YouTube Community Posts API | +18 credits per page of 10 |
| YouTube Hashtag Videos API | +63 credits per page of 36 |
| YouTube Playlist Videos API | +174 credits per page of 100 |
| YouTube Related Videos API | +87 credits per page of 50 |
| YouTube Search API | +53 credits per page of 30 |
| YouTube Sound Shorts API | +42 credits per page of 24 |
| YouTube Trending Videos API | +174 credits per page of 100 |
| YouTube Trending Shorts API | +21 credits per page of 12 |
| YouTube Comments API | +32 credits per page of 20 |
| YouTube Comment Replies API | +160 credits per page of 100 |
| YouTube Transcript API | +6 credits per request |
More analyses on YouTube and beyond.
The same answer on other platforms, and other answers here.
Questions about YouTube sentiment analysis
The analyses guide has the rest.
Which YouTube endpoints offer sentiment analysis?
How much does an analysis cost?
Do I pay when an analysis can't answer?
Can I get only the items that match?
Which languages do analyses answer in?
Can I use my own categories or questions?
Send your first request in a minute.
Get a key, send a link you already have and see what comes back. The same key works on every platform.
- No credit card
- Failed requests are free
- Works on all 319 endpoints