Created
December 22, 2020 14:26
-
-
Save ketan-lambat/b3eb203a22e5ba27dade47a480e9d129 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"nbformat": 4, | |
"nbformat_minor": 0, | |
"metadata": { | |
"colab": { | |
"name": "Youtube_Video_Ranker.ipynb", | |
"provenance": [], | |
"collapsed_sections": [] | |
}, | |
"kernelspec": { | |
"name": "python3", | |
"display_name": "Python 3" | |
} | |
}, | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "AL-iTwNQ4CT0" | |
}, | |
"source": [ | |
"from googleapiclient.discovery import build\r\n", | |
"from textblob import TextBlob\r\n", | |
"from tqdm import tqdm\r\n", | |
"import pandas as pd\r\n", | |
"import numpy as np\r\n", | |
"import sys\r\n", | |
"import re" | |
], | |
"execution_count": 1, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "zDE13P3j5cy7" | |
}, | |
"source": [ | |
"# cd \"/content/drive/MyDrive/Colab_Work/IR_Youtube_Comments\"" | |
], | |
"execution_count": 2, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "abZoJyg76C26" | |
}, | |
"source": [ | |
"## Setup Youtube API" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "AsAQP3ml5in-" | |
}, | |
"source": [ | |
"SCOPES = ['https://www.googleapis.com/auth/youtube']\r\n", | |
"API_SERVICE_NAME = 'youtube'\r\n", | |
"API_VERSION = 'v3'" | |
], | |
"execution_count": 3, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "H0bqrZnp5qT4" | |
}, | |
"source": [ | |
"API_KEY = 'api_key'" | |
], | |
"execution_count": 4, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "SWCHMpVd5wtf" | |
}, | |
"source": [ | |
"def build_service():\r\n", | |
" return build(API_SERVICE_NAME, API_VERSION, developerKey = API_KEY)" | |
], | |
"execution_count": 5, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "IBQDlCxP6KAb" | |
}, | |
"source": [ | |
"## Fetch YouTube Videos" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "0MUsrYCpcRq7" | |
}, | |
"source": [ | |
"Get youtube videos based on the query" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "TmUny0QN6cON" | |
}, | |
"source": [ | |
"def search_yt_videos(query, service):\r\n", | |
" request = service.search().list(\r\n", | |
" part=\"snippet\",\r\n", | |
" maxResults=25,\r\n", | |
" order=\"relevance\",\r\n", | |
" q=query,\r\n", | |
" relevanceLanguage=\"en\",\r\n", | |
" type=\"video\"\r\n", | |
" )\r\n", | |
" videos_list = request.execute()\r\n", | |
" return videos_list" | |
], | |
"execution_count": 6, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "D5u5scyjccys" | |
}, | |
"source": [ | |
"Get the stats of the youtube video (likes, dislikes, count of comments)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "lBV0HmIu8pwD" | |
}, | |
"source": [ | |
"def get_video_stats(video_id, service):\r\n", | |
" video_stats = service.videos().list(\r\n", | |
" part=\"snippet,statistics\",\r\n", | |
" id=video_id,\r\n", | |
" ).execute()\r\n", | |
" return video_stats" | |
], | |
"execution_count": 7, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "HR7xKKa0clwo" | |
}, | |
"source": [ | |
"Get the comments on the video using the videoID" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "23_Rk0E7-fDs" | |
}, | |
"source": [ | |
"def get_video_comments(videoID, service):\r\n", | |
" video_comments = service.commentThreads().list(\r\n", | |
" part = 'snippet',\r\n", | |
" videoId = videoID,\r\n", | |
" maxResults = 100, \r\n", | |
" order = 'relevance', \r\n", | |
" textFormat = 'plainText',\r\n", | |
" ).execute()\r\n", | |
" return video_comments" | |
], | |
"execution_count": 8, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "RHXlnE0Jc31U" | |
}, | |
"source": [ | |
"Create a datafram from the retreived videos list" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "2WRVIlpvJDst" | |
}, | |
"source": [ | |
"def get_videos_list_df(videos_list):\r\n", | |
" video_id = []\r\n", | |
" channel = []\r\n", | |
" video_title = []\r\n", | |
" for item in videos_list['items']:\r\n", | |
" video_id.append(item['id']['videoId'])\r\n", | |
" channel.append(item['snippet']['channelTitle'])\r\n", | |
" video_title.append(item['snippet']['title'])\r\n", | |
"\r\n", | |
" output_dict = {\r\n", | |
" 'Channel': channel,\r\n", | |
" 'Video Title': video_title,\r\n", | |
" 'Video ID': video_id,\r\n", | |
" }\r\n", | |
"\r\n", | |
" output_df = pd.DataFrame(output_dict, columns = output_dict.keys())\r\n", | |
" return output_df" | |
], | |
"execution_count": 9, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "IcmtyvlVc-XH" | |
}, | |
"source": [ | |
"Generate the dataset\r\n", | |
"Contains the video stats and all the comments on the video in a dataframe" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "3hS3O3x47zHQ" | |
}, | |
"source": [ | |
"def gen_dataset(videos_list, service):\r\n", | |
" video_id = []\r\n", | |
" channel = []\r\n", | |
" video_title = []\r\n", | |
" for item in videos_list['items']:\r\n", | |
" video_id.append(item['id']['videoId'])\r\n", | |
" channel.append(item['snippet']['channelTitle'])\r\n", | |
" video_title.append(item['snippet']['title'])\r\n", | |
"\r\n", | |
" video_id_pop = []\r\n", | |
" channel_pop = []\r\n", | |
" video_title_pop = []\r\n", | |
" video_views_pop = []\r\n", | |
" video_likes_pop = []\r\n", | |
" video_dislikes_pop = []\r\n", | |
" video_comments_cnt_pop = []\r\n", | |
" comments_pop = []\r\n", | |
" comment_id_pop = []\r\n", | |
"\r\n", | |
" for i, videoID in enumerate(tqdm(video_id, ncols = 100)):\r\n", | |
"\r\n", | |
" video_stats = get_video_stats(videoID, service)\r\n", | |
"\r\n", | |
" try:\r\n", | |
" video_views = (video_stats['items'][0]['statistics']['viewCount'])\r\n", | |
" except KeyError as l:\r\n", | |
" video_views = 0\r\n", | |
" try:\r\n", | |
" video_likes = (video_stats['items'][0]['statistics']['likeCount'])\r\n", | |
" except KeyError as l:\r\n", | |
" video_likes = 0\r\n", | |
" try:\r\n", | |
" video_dislikes = (video_stats['items'][0]['statistics']['dislikeCount'])\r\n", | |
" except KeyError as l:\r\n", | |
" video_dislikes = 0\r\n", | |
" try:\r\n", | |
" video_comments_cnt = (video_stats['items'][0]['statistics']['commentCount'])\r\n", | |
" except KeyError as l:\r\n", | |
" video_comments_cnt = 0\r\n", | |
"\r\n", | |
" if video_comments_cnt == 0:\r\n", | |
" continue\r\n", | |
"\r\n", | |
" try:\r\n", | |
" video_comments = get_video_comments(videoID, service)\r\n", | |
" except:\r\n", | |
" continue\r\n", | |
" comments_temp = []\r\n", | |
" comment_id_temp = []\r\n", | |
" \r\n", | |
" \r\n", | |
" for item in video_comments['items']:\r\n", | |
" comments_temp.append(item['snippet']['topLevelComment']['snippet']['textDisplay'])\r\n", | |
" comment_id_temp.append(item['snippet']['topLevelComment']['id'])\r\n", | |
"\r\n", | |
" comments_pop.extend(comments_temp)\r\n", | |
" comment_id_pop.extend(comment_id_temp)\r\n", | |
"\r\n", | |
" video_views_pop.extend([video_views]*len(comments_temp))\r\n", | |
" video_likes_pop.extend([video_likes]*len(comments_temp))\r\n", | |
" video_dislikes_pop.extend([video_dislikes]*len(comments_temp))\r\n", | |
" video_comments_cnt_pop.extend([video_comments_cnt]*len(comments_temp))\r\n", | |
"\r\n", | |
" video_id_pop.extend([video_id[i]]*len(comments_temp))\r\n", | |
" channel_pop.extend([channel[i]]*len(comments_temp))\r\n", | |
" video_title_pop.extend([video_title[i]]*len(comments_temp))\r\n", | |
" \r\n", | |
" query_pop = [query] * len(video_id_pop)\r\n", | |
"\r\n", | |
" output_dict = {\r\n", | |
" 'Query': query_pop,\r\n", | |
" 'Channel': channel_pop,\r\n", | |
" 'Video Title': video_title_pop,\r\n", | |
" 'Video ID': video_id_pop,\r\n", | |
" 'Video Views':video_views_pop,\r\n", | |
" 'Video Likes':video_likes_pop,\r\n", | |
" 'Video Dislikes': video_dislikes_pop,\r\n", | |
" 'Video Comments':video_comments_cnt_pop,\r\n", | |
" 'Comment': comments_pop,\r\n", | |
" 'Comment ID': comment_id_pop,\r\n", | |
" }\r\n", | |
"\r\n", | |
" output_df = pd.DataFrame(output_dict, columns = output_dict.keys())\r\n", | |
" return output_df" | |
], | |
"execution_count": 10, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "BhZc0h9MDgUb" | |
}, | |
"source": [ | |
"## Clean Dataset" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "qBdSldDSezbT" | |
}, | |
"source": [ | |
"Clean up the comments in the dataset" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "G7j6zoqLDfFo" | |
}, | |
"source": [ | |
"def clean_dataset(df):\r\n", | |
" # Remove emojis\r\n", | |
" df = df.apply(lambda x: x.str.encode('ascii', 'ignore').str.decode('ascii'))\r\n", | |
" regex = r\"[^0-9A-Za-z'\\t]\"\r\n", | |
" df['cleaned_comments'] = df['Comment'].apply(lambda x:re.sub(regex,\" \",x))\r\n", | |
"\r\n", | |
" df['cleaned_comments'] = df['cleaned_comments'].str.lower()\r\n", | |
"\r\n", | |
" dataset = df[['Query', 'Video Title', 'Video ID', 'Video Views', 'Video Likes', 'Video Dislikes', 'Video Comments', 'Comment ID','cleaned_comments']].copy()\r\n", | |
" dataset = dataset.replace({' +':' '},regex=True)\r\n", | |
"\r\n", | |
" # take care of garbage/irrelevant values\r\n", | |
" dataset = df.replace(to_replace='None', value=np.nan).dropna()\r\n", | |
" \r\n", | |
" dataset['Video Views'] = pd.to_numeric(dataset['Video Views'])\r\n", | |
" dataset['Video Views'] = dataset['Video Views'].astype(int)\r\n", | |
" dataset['Video Likes'] = pd.to_numeric(dataset['Video Likes'])\r\n", | |
" dataset['Video Likes'] = dataset['Video Likes'].astype(int)\r\n", | |
" dataset['Video Dislikes'] = pd.to_numeric(dataset['Video Dislikes'])\r\n", | |
" dataset['Video Dislikes'] = dataset['Video Dislikes'].astype(int)\r\n", | |
" dataset['Video Comments'] = pd.to_numeric(dataset['Video Comments'])\r\n", | |
" dataset['Video Comments'] = dataset['Video Comments'].astype(int)\r\n", | |
"\r\n", | |
" return dataset" | |
], | |
"execution_count": 11, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "Kau7XbljfJyJ" | |
}, | |
"source": [ | |
"Calculate the mean positive value of all the comments on a video" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "TzRoOIeIE_1n" | |
}, | |
"source": [ | |
"def get_comment_polarity(dataset):\r\n", | |
" dataset['polarity'] = dataset['cleaned_comments'].apply(lambda x: TextBlob(x).sentiment.polarity)\r\n", | |
" dataset['subjectivity'] = dataset['cleaned_comments'].apply(lambda x: TextBlob(x).sentiment.subjectivity)\r\n", | |
"\r\n", | |
" dataset_grp = dataset[['Query', 'Video ID', 'Video Views', 'Video Likes', 'Video Dislikes', 'Video Comments', 'polarity']].copy()\r\n", | |
"\r\n", | |
" dataset_grp = dataset_grp.groupby(['Video ID', 'Query'], as_index=False).mean()\r\n", | |
" dataset_grp = dataset_grp.sort_values(['Query', 'polarity'])\r\n", | |
" return dataset_grp" | |
], | |
"execution_count": 12, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "IeDLeiQxfSVx" | |
}, | |
"source": [ | |
"Ranking factor that takes care of the likes, dislikes and count of comments in the video along with the mean positive value of all the comments on a video" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "32H-WYoL8Xs1" | |
}, | |
"source": [ | |
"def get_rank_fact(vid_data):\r\n", | |
" if vid_data['Video Dislikes'] == 0:\r\n", | |
" rank_fact = ((vid_data['Video Likes']/1) + (vid_data['polarity']*vid_data['Video Comments'])) * vid_data['Video Views']\r\n", | |
" else:\r\n", | |
" rank_fact = ((vid_data['Video Likes']/vid_data['Video Dislikes']) + (vid_data['polarity']*vid_data['Video Comments'])) * vid_data['Video Views']\r\n", | |
" return rank_fact" | |
], | |
"execution_count": 13, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "YXcaZ121f0eV" | |
}, | |
"source": [ | |
"Apply the ranking factor to all the videos and sort them" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "XWCFfEm2UqLO" | |
}, | |
"source": [ | |
"def apply_rank_fact(dataset):\r\n", | |
" dataset['Rank Fact'] = dataset.apply(get_rank_fact, axis=1)\r\n", | |
" dataset = dataset.sort_values(['Query', 'Rank Fact'], ascending=False)\r\n", | |
" return dataset" | |
], | |
"execution_count": 14, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "8Gt_H1Hmf-8b" | |
}, | |
"source": [ | |
"Returns the top videos as per the new ranking factor" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "SY95AccPhWvY" | |
}, | |
"source": [ | |
"def get_top_videos(comments_df, dataset, query):\r\n", | |
" df = comments_df.copy() \r\n", | |
" df = df.drop_duplicates(subset=['Video ID', 'Video Title'])\r\n", | |
" dataset = pd.merge(dataset, df[['Video Title', 'Channel', 'Video ID']], on='Video ID', how='inner')\r\n", | |
" op = dataset.loc[dataset['Query'] == query].sort_values('Rank Fact', ascending=False)\r\n", | |
" return op" | |
], | |
"execution_count": 15, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "L0Fdw8F6R6r7" | |
}, | |
"source": [ | |
"## Driver Functions" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "-JYJhLsqgOZ9" | |
}, | |
"source": [ | |
"Set up the YouTube API" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "YE40O0iG-Qr6" | |
}, | |
"source": [ | |
"service = build_service()" | |
], | |
"execution_count": 16, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "ynEg2Xpz502o" | |
}, | |
"source": [ | |
"query = \"Java Tutorials\"\r\n", | |
"# query = sys.argv[1]" | |
], | |
"execution_count": 17, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "VrbsMCMHIBv-" | |
}, | |
"source": [ | |
"yt_videos = search_yt_videos(query, service)" | |
], | |
"execution_count": 18, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "i_BbdyyL-Rwx", | |
"colab": { | |
"base_uri": "https://localhost:8080/" | |
}, | |
"outputId": "a0010b61-21bd-4e46-88bb-070fcbb2121a" | |
}, | |
"source": [ | |
"videos_list_df = get_videos_list_df(yt_videos)\r\n", | |
"dataset = gen_dataset(yt_videos, service)" | |
], | |
"execution_count": 19, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"text": [ | |
"100%|███████████████████████████████████████████████████████████████| 25/25 [00:12<00:00, 2.03it/s]\n" | |
], | |
"name": "stderr" | |
} | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "RG-DIHuNnDT5" | |
}, | |
"source": [ | |
"clean_ds = clean_dataset(dataset)" | |
], | |
"execution_count": 20, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "g5RzbPdmnM5m" | |
}, | |
"source": [ | |
"rank_ds = apply_rank_fact(get_comment_polarity(clean_ds))" | |
], | |
"execution_count": 21, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "RmK1QF5-nZTY" | |
}, | |
"source": [ | |
"output = get_top_videos(clean_ds, rank_ds, query)" | |
], | |
"execution_count": 22, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "4b_det4bRuAg" | |
}, | |
"source": [ | |
"ranked_videos = output[['Channel', 'Video Title', 'Video ID']]" | |
], | |
"execution_count": 23, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 340 | |
}, | |
"id": "-Ifw6MTSKTEu", | |
"outputId": "11b09520-aba0-44f8-a0c7-f270fbf3d6e2" | |
}, | |
"source": [ | |
"ranked_videos.head(10)" | |
], | |
"execution_count": 24, | |
"outputs": [ | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/html": [ | |
"<div>\n", | |
"<style scoped>\n", | |
" .dataframe tbody tr th:only-of-type {\n", | |
" vertical-align: middle;\n", | |
" }\n", | |
"\n", | |
" .dataframe tbody tr th {\n", | |
" vertical-align: top;\n", | |
" }\n", | |
"\n", | |
" .dataframe thead th {\n", | |
" text-align: right;\n", | |
" }\n", | |
"</style>\n", | |
"<table border=\"1\" class=\"dataframe\">\n", | |
" <thead>\n", | |
" <tr style=\"text-align: right;\">\n", | |
" <th></th>\n", | |
" <th>Channel</th>\n", | |
" <th>Video Title</th>\n", | |
" <th>Video ID</th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <th>0</th>\n", | |
" <td>Derek Banas</td>\n", | |
" <td>Java Programming</td>\n", | |
" <td>WPvGqX-TXP0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>1</th>\n", | |
" <td>Programming with Mosh</td>\n", | |
" <td>Java Tutorial for Beginners [2020]</td>\n", | |
" <td>eIrMbAQSU34</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2</th>\n", | |
" <td>freeCodeCamp.org</td>\n", | |
" <td>Learn Java 8 - Full Tutorial for Beginners</td>\n", | |
" <td>grEKMHGYyns</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>3</th>\n", | |
" <td>CodeWithHarry</td>\n", | |
" <td>Java tutorial in hindi</td>\n", | |
" <td>rV_3Lewxx6o</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>4</th>\n", | |
" <td>Telusko</td>\n", | |
" <td>Java Tutorial for Beginners | Full Course</td>\n", | |
" <td>8cm1x4bC610</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>5</th>\n", | |
" <td>Alex Lee</td>\n", | |
" <td>Learn Java in 14 Minutes (seriously)</td>\n", | |
" <td>RRubcjpTkks</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>6</th>\n", | |
" <td>Tamil Hacks 2.0</td>\n", | |
" <td>Learn Java In Tamil | Beginner to Advance Comp...</td>\n", | |
" <td>XLnimroGCIg</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>7</th>\n", | |
" <td>Duckademy IT courses</td>\n", | |
" <td>Java tutorial for complete beginners with inte...</td>\n", | |
" <td>JPOzWljLYuU</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>8</th>\n", | |
" <td>edureka!</td>\n", | |
" <td>Java Full Course | Java Tutorial for Beginners...</td>\n", | |
" <td>hBh_CC5y8-s</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>9</th>\n", | |
" <td>Caleb Curry</td>\n", | |
" <td>Java Programming All-in-One Tutorial Series (6...</td>\n", | |
" <td>r3GGV2TG_vw</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"</div>" | |
], | |
"text/plain": [ | |
" Channel ... Video ID\n", | |
"0 Derek Banas ... WPvGqX-TXP0\n", | |
"1 Programming with Mosh ... eIrMbAQSU34\n", | |
"2 freeCodeCamp.org ... grEKMHGYyns\n", | |
"3 CodeWithHarry ... rV_3Lewxx6o\n", | |
"4 Telusko ... 8cm1x4bC610\n", | |
"5 Alex Lee ... RRubcjpTkks\n", | |
"6 Tamil Hacks 2.0 ... XLnimroGCIg\n", | |
"7 Duckademy IT courses ... JPOzWljLYuU\n", | |
"8 edureka! ... hBh_CC5y8-s\n", | |
"9 Caleb Curry ... r3GGV2TG_vw\n", | |
"\n", | |
"[10 rows x 3 columns]" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
}, | |
"execution_count": 24 | |
} | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "0hD307QpRu59", | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 340 | |
}, | |
"outputId": "44c5fb1b-7d0e-49f2-eca4-0d288c700510" | |
}, | |
"source": [ | |
"videos_list_df.head(10)" | |
], | |
"execution_count": 25, | |
"outputs": [ | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/html": [ | |
"<div>\n", | |
"<style scoped>\n", | |
" .dataframe tbody tr th:only-of-type {\n", | |
" vertical-align: middle;\n", | |
" }\n", | |
"\n", | |
" .dataframe tbody tr th {\n", | |
" vertical-align: top;\n", | |
" }\n", | |
"\n", | |
" .dataframe thead th {\n", | |
" text-align: right;\n", | |
" }\n", | |
"</style>\n", | |
"<table border=\"1\" class=\"dataframe\">\n", | |
" <thead>\n", | |
" <tr style=\"text-align: right;\">\n", | |
" <th></th>\n", | |
" <th>Channel</th>\n", | |
" <th>Video Title</th>\n", | |
" <th>Video ID</th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <th>0</th>\n", | |
" <td>Programming with Mosh</td>\n", | |
" <td>Java Tutorial for Beginners [2020]</td>\n", | |
" <td>eIrMbAQSU34</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>1</th>\n", | |
" <td>edureka!</td>\n", | |
" <td>Java Full Course | Java Tutorial for Beginners...</td>\n", | |
" <td>hBh_CC5y8-s</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2</th>\n", | |
" <td>Alex Lee</td>\n", | |
" <td>Learn Java in 14 Minutes (seriously)</td>\n", | |
" <td>RRubcjpTkks</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>3</th>\n", | |
" <td>Amigoscode</td>\n", | |
" <td>Java Full Course | Java Tutorial for Beginners...</td>\n", | |
" <td>Qgl81fPcLc8</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>4</th>\n", | |
" <td>Telusko</td>\n", | |
" <td>Java Tutorial for Beginners | Full Course</td>\n", | |
" <td>8cm1x4bC610</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>5</th>\n", | |
" <td>freeCodeCamp.org</td>\n", | |
" <td>Learn Java 8 - Full Tutorial for Beginners</td>\n", | |
" <td>grEKMHGYyns</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>6</th>\n", | |
" <td>blondiebytes</td>\n", | |
" <td>Learn Java in 25 minutes | Java Tutorial for B...</td>\n", | |
" <td>RLi1rOgTRbA</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>7</th>\n", | |
" <td>Derek Banas</td>\n", | |
" <td>Java Tutorial</td>\n", | |
" <td>n-xAqcBCws4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>8</th>\n", | |
" <td>Caleb Curry</td>\n", | |
" <td>Java Programming Tutorial 1 - Introduction to ...</td>\n", | |
" <td>2dZiMBwX_5Q</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>9</th>\n", | |
" <td>freeCodeCamp.org</td>\n", | |
" <td>Intro to Java Programming - Course for Absolut...</td>\n", | |
" <td>GoXwIVyNvX0</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"</div>" | |
], | |
"text/plain": [ | |
" Channel ... Video ID\n", | |
"0 Programming with Mosh ... eIrMbAQSU34\n", | |
"1 edureka! ... hBh_CC5y8-s\n", | |
"2 Alex Lee ... RRubcjpTkks\n", | |
"3 Amigoscode ... Qgl81fPcLc8\n", | |
"4 Telusko ... 8cm1x4bC610\n", | |
"5 freeCodeCamp.org ... grEKMHGYyns\n", | |
"6 blondiebytes ... RLi1rOgTRbA\n", | |
"7 Derek Banas ... n-xAqcBCws4\n", | |
"8 Caleb Curry ... 2dZiMBwX_5Q\n", | |
"9 freeCodeCamp.org ... GoXwIVyNvX0\n", | |
"\n", | |
"[10 rows x 3 columns]" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
}, | |
"execution_count": 25 | |
} | |
] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment