Noezxc1Script

Script Google For Showing Views in Title Video

Nov 9th, 2022
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. //Updates the title of a video to show either video or channel statistics
  2. function statsTitle() {
  3.  
  4. //Video info
  5. var videoID = 'UOv_Jje8zzM'; https://youtube.com/shorts/UOv_Jje8zzM
  6. var part = 'snippet,statistics';
  7. var params = {'id': videoID};
  8. var response = YouTube.Videos.list(part, params);
  9. var video = response.items[0];
  10.  
  11. //Channel info (optional if you dont want to display subs, total views, number of videos)
  12. var channelID = 'UCMpc5-odx0cRo16AvJ0XnmQ' ; https://www.youtube.com/channel/UCMpc5-odx0cRo16AvJ0XnmQ
  13. var part2 = 'snippet,contentDetails,statistics';
  14. var params2 = {'id': channelID};
  15. var response2 = YouTube.Channels.list(part2, params2);
  16. var channel = response2.items[0];
  17.  
  18. //Video title variables
  19. var videoViews = video.statistics.viewCount;
  20. var videoLikes = video.statistics.likeCount;
  21. var videoDislikes = video.statistics.dislikeCount;
  22. var videoComments = video.statistics.commentCount;
  23. var channelSubs = channel.statistics.subscriberCount;
  24. var channelVideos = channel.statistics.videoCount;
  25. var channelViews = channel.statistics.viewCount;
  26.  
  27. //Set Video Title incoportating "Video title variables"
  28. //Examples
  29. //var videoTitle = 'This channel has ' + channelSubs + ' subscribers, ' + channelVideos + ' videos and ' + channelViews + ' views!';
  30. //var videoTitle = 'This video has ' + videoViews + ' views, ' + videoLikes + ' likes, ' + videoDislikes + ' dislikes, and ' + videoComments + ' comments!';
  31. var videoTitle = 'This video has '+videoViews+' views.';
  32.  
  33. //Update youtube video
  34. video.snippet.title = videoTitle;
  35. try
  36. {
  37. YouTube.Videos.update(video, part);
  38. }
  39. catch(e){}
  40. }
Advertisement
Add Comment
Please, Sign In to add comment