Python YouTube API Tutorial: Calculating the Duration of a Playlist

  Рет қаралды 59,679

Corey Schafer

Corey Schafer

Күн бұрын

Пікірлер: 175
@coreyms
@coreyms 4 жыл бұрын
Hope everyone is having a great week so far. In this video we're going to be writing a script that I've personally used a lot to calculate the total duration of KZbin playlists. If you have any more suggestions of what you'd like to see us use the KZbin API for then definitely let me know. I have a few more videos in mind of what I use this for personally, but I'm also interested in hearing your use cases as well. Thanks!
@zaabimahdi
@zaabimahdi 4 жыл бұрын
@Corey Schafer: do you really watch youtube courses ???
@coreyms
@coreyms 4 жыл бұрын
@@zaabimahdi Oh yeah, all the time. Not always programming. Sometimes it can be a college course or some other field of study I'm interested in.
@SalimHamood1
@SalimHamood1 4 жыл бұрын
@@coreyms can you make ml script that predicts corona cases ?
@zaabimahdi
@zaabimahdi 4 жыл бұрын
@@coreyms very interesting and motivating to read this comment from you... Thank you !
@i_v_t
@i_v_t 4 жыл бұрын
Can we download the playlist using this?
@HamroMotors
@HamroMotors 4 жыл бұрын
Best Teacher for me all over Internet This guy is giving all his videos for free ... really appreciate man
@ForTheGreaterGood
@ForTheGreaterGood 4 жыл бұрын
You can say that again
@theanswer3sixers
@theanswer3sixers 4 жыл бұрын
If anyone else wants to avoid regular expressions, they could do the following. KZbin duration is in ISO 8601 format, so I used the *isodate* library (pip install isodate) and used its 'parse_duration' method which returns a timedelta. So the code at that point simply becomes: for video in video_response['items']: iso_8601_duration = video['contentDetails']['duration'] dt = isodate.parse_duration(iso_8601_duration) total_seconds += dt.total_seconds()
@coreyms
@coreyms 4 жыл бұрын
Nice! Definitely a better solution than I used.
@jimshapedcoding
@jimshapedcoding 4 жыл бұрын
Corey Schafer OOP and also Django literally took my Programming level from beginner to great level, a level that gave me enough confidence to give my own shot with Python series Thanks for teaching us a lot Corey, You are still number 1 in all Python communities that I'm a part of. ;)
@sekekeretsu4172
@sekekeretsu4172 4 жыл бұрын
My fav python and programming language course channel on youtube. The video length are right for my attention span. Also the accent is a plus. Definitely recommending it to my colleagues.
@hamed5174
@hamed5174 4 жыл бұрын
60:26:37 of my precious life time has been spent with Master Schafer!
@Special_Sharpie
@Special_Sharpie 4 жыл бұрын
Corey, you are an absolute legend, I came across your tutorial videos a while back and was blown away by how in-depth and non specific they are. Whenever I am looking into a new module or python feature, I check to see if I can find one from you! Keep it up! With your help I have almost mastered API scrapping, working with JSON files and much more! THANK YOU!
@jadia
@jadia 4 жыл бұрын
A much-needed video. I've been thinking to do this for a long time. Thank you so much for making it. I'll join the membership once I'll have a steady income to support myself. Thank you again for making such content free of cost and available to everyone.
@justin3594
@justin3594 4 жыл бұрын
I’m so happy to see these api videos. To me they are the most useful thing ever. I would love you to cover how to setup an app to maintain local data from an api or scraping. In other words we can pull the data down, but how do I put it in a database and get it to update ever day or so? That would be gold.
@dailydevtips
@dailydevtips 4 жыл бұрын
Well articulated tutorial. I used this tutorial to calculate the the total length of all videos on Corey's channel. This is what I found. 77:16:47
@mehrabdarvishi
@mehrabdarvishi 4 жыл бұрын
corey : " i believe that..." probility calculator : "100%"
@obi666
@obi666 4 жыл бұрын
You' re doing great job making these tutorials. I really respect people who make quality and usefull stuff for free. Keep it up!
@netafeliciano6126
@netafeliciano6126 3 жыл бұрын
You and Ahmad Bazzi are my go-to python channels !
@bohdan134
@bohdan134 4 жыл бұрын
Recently i just search service for make this calculation.. and now you made guide about it! Awesome! Thanks! Like!
@omar7amdi
@omar7amdi 3 жыл бұрын
The best instructor in every subject
@tony99659
@tony99659 2 жыл бұрын
Corey, you are the most amazing teacher youtube will ever have!
@rafasantos23
@rafasantos23 4 жыл бұрын
60 hours on social medias?: NO 60 hours watching Schafer's videos: YYYYYEEEEES
@veryexciteddog963
@veryexciteddog963 2 жыл бұрын
Corey makes watching over half an hour of video to learn how to see a value that KZbin could have just included in the API if they weren't braindead much more bearable.
@AbeshGhosh-m6h
@AbeshGhosh-m6h Жыл бұрын
best channel to learn coding. hats off to you man. you are very good teacher
@tejasvix
@tejasvix 4 жыл бұрын
Liking and commenting before watching the video is must for this Channel....
@DanielLavedoniodeLima_DLL
@DanielLavedoniodeLima_DLL 4 жыл бұрын
Awesome video as always, Corey. I already programmed a lot in Python throughout college, but your videos made me understand way better a lot of concepts I thought I fully understand, only to realise I missed some details that made a difference later. You're a great teacher, thanks a lot! May I suggest 2 topics I find it hard to find content about: - Django REST framework - Create an executable and GUI for inputs in a Python script (this one would make a big difference to me, as it allows people that are not familiar with programming to use my scripts) Again, thanks for the quality content and I hope I can contribute to you after I graduate from college. For now, I recommend your videos to everyone that asks me for help learning Python
@thekitten117
@thekitten117 4 жыл бұрын
I like to watch at 1.75 speed. A small adjustment is required. Great vid!
@gambomaster
@gambomaster 4 жыл бұрын
You are one of my favorite teacher. Thanks man. 👍👍👍
@ramshankarkumar4222
@ramshankarkumar4222 4 жыл бұрын
Hey ..... I just made this youtube playlist time calculator using Selenium and Beautifulsoup . Using selenium and Soup it was little bit tricky but for understanding the web scrapping part it was very essential for me to go with those. And thank you so much sir for uploading this video usin KZbin API because for sure it will be much faster than my selenium and soup script and it removes many corner cases that i was facing in my script.... Again a big thnks for this :)
@tejasjoshi3724
@tejasjoshi3724 4 жыл бұрын
Hello Corey, Today is Guru Pournima In India. It is kind of like Teacher's Day. We worship our teachers today. So I would like to wish you Happy Guru Pournima and thank you for doing what you are doing.
@coreyms
@coreyms 4 жыл бұрын
Thanks!
@antonie9034
@antonie9034 4 жыл бұрын
Thanks Corey I've learnt alot from you than in any classroom ever. Ive been learning Data science and I think I havent learnt about Numpy [Numerical Python] Kindly do a video on that
@saralgyaan
@saralgyaan 2 жыл бұрын
your videos are best. I learn a lot from you on daily basis. Thanks a lot....
@processorbot8761
@processorbot8761 4 жыл бұрын
Thank you so much Corey! Just what i needed to help me execute a project idea!!
@DSD
@DSD 4 жыл бұрын
That was great! I'm coming to this from the wrong video so my credential part is grabbed differently and I could get the code to run correctly from the download - but I followed along and got it to work. My playlist has 376 hours 22 minutes and 59 seconds. Would like to try to use this to go through the subscriber list and the member list but can't get that to work right. WIll have to try again after getting this to work.
@fidodido48
@fidodido48 3 жыл бұрын
Very useful - thank you. I've added user playlist input so there's no need to change id manually each time.
@ThomasGabrielsen
@ThomasGabrielsen 3 жыл бұрын
This was a great tutorial to getting started with KZbin API. I'll check out more of your videos. Your Python tutorial playlist is currently impressive 62:9:43 long. Thank you! :-)
@radonspace2098
@radonspace2098 3 жыл бұрын
To be precise: 62 hours: 9 minutes: 42 seconds. 😉
@ThomasGabrielsen
@ThomasGabrielsen 3 жыл бұрын
@@radonspace2098 D'oh! :-)
@fazalmehmood6802
@fazalmehmood6802 4 жыл бұрын
Hey man. May God bless you. Great video as always. The way you break down complicated knowledge into small easily absorbable chunks is really amazing. I was wondering if you can make some tutorials about React js.
@harishbetrabet
@harishbetrabet 23 күн бұрын
Excellent video, good explanation of concepts.
@rangabharath4253
@rangabharath4253 4 жыл бұрын
Awesome as always
@GautamGupta-qd6qz
@GautamGupta-qd6qz 4 жыл бұрын
Please make videos on scikit-learn..... you're the best teacher on KZbin
@jansaibic2627
@jansaibic2627 4 жыл бұрын
Hi Coery, great video, thank you for all your tutorials, it helped me incredibly to boost my career.. Do you think it would be possible to do video about new dataclass that came up in python3.7? I am thinking about using it for my automation test data, but I not sure about all of it ups and downs and since I am still a newbie, a video from you on this topic would help me a lot. Thank you and keep up the awesome work!
@letampatrickbienwi4610
@letampatrickbienwi4610 5 ай бұрын
Great video Cory, I feel really empowered to tackle in depth python projects. Wouldn’t it be simpler having a function that treats the duration as a string and extracts each value based on when the current value in the iteration is not a digit? Thank you once again!
@MultsElMesco
@MultsElMesco 4 жыл бұрын
This was a great tutorial! Thank you so much for sharing it
@متعةالمحققكونانالجزء9
@متعةالمحققكونانالجزء9 4 жыл бұрын
😍 i it will be great if you show us how to apply these things to private videos and playlists 😍 thanks in advance
@AlexMelemenidis
@AlexMelemenidis 8 ай бұрын
Great video! Very useful!👏👏👏
@DavidYoud
@DavidYoud 3 жыл бұрын
That was a nice leg up. Thanks!
@TopicalAuthority
@TopicalAuthority 4 жыл бұрын
TypeError: expected string or bytes-like object, I am taking this error in 18:50, any idea?
@TheShubham67
@TheShubham67 4 жыл бұрын
61:4:15 the current view time of python series!
@an4s911
@an4s911 4 жыл бұрын
Hey there 👋😂 Corey Scafer, I love your content and your python tutorials are just so amazing and really explained. Even though I've learned python from a lot of different sources and have found many really good ones, I always come back to your channel to check if you have anything about it because I understand more better in your videos. And also I started learning python in the beginning was from you. Im just a beginner programmer, and what I want to recommend/suggest is that I wanted some tkinter tutorial, and in most of the other KZbin channels I don't find content that is as good as yours. If you'd like please upload a tkinter or just some GUI Python tutorials. Thank You very Much 😄
@AmanYadav-nu6yx
@AmanYadav-nu6yx 4 жыл бұрын
Sir, please create a video on socket programming in python.I thrice went through the documentation but didn't understand much.Your videos are true source of learning for me. I went through other tutorial s to but those are very confusing for me.
@mostafahamza3106
@mostafahamza3106 2 жыл бұрын
there is no words i love you haha lol how i did not see this chanel before hah
@rhoynarr
@rhoynarr 2 жыл бұрын
LOL
@CB-ym7vg
@CB-ym7vg Жыл бұрын
awesome style... thank you very much
@henrychen1433
@henrychen1433 4 жыл бұрын
thank you Corey for all the amazing tutorial videos! also can you please upload a video on using AWS Lambda functions to resize images, would be very helpful!
@pratikkawalgikar4839
@pratikkawalgikar4839 4 жыл бұрын
Hi Corey, Your videos are the best ever for understanding. It would be really great if you could do a series on Numpy and lambda functions. I only trust you when it comes to Python language learning. #StaySafe :-)
@yandelyano
@yandelyano 4 жыл бұрын
Mobile dev community especially the new baby Flutter & Dart, needs a Corey Schafer. Please consider that segment, there are a plethora of content creators who give courses on the subject, none goes out of their way to explain things thoroughly.
@remixowlz
@remixowlz 4 жыл бұрын
Hi Corey, when are you going to start Machine Learning Series ? - chatbot, classifier etc . Your tutorial videos are really solid and amazing!
@kalaivendhan7415
@kalaivendhan7415 4 жыл бұрын
@corey 11:24 So why did you add the join function here, when appending the video id to the list its already a list and its working for me when I pass the vid_ids directly
@mukeshrar265
@mukeshrar265 2 жыл бұрын
The Zen of Python, by Tim Peters Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Complex is better than complicated. Flat is better than nested. Sparse is better than dense. Readability counts. Special cases aren't special enough to break the rules. Although practicality beats purity. Errors should never pass silently. Unless explicitly silenced. In the face of ambiguity, refuse the temptation to guess. There should be one-- and preferably only one --obvious way to do it. Although that way may not be obvious at first unless you're Dutch. Now is better than never. Although never is often better than *right* now. If the implementation is hard to explain, it's a bad idea. If the implementation is easy to explain, it may be a good idea. Namespaces are one honking great idea -- let's do more of those!
@rhoynarr
@rhoynarr 2 жыл бұрын
thanks
@rangavembar
@rangavembar 4 жыл бұрын
Awesome!!
@sebastiancaro7713
@sebastiancaro7713 4 жыл бұрын
Hey Corey! Quick question: I followed this tutorial all the way through and when I printed out the hours, minutes, and seconds. I got the wrong time. It gave me 62:9:44, do you know what the issue might be? (My code is exactly the same as yours) PS: Love your videos man, excellent educational and very entertaining tutorials
@marklonganbach3268
@marklonganbach3268 4 жыл бұрын
Hi Sebastian, I also received the same timestamp as you. Corey's original video was posted several months ago, and if you watch closely you'll see he had 140 videos in his playlist. As of my post's date, he now has 143 videos. I'm guessing the 3 additional videos add up to the extra ~90 minutes seen.
@raghuramabl6729
@raghuramabl6729 4 жыл бұрын
Python on KZbin ✌
@dakoderii4221
@dakoderii4221 4 жыл бұрын
PyTube
@raghuramabl6729
@raghuramabl6729 4 жыл бұрын
@@dakoderii4221 youthon
@Zwiesel66
@Zwiesel66 Жыл бұрын
9:49 just out of curiosity, I tried it with a list and not a comma separated string , and it worked too - was it magic? 🤔
@BrendanMetcalfe
@BrendanMetcalfe 4 жыл бұрын
Nice vid!
@noned5308
@noned5308 4 жыл бұрын
Can you please make an update javascript tutorial. Thank you so much for all the tutorials you have made honestly no one explains as clear as you do thanks.
@TypicallyThomas
@TypicallyThomas 3 жыл бұрын
This is so helpful
@rudrakshaggarwal3941
@rudrakshaggarwal3941 4 жыл бұрын
Please make a tutorial for django rest framework too
@saubhagyatandon4787
@saubhagyatandon4787 4 жыл бұрын
He already has it
@sanjuthreddy6435
@sanjuthreddy6435 3 жыл бұрын
sir please do make a tutorial for using Google docs API like how to get the text data form a document in a google doc
@tanmaydeshpande
@tanmaydeshpande 4 жыл бұрын
I'm pretty sure that you could just use pytube to get the duration of all the videos within the playlist and then simply add them up to get the actual duration of the playlist.( I believe there are finer options within the method to get specific format of duration)
@daito9163
@daito9163 4 жыл бұрын
Before 2 minutes of this video,i just calculated his *Python Tutorial* playlist duration manually and it took 10 minutes to calculate 143 video's duration 😅.
@oscarmartinezbeltran
@oscarmartinezbeltran 4 жыл бұрын
Fantastic!!
@CaribouDataScience
@CaribouDataScience Жыл бұрын
Have you created any more videos in this series?
@TheNewTravel
@TheNewTravel 4 жыл бұрын
Thanks Corey. Is there a quick modification that could use this script to calculate total duration of all videos on a channel?
@Just2Dimes
@Just2Dimes 4 жыл бұрын
I tried this and it wasn't trivial in my experience, but I found this that made it a lot easier: github.com/youtube/api-samples/blob/master/python/my_uploads.py It's python 2 code though, so alter the 'print' statements, but this should work to get a list of all video_ids for a channel and then you can use Corey's code
@ЕленаЯкунова-б7с
@ЕленаЯкунова-б7с Жыл бұрын
Delightfully clear❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤
@Mireda-wr3yc
@Mireda-wr3yc 4 жыл бұрын
Python : like 👍 Java : comment...
@murugan0723
@murugan0723 4 жыл бұрын
Please start a tutorial series on how to create Interactive Reporting Dashboard with Python.
@cwansu
@cwansu 4 жыл бұрын
python composition and aggregations please Sir ....❤️❤️
@basilolewa3307
@basilolewa3307 2 жыл бұрын
You’re a beast
@rhoynarr
@rhoynarr 2 жыл бұрын
lol
@ram_rahim_creations_officials
@ram_rahim_creations_officials Жыл бұрын
Hello Sir, thank you for sharing with us. How can i get, the time a person actually watches a video? ( ex: if a total duration video is 10 minutes but I have watched only 4 minutes).
@nooruldeenq.5037
@nooruldeenq.5037 4 жыл бұрын
Video number 141 :( is missing, it was deleted, i cant reach it, for this video am happy to watch and learn from you, thanks :)
@quasa0
@quasa0 4 жыл бұрын
Dude that's like literally the case - I've had this problem so many times and I never did focus on this project. Can you put up a link somewhere so that we could use that solution?
@blackberry1622
@blackberry1622 4 жыл бұрын
Mr. Schafer i am watching your pandas series. Can you use dark mode on jupyter if you use it from next time on because most of the students use dark mode and we have to switch continuosly from dark to light and so on. I love your videos.
@chocotaco8396
@chocotaco8396 4 жыл бұрын
Hey Corey, can you make a video on your present sublime setup?
@mirazking7694
@mirazking7694 4 жыл бұрын
make some real world project video....Like: what you do with django. Also,,,how can use good keyword to find my youtube video...first search...using python?? Automatic do with python.
@FireFly969
@FireFly969 2 жыл бұрын
thank you
@LordVlader
@LordVlader 4 жыл бұрын
Would multiprocessing or threading be appropriate for speeding up this script when calculating the duration for each video in a playlist?
@alenjose3903
@alenjose3903 4 жыл бұрын
you said its good to create a virtual env for your projects, can we achieve that using the pycharms inbuilt virtual environment option while creating a new project?
@asoul5528
@asoul5528 4 жыл бұрын
Hey there, thanks for the youtube api section. I wonder, if it is possible to track the donation amounts from KZbins SuperChat on realtime? From what I saw it is somehow "event-driven" but not really sure about that. I think this would make an interesting video, but not sure if this goes too deep.
@raghuramabl6729
@raghuramabl6729 4 жыл бұрын
Nice
@sametdemir3961
@sametdemir3961 4 жыл бұрын
Corey can you add comment section to your django app? Thank you for videos!
@prashantpathak3175
@prashantpathak3175 4 жыл бұрын
Hello Corey, Can you help to understand how an object holds thousands to million elements inside it without taking any space and when we run for loop or convert to list we are able to see all those values. In short how internally an object holds all this big list of elements.
@Veptis
@Veptis 2 жыл бұрын
Need to do that for my watch later and also check the average hours per day
@fowad27
@fowad27 3 жыл бұрын
How would I need to modify the code to find the duration of my watch later playlist? What I gather from the documentation, the watch later playlist cant be queried in the same way as the other playlists. Great video btw
@MoisesRoth
@MoisesRoth 4 жыл бұрын
Corey, have you already use web2py framework?
@ayush.kumar.13907
@ayush.kumar.13907 4 жыл бұрын
could i use this API to get information about Watch Later playlist of my own channel? I know that WL playlist cannot be accessed for others' channels.
@shyamss2338
@shyamss2338 2 жыл бұрын
How do I mention what playlist is giving us the respective amount of time in the final f string print statement rather than reflecting back to the playlistId?
@akshaykrishna8626
@akshaykrishna8626 4 жыл бұрын
Hey Corey, Could you do a playlist on Numpy? I couldn’t find in your channel. It’d be very helpful if you do. Thanks.
@kvnagendra5354
@kvnagendra5354 4 жыл бұрын
*Please make a video on django and rest api ,json and Api,U can only explain them very well,Plz plz*
@drac8854
@drac8854 4 жыл бұрын
Hey Corey can you make a video on how to use KZbin data api's livebroadcasts method it shows on github docs but isnt in main docs and i don't understand how to use it To be specific what to pass in part argument Thanks
@that_guitar_guy7032
@that_guitar_guy7032 4 жыл бұрын
What text editor are you using? It seems pretty good I’m using an IDE btw
@Sebatorsk
@Sebatorsk 4 жыл бұрын
Sublime Text, says so in the top left corner :)
@nagabhushanr5599
@nagabhushanr5599 4 жыл бұрын
Can you please make a video series on NLP using python nltk
@kumaranuj6548
@kumaranuj6548 3 жыл бұрын
#awesome #python3
@akuma0009
@akuma0009 4 жыл бұрын
Will you make a video tutorial for posting text , image , video on User facebook wall with python .
@tesla9527
@tesla9527 4 жыл бұрын
very good video. May I ask what is your sublime theme?
@coreyms
@coreyms 4 жыл бұрын
Predawn
@lousimms4766
@lousimms4766 4 жыл бұрын
can you make a tutorial video on time space complexity log n log(n) etc
@MrIneedalifenow
@MrIneedalifenow 4 жыл бұрын
Hey @corey Schafer, could you make a video about captions using the KZbin API I'm trying to use it without much success
@srikrupa7445
@srikrupa7445 4 жыл бұрын
Hi,can someone please tell me how long it took for you people to learn corey sir's matplot lib series,i am a beginner,i want to assess my learning pace,for me it took about one week,once corey sir teaches,i go to the description and write down the entire code and i will write beside each code why was it used,is this a good method to learn? I do this so that i will be able to remember things in the long run,so whenever i forget, i can go through my notes,is this a good method
Python YouTube API Tutorial: Sort a Playlist by Most Popular Videos
22:08
Python OOP Tutorial 1: Classes and Instances
15:24
Corey Schafer
Рет қаралды 4,5 МЛН
Deadpool family by Tsuriki Show
00:12
Tsuriki Show
Рет қаралды 5 МЛН
Players push long pins through a cardboard box attempting to pop the balloon!
00:31
Python Tutorial: Securely Manage Passwords and API Keys with DotEnv
16:58
This script I threw together saves me hours.
13:38
John Watson Rooney
Рет қаралды 21 М.
Create A Python API in 12 Minutes
12:05
Tech With Tim
Рет қаралды 697 М.
How to use Youtube API to extract YT channel data with Python (Step by step)
12:27
10 ULTIMATE Python Tips 🔥
16:42
Tech With Tim
Рет қаралды 71 М.
Python Tutorial: if __name__ == '__main__'
8:43
Corey Schafer
Рет қаралды 2 МЛН
Making Automatic YouTube videos with Python
7:32
Shifty the Dev
Рет қаралды 197 М.