|
|
| import re |
|
|
| def is_spam(message): |
| |
| spam_phrases = [ |
| "์ ์ค", "๊ด๊ณ ", "์์ต", "์ต๋ํ ์ธ", "ํ ์ธ์จ", "์ด์์ํ", "์ฐ๋", "์ ๋ฆฝ", |
| "์์์ผ๋ถํฐ", "์ฝ๋", "๋ฌด๋ฃ๊ฑฐ๋ถ", "ํ์ธํด์ฃผ์ธ์", "๊ด์ฐฐํด๋ณด์๋ฉด", "๋น ๋ฅด๊ณ ์ ์ํ๊ฒ", "์ ๋ฆฝ๊ธ", |
| "์ฐธ๊ฐํ๊ธฐ", "์
์ฅํ์์ฌ", "์ํ๊ฐ", "๋ฐ๋๋๋ค", "๋น๋ฐ๋ฒํธ", "์์์ผ", "๊ด์ ", "์ต์ ์ข
๋ชฉ ์ถ์ฒ", |
| "zxc.com", "๋ช
-๊ฐ", "๊ด์ o", "https://me2.kr", "์ด๋ฒ์ฃผ" |
| ] |
|
|
| |
| url_pattern = re.compile(r'https?:\/\/\S+|bit\.ly\/\S+|www\.[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)|์์น2019.com') |
| phone_pattern = re.compile(r'\d{2,4}\-\d{2,4}\-\d{2,4}|\d{10,13}') |
|
|
| |
| for phrase in spam_phrases: |
| if phrase in message: |
| return True |
| if url_pattern.search(message) or phone_pattern.search(message): |
| return True |
|
|
| |
| return False |
|
|