YouTube Jquery Scripts for getting video data

DataMine
by DataMine · 2 posts
8 years ago in Javascript
Posted 7 years ago · Author
About
These are some bits of jquery code I wrote in order to amass data for new content system here: viewtopic.php?t=10794

They get the video title and ids of YouTube videos to be processed in one of my programs and turned into multi dimensional arrays for php.

For information on running jquery on YouTube: http://stackoverflow.com/questions/7474 ... pt-console

To use these codes, simply open up your browsers console and paste these codes into the code editor.


This code will build a list of video ids and title from the search results page
[code=jquery file=Untitled.txt]//This scripts grabs the video title and video id for each video on a search results page
jQuery('.item-section > li').each(function() {
//Get the video title
var title = jQuery(this).find('.yt-lockup-title ').text();

//Clean the video title by removing unnecessary data at the end and condensing it down to single spacing
title = title.substring(0,title.lastIndexOf('-')).replace(/\s\s+/g, " ");

//Get the video id by getting the video url and removing pathing
var id = jQuery(this).find('.yt-lockup-title a').attr('href').replace("/watch?v=","");

//Output the resulting title into the sonsole for copying
console.log(title + "," + id);
});[/code]

This code will build a list of video ids and title from the playlist box on a video page
[code=jquery file=Untitled.txt]//This scripts grabs the video title and video id for each video in a playlist box
jQuery('#playlist-autoscroll-list > li').each(function() {
var id = jQuery(this).find('.yt-thumb-clip img').attr('src').replace("//i.ytimg.com/vi/","").replace("/default.jpg","");

//Grab the video title and replace all line breaks with spaces and condense multi spacing into single spacing
var title = jQuery(this).find('.playlist-video-description > h4').text().replace(/\n/g," ").replace(/\s\s+/g, " ").replace(" ,",",");

//Output the resulting title into the sonsole for copying
console.log(title + "," + id);
});[/code]
Posted 7 years ago
:dancingbannana: hell yeah !

Create an account or sign in to comment

You need to be a member in order to leave a comment

Sign in

Already have an account? Sign in here

SIGN IN NOW

Create an account

Sign up for a new account in our community. It's easy!

REGISTER A NEW ACCOUNT
Select a forum Protection     Help & Support     Introductions     Mafia News     IMVU News General Discussion     IMVU Lounge        IMVU Series / Roleplaying        Social Games     Mafia Market     Mafia Tools        Premium IMVU Tools        Off Topic Tools     Off Topic     Contests Creator Corner     Graphics Design        Photoshop        GIMP     Basic Creator Help     Catalog And Product Showcase     3D Meshing        3Ds Max        Sketchup        Blender Gangsters with Connections     White Hat Activities        Google Hacking        Trackers Programming Corner     Coding        Python        .Net (C#, VB, etc)        Flash        JAVA        Autoit        Batch        HTML & CSS        Javascript        PHP        Other        IMVU Homepage Codes           General           About me Panel           Messages Panel           Special Someone Panel           Visitors Panel           New Products Panel           Rankings Panel           Wishlist Panel           My Badges Panel           Outfits Panel           Url Panel           Groups Panel           Slideshow Panel           My Room Panel           Sandbox panel           Layouts     Help & Requests Free Credits     Approved Methods     Submit Methods Free Money     Approved Methods     Submit Methods Adult Corner     Get Mafia AP Here     AP Lounge        AP Social Games        Casual Dating Tips     IMVU Slave Market & Escorts