kboghdady / youTube_ads_4_pi-hole

YouTube script to add the new Ads list for Pi-hole
2.45k stars 266 forks source link

127.0.0.1 #44

Closed redfodex closed 4 years ago

redfodex commented 4 years ago

Hi. Can you please create a black.list file with 127.0.0.1 at the beginning of each line? I know that this can be done with scripts, but I'm not familiar with linux. I want to add this file to my router's openwrt hosts file. Thank you!

kboghdady commented 4 years ago

you can do it via python using this quick script

# opening the black list file 
blackList = open('black.list','r') 
newList =  open('newblack.list','w+') 
dnsList = blackList.split("\n") 

# adding 127.0.0.1 before each line from the black.list to newblack.list
for d in dnsList : 
      newList.write("127.0.0.1 "+ d +"\n") 

# closing both old and new files 
blackList.close()
newList.close()
kboghdady commented 4 years ago

good luck