Skip to content

Commit f905b44

Browse files
committed
proxy support for most nsfw checkers
1 parent f312529 commit f905b44

10 files changed

+62
-20
lines changed

DefaultConstants.py

+22-6
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,18 @@ class Constants:
2424
CONFESSION_COMMAND_ID = 1159423004346957835
2525
CONFESS_REVIEW_COMMAND_ID = 1159423004346957834
2626

27-
KICK_PROXY = ""
28-
FANS_PROXY = "127.0.0.1:8888"
29-
OF_PROXY = ""
27+
KICK_PROXY = "" #Chrome/Chromium doesn't support authenticated proxies
28+
FANS_PROXY = "127.0.0.1:8888" #Chrome/Chromium doesn't support authenticated proxies
29+
OF_PROXY = "" #Chrome/Chromium doesn't support authenticated proxies
30+
#CB_PROXY = "" # Everything below assumed is a socks5 proxy. Commented out lines don't support proxies yet
3031
MV_PROXY = ""
32+
BC_PROXY = ""
33+
SC_PROXY = ""
34+
EP_PROXY = ""
35+
CAM4_PROXY = ""
36+
MFC_PROXY = ""
37+
#YT_PROXY = ""
38+
#TWITCH_PROXY = ""
3139
else:
3240
GUILD_ID =1058859922219081778 #Guild ID of the discord server
3341
whiteListedRoleIDs = [1062179283705020486,145802742647095296,1100148453792813086,245364417783398400] # IDs of Roles you wish to be white listed for some commands. You can also add user IDs if you want to add an individual without a role
@@ -49,10 +57,18 @@ class Constants:
4957
CONFESSION_COMMAND_ID = 1159321755270250571
5058
CONFESS_REVIEW_COMMAND_ID = 1159321755270250570
5159

52-
KICK_PROXY = ""
53-
FANS_PROXY = "127.0.0.1:8888"
54-
OF_PROXY = ""
60+
KICK_PROXY = "" #Chrome/Chromium doesn't support authenticated proxies
61+
FANS_PROXY = "127.0.0.1:8888" #Chrome/Chromium doesn't support authenticated proxies
62+
OF_PROXY = ""#Chrome/Chromium doesn't support authenticated proxies
63+
#CB_PROXY = "" # Everything below assumed is a socks5 proxy
5564
MV_PROXY = ""
65+
BC_PROXY = ""
66+
SC_PROXY = ""
67+
EP_PROXY = ""
68+
CAM4_PROXY = ""
69+
MFC_PROXY = ""
70+
#YT_PROXY = ""
71+
#TWITCH_PROXY = ""
5672

5773
WAIT_BETWEEN_MESSAGES = 1800 # minimum amount of time in seconds the stream has to be offline before new notification messages.
5874
MIN_TIME_BEFORE_AVATAR_CHANGE = 48 # Minimum time before avatar changes -- in hours

README.MD

+3-1
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,11 @@
9898
4. If the requesting ip is in a state that requires age verification, some of these checkers wont work.
9999

100100
### Update History
101-
- 10/20/2024
101+
- 10/21/2024
102102
- Added ManyVids Support
103103
- Because of this many things have changed in Default/App Constants so they will need to be updated with new vars
104+
- Added proxy support for most of the checkers. Anything that doesn't use nodriver will use socks5
105+
- changed requirements update them with 'pip install -U -r requirements.txt'
104106
- Change nodriver temp file behavior. Uses default behavior in windows
105107
- 10/19/2024
106108
- Improvements on Twitch checker to hopefully work more quickly

checkers/Bongacams.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from utils.NoDriverBrowserCreator import getUserAgent
1010
import logging
1111
from utils.StaticMethods import GetThumbnail
12+
from utils.StaticMethods import GetProxies
1213

1314
logger = logging.getLogger(__name__)
1415
logger.setLevel(Constants.SASSBOT_LOG_LEVEL)
@@ -21,7 +22,10 @@ def isModelOnline(bcUserName):
2122
agent = getUserAgent()
2223
headers = {"User-Agent": agent}
2324
try:
24-
page = requests.get(f'https://bongacams.com/{bcUserName}',headers=headers)
25+
if Constants.BC_PROXY:
26+
page = requests.get(f'https://bongacams.com/{bcUserName}',headers=headers, proxies=GetProxies(Constants.BC_PROXY))
27+
else:
28+
page = requests.get(f'https://bongacams.com/{bcUserName}',headers=headers)
2529
time.sleep(1)
2630
if page.status_code == 200:
2731
soup = BeautifulSoup(page.content, "html.parser")

checkers/Cam4.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from utils.NoDriverBrowserCreator import getUserAgent
1010
import logging
1111
from utils.StaticMethods import GetThumbnail
12+
from utils.StaticMethods import GetProxies
1213

1314
logger = logging.getLogger(__name__)
1415
logger.setLevel(Constants.SASSBOT_LOG_LEVEL)
@@ -21,7 +22,10 @@ def isModelOnline(cam4UserName):
2122
agent = getUserAgent()
2223
try:
2324
headers = {"User-Agent": agent}
24-
results = requests.get(f"https://www.cam4.com/rest/v1.0/search/performer/{cam4UserName}", headers=headers)
25+
if Constants.CAM4_PROXY:
26+
results = requests.get(f"https://www.cam4.com/rest/v1.0/search/performer/{cam4UserName}", headers=headers, proxies=GetProxies(Constants.CAM4_PROXY))
27+
else:
28+
results = requests.get(f"https://www.cam4.com/rest/v1.0/search/performer/{cam4UserName}", headers=headers)
2529
time.sleep(1)
2630
try:
2731
cam4Json = results.json()

