How to add blacklists from a file

So I found this script from foae which aimed to block YT ads,https://github.com/foae/pihole-youtube-block, but it won't write the domains it sees to the adlists. Now I just realized that they should be written to blacklists, so yea. So where is the file of blacklists, and do you know any tutorials on how to add items from a list into the blacklist? Thanks!

In the gravity database in V5.0. In /etc/pihole/blacklist.txt in V4 and earlier.

I assume you are running Pi-hole V5, or you wouldn't be asking this question.

https://docs.pi-hole.net/database/gravity/example/

where is the database file? Also I think you misunderstood my last question. So I have a file of websites I want to be automaticly add into the blocklist.

/etc/pihole/gravity.db

Perhaps I didn't understand your question. First, you wrote about a script that would add blacklists from a file, presumably to block YouTube ads.

Now you want to add URL's of blocklists? These are two competely different things.

Which is it?

Sorry for wrong wording. So if you look at https://github.com/foae/pihole-youtube-block it says it will output a list of urls like compiled_domains.txt (305 Bytes) I want to add these domains into the blacklist using a script or cron, but I don't know how to write one. Also, which program do I use to edit gravity.db?

These are not URL's, these are domains. Let's take a look at what constitutes a URL:

https://cnn.com/electionresults/index/2020

https is the protocol

cnn.com is the domain

everything after that is a path on the domain.

In your list, everything is a domain, and these would be added to the blacklist.

r2---sn-ni5f-ttjz.googlevideo.com
r4---sn-vgqsknlz.googlevideo.com
r1---sn-ni5f-ttjs.googlevideo.com
r4---sn-ni5f-ttjz.googlevideo.com
r3---sn-ni5f-ttjz.googlevideo.com
r2---sn-ni5f-ttjs.googlevideo.com
r1---sn-ni5f-ttjz.googlevideo.com
r3---sn-ni5f-ttjs.googlevideo.com
r4---sn-ni5f-ttjs.googlevideo.com

Your best approach might be to use something that already works with Pi-hole V5. This thread may be of interest:

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.