Building a YouTube-Twitter Bot, Part 3: Checking for New Video and Tweeting Link
At the end of the last post I mentioned that I might put these posts on hold for until 2021. While posts were on hold, the development was not; at least not until just before Christmas. The bot is actually live and tweeting!!! Please go follow it, it’s called @YTBotbyPS. YouTube Bot by princelySid is where the name comes from.
The problem with coming back to writing is that you’ve forgotten almost everything you did to get to the point you’re now at, development-wise, and you have your editor leave messages like this on the post you started but didn’t finish
Building a YouTube-Twitter Bot, Part 2: Extracting List of New Uploads
To recap, we’re building a bot that given a list of YouTube channels, it’ll tweet out snippets of a newly posted video. Below is the list of planned activities:
- Get list of my subscriptions from YouTube.
- Mark channels as music or blog and whether they’re Kenyan.
- For each channel get a list of recent videos and store that in a database.
- Take the last video link and download the video.
- Clip the video to 40s.
- Tweet that video (title, link to YouTube)
- Save link to tweet, video in database
- Check every 30 minutes if there’s a new video, if yes start from 4.
In the previous post we managed to get the data from YouTube and save it into a csv file. I’ve subscribed to over 900 channels; a rather ridiculous number of channels I’ve been told.
Building a YouTube-Twitter Bot, Part 1: A List of Subscriptions
To recap, I am building a bot that given a list of YouTube channels it’ll tweet out snippets of the videos when a new one is posted. In the previous post, I had a list of the things we need to do to get there:
- Get list of my subscriptions from YouTube.
- Mark channels as music or blog.
- For each channel get a list of recent videos and store that in a database.
- Take the last video link and download the video.
- Clip the video and clip it to 40s.
- Tweet that video (title, link to Youtube)
- Save link to tweet, video in database
- Check every 30 minutes if there’s a new video, if yes start from 4.
Today we’ll be looking at the first one: getting a list of subscriptions from YouTube.
Building a YouTube-Twitter Bot, Part 0: The Idea
One of my passions in life is finding and consuming great Kenyan content: text, video, audio; doesn’t matter much to me. In a bid to keep abreast with this content, I subscribe to all the Kenyan content I can find on YouTube. However, keeping up with all of this has been difficult.
A combination of algorithmic feeds and an overwhelming amount of content means that I miss out on a lot content. I only have so many hours in a day and I have a full time job.
You Ought to Watch the AlphaGo Movie
In March 2016, AlphaGo beat Lee Sodol, one of the world’s top players of the Chinese game Go, by 4-1, marking the end of what was probably the last great board game AI had to conquer.
What makes Go a particularly difficult problem for computers to at least in the traditional (simplistic) approach is that the number of possible combination moves number more than the atoms in the universe. So it’s impossible to brute force it with the entirety of the computing power we have. Thus it was a good problem for finding alternative approaches.
How to Think About Python Decorators
One of the things I’ve struggled with while coding in python is decorators. I’ve always known that they could be useful, but didn’t have a solid intuition on their implementation. Every time I thought I had a grasp on decorators, I’d try to use them and fail.
Thus, I am writing this as a guide for myself, but also for the benefit of anyone who might benefit from my understanding. All code for this write up was run in python 3.6.
Design Thinking in Data Science
In August of 2019, I was invited by my friend Preston Adie of Africa’s Talking to attended a panel discussion called “AI in Kenya” with 3 other smart practitioners in the Kenyan data science space: Babatunde Ekemode of Africa’s Talking, Skyler Spearman of IBM, and Fiona Rasanga of Griffin Insurance.
The discussion was wide, ranging from what we thought the state of data science in Kenya was to what trends we saw. It was interesting, and I hope some video of the conversation comes out.
Uploading Videos Longer than 30 seconds to Twitter using Twython
Long time guys. I don’t really have a good excuse for why, because my excuse is laziness.
Anyway, I’m currently working on a personal project that involves uploading video to twitter. I don’t want to go into more details because I might never finish it, and I really don’t want too many people asking what happened.
While I was using it to upload some video, I encountered an error that I couldn’t easily fix:
Will KUCCPS Reevaluate University Entry Requirements?
In my previous post talking about the KSCE results and the best way to visualise the radical change that the year 2016 was, I began to form a hypothesis that this change (66% got a grade of D+ or worse compared to about 45% in previous years) would led to a relaxing in the entry requirements for students entering university in 2017.
In Kenya, the Kenya Universities and Colleges Central Placement Service (KUCCPS) is tasked with determining which university and course students are placed in based on a number called a cutoff point (a combination of overall grade and subjects chosen and how well you performed in those subjects). While students do have the option to enter university as a private student, which entry requirements are set by the university, placement by KUCCPS means that you enter as a government sponsored student which means your school fees will be heavily subsidised by the government. In a country with high poverty rates like ours, it’s no wonder there’s so much pressure on students during KCSE.
The Essence of Data Visualisation
Last year (2016) after the KCSE results were released, my friend Chris Orwa, a data scientist, wrote a blogpost analysing the data on the performance of the past years, looking to see what changed in 2016. It’s a good post and you are encouraged to have a look at it. However, I had one problem with it, the visualisation he used. I told him that I thought I could do better.