checkers/Eplay.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import json
99
import logging
1010
from utils.StaticMethods import GetThumbnail
11+
from utils.StaticMethods import GetProxies
1112

1213
logger = logging.getLogger(__name__)
1314
logger.setLevel(Constants.SASSBOT_LOG_LEVEL)
@@ -18,13 +19,19 @@ def isModelOnline(epUserName):
1819
tempThumbUrl = ""
1920
icon = Constants.defaultIcon
2021
try:
21-
request = requests.get(f"https://eplay.com/{epUserName}")
22+
if Constants.EP_PROXY:
23+
request = requests.get(f"https://eplay.com/{epUserName}", proxies=GetProxies(Constants.EP_PROXY))
24+
else:
25+
request = requests.get(f"https://eplay.com/{epUserName}")
2226
time.sleep(1)
2327
soup = BeautifulSoup(request.content, "html.parser")
2428
profileJson = soup.find_all("script", type="application/json")
2529
profileJson = json.loads(profileJson[0].text)
2630
isOnline = profileJson["props"]["pageProps"]["dehydratedState"]["queries"][0]["state"]["data"]["live"]
2731
title = profileJson["props"]["pageProps"]["dehydratedState"]["queries"][0]["state"]["data"]["title"]
32+
title = title.replace('\u200b', '')
33+
title = title.replace('\r', '')
34+
title = title.replace('\n', '')
2835
tempThumbUrl = profileJson["props"]["pageProps"]["dehydratedState"]["queries"][0]["state"]["data"]["ss"] + "?" + str(int(time.time()))
2936
icon = profileJson["props"]["pageProps"]["dehydratedState"]["queries"][0]["state"]["data"]["avatar"]
3037
except requests.exceptions.ConnectTimeout:

checkers/Manyvids.py

+2-8
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
except ImportError:
66
from DefaultConstants import Constants as Constants
77
from utils.StaticMethods import GetThumbnail
8+
from utils.StaticMethods import GetProxies
89
import logging
910
import re
1011

@@ -18,7 +19,7 @@ def isModelOnline(mvUserName):
1819
icon = Constants.defaultIcon
1920
pageUrl = f"https://www.manyvids.com/live/cam/{mvUserName.lower()}"
2021
if Constants.MV_PROXY:
21-
page = requests.get(pageUrl, proxies=GetProxies())
22+
page = requests.get(pageUrl, proxies=GetProxies(Constants.MV_PROXY))
2223
else:
2324
page = requests.get(pageUrl)
2425
soup = BeautifulSoup(page.content, "html.parser")
@@ -40,10 +41,3 @@ def GetIcon(soup:BeautifulSoup, mvUserName):
4041
if icon:
4142
icon = icon.group()
4243
return icon
43-
44-
def GetProxies():
45-
proxies = {
46-
'http': f'{Constants.MV_PROXY}',
47-
'https': f'{Constants.MV_PROXY}',
48-
}
49-
return proxies

checkers/Myfreecams.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from bs4 import BeautifulSoup
88
import logging
99
from utils.StaticMethods import GetThumbnail
10+
from utils.StaticMethods import GetProxies
1011

1112
logger = logging.getLogger(__name__)
1213
logger.setLevel(Constants.SASSBOT_LOG_LEVEL)
@@ -17,7 +18,10 @@ def isModelOnline(mfcUserName):
1718
tempThumbUrl = ""
1819
icon = Constants.defaultIcon
1920
try:
20-
request = requests.get(f"https://share.myfreecams.com/{mfcUserName}")
21+
if Constants.MFC_PROXY:
22+
request = requests.get(f"https://share.myfreecams.com/{mfcUserName}", proxies=GetProxies(Constants.MFC_PROXY))
23+
else:
24+
request = requests.get(f"https://share.myfreecams.com/{mfcUserName}")
2125
time.sleep(1)
2226
soup = BeautifulSoup(request.content, "html.parser")
2327
vidPreview = soup.find(class_='campreview d-none')

checkers/Stripchat.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from utils.NoDriverBrowserCreator import getUserAgent
99
import logging
1010
from utils.StaticMethods import GetThumbnail
11+
from utils.StaticMethods import GetProxies
1112

1213
logger = logging.getLogger(__name__)
1314
logger.setLevel(Constants.SASSBOT_LOG_LEVEL)
@@ -20,7 +21,10 @@ def isModelOnline(scUserName):
2021
agent = getUserAgent()
2122
headers = {"User-Agent": agent}
2223
try:
23-
page = requests.get(f'https://stripchat.com/api/vr/v2/models/username/{scUserName}', headers=headers)
24+
if Constants.SC_PROXY:
25+
page = requests.get(f'https://stripchat.com/api/vr/v2/models/username/{scUserName}', headers=headers, proxies=GetProxies(Constants.SC_PROXY))
26+
else:
27+
page = requests.get(f'https://stripchat.com/api/vr/v2/models/username/{scUserName}', headers=headers)
2428
time.sleep(1)
2529
if page.status_code == 200:
2630
try:

requirements.txt

-22 Bytes
Binary file not shown.

utils/StaticMethods.py

+7
Original file line numberDiff line numberDiff line change
@@ -283,3 +283,10 @@ def GetThumbnail(tempThumbUrl, constantsThumbnail):
283283
thumbnail = tempThumbUrl
284284

285285
return thumbnail
286+
287+
def GetProxies(proxyIpPort):
288+
proxies = {
289+
'http': f'socks5://{proxyIpPort}',
290+
'https': f'socks5://{proxyIpPort}'
291+
}
292+
return proxies

0 commit comments

Comments
 (0)