tbh a database query to display the latest youtube video someone posted in a thread or a post would be horribly ugly.
You would need to go through ALL posts, take out the pagetext and search through it in order to find a youtube url.
I would advise you to search through articles instead. This query would be a lot easier since articles already have a column 'preview_object' or something, which is either empty or has a video in it.
And what you are looking for is probably not help in coding it, but someone who does code that modification, which would be a request best suited here:
https://vborg.vbsupport.ru/forumdisplay.php?f=112
That aside, i have seen modifikations around which provide 'youtube video databases' where users can link their youtube content. This would also have 'most recent videos' and 'most popular videos'.