Skip to content

Commit

Permalink
Update main.py
Browse files Browse the repository at this point in the history
  • Loading branch information
akku1139 authored Aug 18, 2024
1 parent aecac7e commit 42899e3
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions scripts/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
def out(text):
outfile.write(text + "\n")

out("! YouTube spam comment filter for Japanese")
out("! Homepage: https://github.com/akku1139/YouTube-spammer-filter")
out("! Title: YouTube spam comment filter for Japanese")

def make(filename, comment, func):
out("\n! " + comment)
Expand All @@ -15,12 +16,12 @@ def make(filename, comment, func):
continue
if line.startswith("#"):
continue
out("www.youtube.com" + func(line.strip()))
out("www.youtube.com###sections " + func(line.strip()))

make("channels.txt", "spammer channels", lambda line: ("##a[href=\"/" + urllib.parse.quote(line.removeprefix("/").removesuffix("\n"), safe="@") + "\"]:upward(6)"))
make("channels.txt", "spammer channels", lambda line: ("a[href=\"/" + urllib.parse.quote(line.removeprefix("/").removesuffix("\n"), safe="@") + "\"]:upward(6)"))

make("words.txt", "spam words", lambda line: ("###content-text>span:has-text(/" + line + "/):upward(5)"))
make("words.txt", "spam words", lambda line: ("#content-text>span:has-text(/" + line + "/):upward(5)"))

make("templates.txt", "template comments", lambda line: ("###content-text>span:has-text(\"" + line + "\"):upward(5)"))
make("templates.txt", "template comments", lambda line: ("#content-text>span:has-text(\"" + line + "\"):upward(5)"))

outfile.close()

0 comments on commit 42899e3

Please sign in to comment.