I've written a Python script that can be run as a cronjob or separately. It will search the logs for youtube advertisement queries and add them to the local blacklist automatically.
It also creates a file blocklist.txt for further use.
For now when I detect an ad I run the script manually over ssh. Otherwise it runs once a day.
You can find it here.
Hope this helps