-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fallback for YouTube thumbnails #555
base: main
Are you sure you want to change the base?
Fallback for YouTube thumbnails #555
Conversation
Thank you for investigating this! While I haven't tested the solution live, my understanding is that for each talk card, we are querying the YouTube domain to verify the thumbnail image. Unfortunately, this approach might not be viable in production since it could severely impact performance. Given that only a small subset of talks have incorrect thumbnails, it doesn’t make sense to penalize all talk cards with an additional query. When I briefly explored the issue, I considered a frontend solution. However, since YouTube URLs return a valid image regardless of correctness, there's no error response we can leverage to display a fallback image easily. Here’s my current suggestion: |
Thanks for your response, @adrienpoly ! Have you thought about using cache to handle this? |
I started to look into caching the talk/card yes but this card is not that simple and it does require a bit a rework to improve it's cachability if your suggestion is to only cache the thumbnail check I think that would create a n+1 and also have a performance impact for the talk index views |
I was thinking about caching the whole card, but it’s a pity it’s so complicated. Since only a small subset of talks have incorrect thumbnails, do you still think it’s worth creating a background task to handle this? |
I was wondering if we can combine this we the API call we would be doing with #543 to check if the video has the appropriate thumbnails. Or is there no way to figure that out through the API? |
There are also the view_count and like that we could fetch from the API. This could justify to crawl regularly the YT api and add the thumbnail check if possible Part of it was added here #22 but we never really went further than just adding the API client |
Yes, we can use a HEAD request as it is in the PR
I like this! It will enable adding a filter or sort order to view the more popular talks |
97e3bb3
to
953a362
Compare
Why
What
Adds a method to check if the thumbnail is the generic YouTube thumbnail. It determines this by checking the image size.
![image](https://private-user-images.githubusercontent.com/1884898/400756548-2363430b-a04f-4ece-995f-1479eada4639.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk5MzYzNTEsIm5iZiI6MTczOTkzNjA1MSwicGF0aCI6Ii8xODg0ODk4LzQwMDc1NjU0OC0yMzYzNDMwYi1hMDRmLTRlY2UtOTk1Zi0xNDc5ZWFkYTQ2MzkucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxOSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTlUMDMzNDExWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ODQ3ZjZmMThmNDAwOWU1ZTBkNjZiZjk4OGFjNTNiYWYwZGYyMmRkNTViZTk2M2JmNTU5NTM0ZTY0MzVjODY1NiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.FU6mry6yA1suNRiqC9BnSM2wAgt7NuOPmTWxTvCjf8c)