Skip to content

Commit

Permalink
Update test.py
Browse files Browse the repository at this point in the history
Signed-off-by: Lukas Akdogan <lukas.akdogan@gmail.com>
  • Loading branch information
Swedenstyle34 authored Dec 30, 2023
1 parent 6dfa1cd commit e4f208e
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions test.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,19 @@
# Import the required modules
import os
import urllib.request

# Define the input and output file names
iurl = "https://raw.githubusercontent.com/nickspaargaren/no-google/master/google-domains"
of1 = "ads.txt"
of2 = "noads.txt"

# Define the prefixes and suffixes for the output lines
pwa="||" # prefix with ads
pwo="@@||" # prefix without ads
s1="^" # suffix

# Define the keywords for advertising links
ak=["googleads","doubleclick","adsense"] # ads keywords

# Initialize two sets to store the lines with and without advertising links
ads=set()
noads=set()

# Open the input file from the given URL and loop through each line
with urllib.request.urlopen(iurl)as if1:
for l1 in if1:
Expand All @@ -31,11 +26,9 @@
else:
# Add the line to the set without advertising links, with the prefix and suffix
noads.add(pwo+l1+s1)

# Sort the sets in alphabetical order and convert them to lists
ads=sorted(ads)
noads=sorted(noads)

# Write the sorted lines to the output files
with open(of1,"w")as of1:
of1.write("\n".join(ads))
Expand Down

0 comments on commit e4f208e

Please sign in to comment.