Thanks, it worked. Final code looks like this:
kirby()->hook('panel.page.update', function($page) {
if($page->template() == 'video') {
$imagedata = file_get_contents('http://img.youtube.com/vi/' . $page->youtube() . '/0.jpg');
file_put_contents($page->root() . DS . 'thumb.jpg', $imagedata);
}
});