No way. This article ends in Part ②. (Lol)
Caution: This post is not a post where you can learn anything. It's just a post where beginners learn programming and write down where they stumbled. .. .. orz
I'm good at python! This guy is worried about something simple. If you have a kind heart, please give me some advice. ..
environment: windows Anaconda3 python3.7.6
Details are described in Part 1 below. https://qiita.com/NAKASHOU/items/f76ddf988a8ac84d55c4
Simply put, download a large number of youtube thumbnails, determine if the thumbnail contains a specific image, and export it to a spreadsheet (Excel). I wanted to do that.
Conclusion: How random it is to complete. .. The actual number of working days is 3 days. In order to write this article, PYTHON was a complete amateur, so I was studying list type, dictionary type, etc. from flow control such as if statements.
Since I work on weekdays, will it take about a month? I was thinking. The overwhelming excellence of the qiita article and the simplicity of PYTHON's grammar helped me. Thank you very much.
It's okay to put the code, but since the code isn't pretty as a compliment (or rather dirty), I'll put only the points used for implementation.
YouTube Data API v3 CV2 openpyxl glob It was easy to make using the above four.
The implementation image is (1) Download a large number of thumbnails by date and time sorting using YouTube Data API v3 (2) Cut out the image of a specific card (let's call it A), and use CV2 to determine whether all the images contain A. (3) Export the true judgment result to youtubeURL and the thumbnail image to Excel. Will be.
YouTube Data API v3 First, about YouTube Data API v3. With reference to the following article (or rather, the program is listed), the thumbnail download program has been completed. https://qiita.com/Sinhalite/items/39a302491873419af918
The point that took time is that if the article is implemented, it seems that it will sort by date and time and fetch "all videos" in order, but somehow the videos are skipped and acquired. (For example, today's video has 30 videos, so if you want to download 30 thumbnails, 15 videos for today and 15 videos will be skipped 15 videos like past videos. I wonder if it will be transmitted.) The cause has not yet been clarified here. .. .. However, by adding publishedAfter to the search condition, I specified the date and time of the desired video, and it brought me without skipping to some extent. What is it? (Lol)
The code in the article
videos_response = youtube.search().list(
part="snippet",
channelId=channel_id,
maxResults=50,
order="date",
pageToken= next_page_token
).execute()
After renovation
videos_response = youtube.search().list(
part="snippet",
channelId=channel_id,
maxResults=50,
publishedAfter="2020-07-01T00:00:00Z",
order="date",
pageToken= next_page_token
).execute()
There was one more stumbling block. I got caught in API usage restrictions. Should I program it nicely to save money? YouTube Data API v3 is stingy. (Laughs) (There was a description on how to save money in the official reference.) It seems that there is an application to raise the usage limit (it seems that it may be free), but it was difficult to understand and the usage limit will be reset after one day, so I did not apply.
CV2 And then CV2 matchTemplate. This was exactly what I wanted to do. .. (Laughs) In Part 1, I experienced some difficult things such as face recognition technology, but I don't need anything like this.
The following is the reference URL. (Almost all programs are available. Really excellent.) I was very happy when I found this article. I'm not sure because I've just started programming, but how do programmers find the modules they need? I was googled for what I wanted to do, but I want advice from experienced people. .. .. https://qiita.com/anzanshi/items/82fc4c7a3a1f84137aef
I had a hard time because I wanted to register the program in cron (scheduling function of linux), so I created it on linux. Build cv2? Couldn't. .. I tried various things as a reference, but the error did not go away. Therefore, I ported the program to windows. Isn't build prone to errors? Since I installed the virtual machine linux used this time with the minimum configuration, I think I will try to install it again in anticipation of various application servers. I wonder if it was built from the beginning? I'm expecting it.
The reference URL is around here: ① Paste a large number of images into Excel. https://www.cresco.co.jp/blog/entry/11916/ ② Get the file list in the folder with Python https://qiita.com/amowwee/items/e63b3610ea750f7dba1b ③ How to get only the file name in the folder with python https://qiita.com/d_desuyon/items/94eb52394a8152143f63
I think this is pretty general, so I don't really want to write anything about it. (Lol) To put it bluntly, the windows path must overlap with "\", which is just annoying.
No, I didn't think it would be so easy. I was prepared for part 10th place. End with ② Death. Next, I want to make an application that can operate the browser.
By the way, youtube is a game called Clash Royale. I was able to snoop on the play of top players with this program. As long as I'm happy. (Lol)
Also, it's fun to make an app and work as expected. I have experienced it for myself. Right now I'm doing DBA with a major SIer, but eventually I'm dreaming that I'd like to do an application development job (with the goal of having fun) as an individual.
Recommended Posts