## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ stringr 1.5.1
## ✔ forcats 1.0.0 ✔ tibble 3.2.1
## ✔ lubridate 1.9.3 ✔ tidyr 1.3.1
## ✔ readr 2.1.5
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
In today’s digital age, internet platforms such as YouTube have become significant tools for content creators and organisations to connect with their audiences. Analysing video performance on platforms such as YouTube can provide important insights about audience preferences, engagement levels, and sentiment.
Key guide for my analysis (objectives/goals) are as follow:
Fetch Video Metadata: The primary goal is to retrieve metadata from two YouTube videos via the YouTube Data API. This metadata contains information such as the video title, description, likes, comments, and release date.
Visualise Engagement Metrics: Use visualisation tools to depict engagement metrics like likes and comments on each video. Visualisations such as bar plots provide a clear picture of the distribution of engagement metrics across various videos.
Calculate Total Comments: Determine the total number of comments on each video. This measure gives information about the extent of audience involvement and engagement with video material.
Analyse Sentiment: Examine the sentiment in video descriptions and comments to get the overall sentiment connected with each video. This analysis is useful in determining the audience’s perception and emotional response to the video content.
Investigate Correlation: Investigate the relationship between likes and comments on videos. Understanding the relationship between these two engagement metrics might reveal useful information about audience behaviour and preferences.
By achieving these goals, I hope to acquire a thorough grasp of the performance, audience involvement, and sentiment related with the offered YouTube videos. These findings can help content creators, marketers, and organisations optimise their video content and tactics for increased audience engagement and impact.
get_video_metadata <- function(api_key, video_ids) {
# Construct the URL
url <- sprintf("https://www.googleapis.com/youtube/v3/videos?part=snippet,statistics&id=%s&key=%s", paste(video_ids, collapse = ","), api_key)
# Fetch the response
response <- httr::GET(url)
# Check for successful response
if (httr::http_type(response) != "application/json") {
stop("API request failed. Please check my API key and video ID.")
}
# Convert raw content to text
response_text <- rawToChar(response$content)
# Parse JSON content
video_data <- jsonlite::fromJSON(response_text)
return(video_data)
}
# Fetch video metadata
video_metadata <- get_video_metadata(api_key, video_ids)
# Print the metadata
print(video_metadata)
## $kind
## [1] "youtube#videoListResponse"
##
## $etag
## [1] "uerdbNoAKvw_ILd4TjmHEAiZEio"
##
## $items
## kind etag id snippet.publishedAt
## 1 youtube#video jVLGZLTZwZiIU-sR0LgmfImodd8 hw7GT6m6VfA 2023-07-04T16:30:11Z
## 2 youtube#video gsZpYjjd_uSa-5WvbSsVr-ykBMA T4CdmS7yisk 2019-11-28T01:30:11Z
## snippet.channelId
## 1 UCcVqCJ_9owb1zM43vqswMNQ
## 2 UCVS0VR92DgdxouzPPnXZATA
## snippet.title
## 1 BET Awards Full Show Recap Ft. Migos, Ice Spice, Davido, Lil Uzi Vert, Latto & More | BET Awards '23
## 2 Black Music Honors Full Show | 2018
## snippet.description
## 1 Tune-In to our 23' in 30 Highlight Show as we recap The BET Awards in 30 minutes! Description: Did you miss Culture’s Biggest Night? Tune-in to our 23' in 30 Highlight show to watch all the MUST SEE moments from the 2023 BET Awards! Presented by Popeyes. #CulturesBiggestNight #BETAwards #BETAwards23\n\n\nSUBSCRIBE to #BET! ►► http://bit.ly/1U0v9xG\n\nStream Black Culture with BET+. Kick back and enjoy movies, TV series, exclusive originals and the best of Tyler Perry. Sign up for BET+ ►► http://bit.ly/betplus \n\nConnect with BET \nWeb: http://www.BET.com\nFacebook: http://www.facebook.com/BET\nTwitter: http://www.twitter.com/BET\nInstagram: http://www.instagram.com/BET\nBET+: https://www.bet.plus \nhttps://www.instagram.com/betplus/\nhttps://twitter.com/betplus\nhttps://www.facebook.com/yourbetplus/\nGoogle+: http://www.bet.us/gplusBET
## 2 Tune into the 3rd Annual Black Music Honors honoring Faith Evans, Bobby Brown, Stephanie Mills, Bebe & Cece Winans, Woodini, and Dallas Austin! Set to premiere on November 27, 2019 at 7:30 PM CST\n\nStay Connected :\nIG - https://www.instagram.com/blackmusichonors\nFB - https://www.facebook.com/BlackMusicHonors\nhttp://BlackMusicHonors.com/\n\nBlack Music Honors is annual television show & concert that acknowledges legendary artists who have made a significant contribution to African American music.
## snippet.thumbnails.default.url
## 1 https://i.ytimg.com/vi/hw7GT6m6VfA/default.jpg
## 2 https://i.ytimg.com/vi/T4CdmS7yisk/default.jpg
## snippet.thumbnails.default.width snippet.thumbnails.default.height
## 1 120 90
## 2 120 90
## snippet.thumbnails.medium.url
## 1 https://i.ytimg.com/vi/hw7GT6m6VfA/mqdefault.jpg
## 2 https://i.ytimg.com/vi/T4CdmS7yisk/mqdefault.jpg
## snippet.thumbnails.medium.width snippet.thumbnails.medium.height
## 1 320 180
## 2 320 180
## snippet.thumbnails.high.url
## 1 https://i.ytimg.com/vi/hw7GT6m6VfA/hqdefault.jpg
## 2 https://i.ytimg.com/vi/T4CdmS7yisk/hqdefault.jpg
## snippet.thumbnails.high.width snippet.thumbnails.high.height
## 1 480 360
## 2 480 360
## snippet.thumbnails.standard.url
## 1 https://i.ytimg.com/vi/hw7GT6m6VfA/sddefault.jpg
## 2 https://i.ytimg.com/vi/T4CdmS7yisk/sddefault.jpg
## snippet.thumbnails.standard.width snippet.thumbnails.standard.height
## 1 640 480
## 2 640 480
## snippet.thumbnails.maxres.url
## 1 https://i.ytimg.com/vi/hw7GT6m6VfA/maxresdefault.jpg
## 2 https://i.ytimg.com/vi/T4CdmS7yisk/maxresdefault.jpg
## snippet.thumbnails.maxres.width snippet.thumbnails.maxres.height
## 1 1280 720
## 2 1280 720
## snippet.channelTitle
## 1 BETNetworks
## 2 Black Music Honors
## snippet.tags
## 1 BET, BET Networks, BET Music, Black Entertainment Television, 2023 bet awards, awards, awards show, bet, bet awards, bet awards '23, bet music, bet networks, black entertainment television, black music, black music month, celebrities, ytao_betawards_2023
## 2 Faith Evans, Bobby Brown, Stephanie Mills, Bebe & Cece Winans, Woodini, Dallas Austin, Black Music Honors, r&b, soul music, award show, full show, bbd, new edition, Doug E. Fresh, Bell Biv DeVoe, YoYo, Monie Love, Next, Raheem DeVaughn, Donnie McClurkin, Ruben Studdard, Regina Bell, Angela Winbush, Koryn Hawthorne, Jonathan McReynolds, Tasha Page, Kierra Sheard, Syleena Johnson, Demetria McKinney, Jade Novah, DJ Mell Star, V. Bozeman, Rhyon Brown, Sammie, Paris Bennett
## snippet.categoryId snippet.liveBroadcastContent snippet.defaultLanguage
## 1 24 none en
## 2 10 none en
## snippet.localized.title
## 1 BET Awards Full Show Recap Ft. Migos, Ice Spice, Davido, Lil Uzi Vert, Latto & More | BET Awards '23
## 2 Black Music Honors Full Show | 2018
## snippet.localized.description
## 1 Tune-In to our 23' in 30 Highlight Show as we recap The BET Awards in 30 minutes! Description: Did you miss Culture’s Biggest Night? Tune-in to our 23' in 30 Highlight show to watch all the MUST SEE moments from the 2023 BET Awards! Presented by Popeyes. #CulturesBiggestNight #BETAwards #BETAwards23\n\n\nSUBSCRIBE to #BET! ►► http://bit.ly/1U0v9xG\n\nStream Black Culture with BET+. Kick back and enjoy movies, TV series, exclusive originals and the best of Tyler Perry. Sign up for BET+ ►► http://bit.ly/betplus \n\nConnect with BET \nWeb: http://www.BET.com\nFacebook: http://www.facebook.com/BET\nTwitter: http://www.twitter.com/BET\nInstagram: http://www.instagram.com/BET\nBET+: https://www.bet.plus \nhttps://www.instagram.com/betplus/\nhttps://twitter.com/betplus\nhttps://www.facebook.com/yourbetplus/\nGoogle+: http://www.bet.us/gplusBET
## 2 Tune into the 3rd Annual Black Music Honors honoring Faith Evans, Bobby Brown, Stephanie Mills, Bebe & Cece Winans, Woodini, and Dallas Austin! Set to premiere on November 27, 2019 at 7:30 PM CST\n\nStay Connected :\nIG - https://www.instagram.com/blackmusichonors\nFB - https://www.facebook.com/BlackMusicHonors\nhttp://BlackMusicHonors.com/\n\nBlack Music Honors is annual television show & concert that acknowledges legendary artists who have made a significant contribution to African American music.
## snippet.defaultAudioLanguage statistics.viewCount statistics.likeCount
## 1 en 1423624 13972
## 2 <NA> 2480429 21847
## statistics.favoriteCount statistics.commentCount
## 1 0 481
## 2 0 1872
##
## $pageInfo
## $pageInfo$totalResults
## [1] 2
##
## $pageInfo$resultsPerPage
## [1] 2
## # A tibble: 2 × 2
## Video total_comments
## <fct> <dbl>
## 1 Black Music Honors '18 1872
## 2 BET Awards '23 481
## [1] "Description Sentiment:"
## # A tibble: 2 × 2
## Video sentiment_score_description
## <chr> <dbl>
## 1 BET Awards '23 8
## 2 Black Music Honors '18 4
## [1] "Comments Sentiment:"
## # A tibble: 2 × 2
## Video sentiment_score_comments
## <chr> <dbl>
## 1 BET Awards '23 6
## 2 Black Music Honors '18 9
Based on the results (as at (04/24):
The sentiment score for the video “BET Awards ’23” is 6.
The sentiment score for the video “Black Music Honours ’18” is 9. These scores reflect the overall sentiment indicated in the descriptions and comments for each video. A higher sentiment score implies a more positive sentiment, whilst a lower number indicates a less positive mood. As a result, it appears that the “Black Music Honours ’18” video is slightly more positive than the “BET Awards ’23” video.
## [1] 1