File size: 1,383 Bytes
75b51d1
 
 
 
 
84e89cd
75b51d1
84e89cd
75b51d1
 
 
 
 
 
 
 
 
2b58625
75b51d1
2b58625
75b51d1
2b58625
 
75b51d1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2b58625
75b51d1
 
 
56f2975
75b51d1
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import time
import requests
import random
import string
from bs4 import BeautifulSoup
import os

WEBHOOK_URL = os.environ['web']
BASE_URL = "https://discord.nfp.is/"
VIDEO_CHECK_INTERVAL = 1

def generate_random_string(length=3):
    return ''.join(random.choices(string.ascii_letters, k=length))

def send_webhook_message(video_link):
    data = {
        "content": video_link
    }
    response = requests.post(WEBHOOK_URL, json=data)

    if response.status_code != 204:
        return

def check_site_content(url, random_string):
    try:
        response = requests.get(url)
        if response.status_code == 200:
            soup = BeautifulSoup(response.content, 'html.parser')
            pre_tag = soup.find('pre')
            if pre_tag and random_string in pre_tag.text:
                return True
        return False
    except requests.RequestException as e:
        return False

def main():
    while True:
        try:
            random_string = generate_random_string()
            video_link = BASE_URL + random_string

            if check_site_content(video_link, random_string):
                send_webhook_message(video_link)
            else:
                print(f"this shit {video_link} does not exist")

            time.sleep(VIDEO_CHECK_INTERVAL)
        except Exception as e:
            print(f"error {e}")

if __name__ == "__main__":
    main()