Skip to content

Commit

Permalink
proxy support for most nsfw checkers
Browse files Browse the repository at this point in the history
  • Loading branch information
Bombg committed Oct 21, 2024
1 parent f312529 commit f905b44
Show file tree
Hide file tree
Showing 10 changed files with 62 additions and 20 deletions.
28 changes: 22 additions & 6 deletions DefaultConstants.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,18 @@ class Constants:
CONFESSION_COMMAND_ID = 1159423004346957835
CONFESS_REVIEW_COMMAND_ID = 1159423004346957834

KICK_PROXY = ""
FANS_PROXY = "127.0.0.1:8888"
OF_PROXY = ""
KICK_PROXY = "" #Chrome/Chromium doesn't support authenticated proxies
FANS_PROXY = "127.0.0.1:8888" #Chrome/Chromium doesn't support authenticated proxies
OF_PROXY = "" #Chrome/Chromium doesn't support authenticated proxies
#CB_PROXY = "" # Everything below assumed is a socks5 proxy. Commented out lines don't support proxies yet
MV_PROXY = ""
BC_PROXY = ""
SC_PROXY = ""
EP_PROXY = ""
CAM4_PROXY = ""
MFC_PROXY = ""
#YT_PROXY = ""
#TWITCH_PROXY = ""
else:
GUILD_ID =1058859922219081778 #Guild ID of the discord server
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
Expand All @@ -49,10 +57,18 @@ class Constants:
CONFESSION_COMMAND_ID = 1159321755270250571
CONFESS_REVIEW_COMMAND_ID = 1159321755270250570

KICK_PROXY = ""
FANS_PROXY = "127.0.0.1:8888"
OF_PROXY = ""
KICK_PROXY = "" #Chrome/Chromium doesn't support authenticated proxies
FANS_PROXY = "127.0.0.1:8888" #Chrome/Chromium doesn't support authenticated proxies
OF_PROXY = ""#Chrome/Chromium doesn't support authenticated proxies
#CB_PROXY = "" # Everything below assumed is a socks5 proxy
MV_PROXY = ""
BC_PROXY = ""
SC_PROXY = ""
EP_PROXY = ""
CAM4_PROXY = ""
MFC_PROXY = ""
#YT_PROXY = ""
#TWITCH_PROXY = ""

WAIT_BETWEEN_MESSAGES = 1800 # minimum amount of time in seconds the stream has to be offline before new notification messages.
MIN_TIME_BEFORE_AVATAR_CHANGE = 48 # Minimum time before avatar changes -- in hours
Expand Down
4 changes: 3 additions & 1 deletion README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,11 @@
4. If the requesting ip is in a state that requires age verification, some of these checkers wont work.

### Update History
- 10/20/2024
- 10/21/2024
- Added ManyVids Support
- Because of this many things have changed in Default/App Constants so they will need to be updated with new vars
- Added proxy support for most of the checkers. Anything that doesn't use nodriver will use socks5
- changed requirements update them with 'pip install -U -r requirements.txt'
- Change nodriver temp file behavior. Uses default behavior in windows
- 10/19/2024
- Improvements on Twitch checker to hopefully work more quickly
Expand Down
6 changes: 5 additions & 1 deletion checkers/Bongacams.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from utils.NoDriverBrowserCreator import getUserAgent
import logging
from utils.StaticMethods import GetThumbnail
from utils.StaticMethods import GetProxies

logger = logging.getLogger(__name__)
logger.setLevel(Constants.SASSBOT_LOG_LEVEL)
Expand All @@ -21,7 +22,10 @@ def isModelOnline(bcUserName):
agent = getUserAgent()
headers = {"User-Agent": agent}
try:
page = requests.get(f'https://bongacams.com/{bcUserName}',headers=headers)
if Constants.BC_PROXY:
page = requests.get(f'https://bongacams.com/{bcUserName}',headers=headers, proxies=GetProxies(Constants.BC_PROXY))
else:
page = requests.get(f'https://bongacams.com/{bcUserName}',headers=headers)
time.sleep(1)
if page.status_code == 200:
soup = BeautifulSoup(page.content, "html.parser")
Expand Down
6 changes: 5 additions & 1 deletion checkers/Cam4.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from utils.NoDriverBrowserCreator import getUserAgent
import logging
from utils.StaticMethods import GetThumbnail
from utils.StaticMethods import GetProxies

logger = logging.getLogger(__name__)
logger.setLevel(Constants.SASSBOT_LOG_LEVEL)
Expand All @@ -21,7 +22,10 @@ def isModelOnline(cam4UserName):
agent = getUserAgent()
try:
headers = {"User-Agent": agent}
results = requests.get(f"https://www.cam4.com/rest/v1.0/search/performer/{cam4UserName}", headers=headers)
if Constants.CAM4_PROXY:
results = requests.get(f"https://www.cam4.com/rest/v1.0/search/performer/{cam4UserName}", headers=headers, proxies=GetProxies(Constants.CAM4_PROXY))
else:
results = requests.get(f"https://www.cam4.com/rest/v1.0/search/performer/{cam4UserName}", headers=headers)
time.sleep(1)
try:
cam4Json = results.json()
Expand Down
9 changes: 8 additions & 1 deletion checkers/Eplay.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import json
import logging
from utils.StaticMethods import GetThumbnail
from utils.StaticMethods import GetProxies

logger = logging.getLogger(__name__)
logger.setLevel(Constants.SASSBOT_LOG_LEVEL)
Expand All @@ -18,13 +19,19 @@ def isModelOnline(epUserName):
tempThumbUrl = ""
icon = Constants.defaultIcon
try:
request = requests.get(f"https://eplay.com/{epUserName}")
if Constants.EP_PROXY:
request = requests.get(f"https://eplay.com/{epUserName}", proxies=GetProxies(Constants.EP_PROXY))
else:
request = requests.get(f"https://eplay.com/{epUserName}")
time.sleep(1)
soup = BeautifulSoup(request.content, "html.parser")
profileJson = soup.find_all("script", type="application/json")
profileJson = json.loads(profileJson[0].text)
isOnline = profileJson["props"]["pageProps"]["dehydratedState"]["queries"][0]["state"]["data"]["live"]
title = profileJson["props"]["pageProps"]["dehydratedState"]["queries"][0]["state"]["data"]["title"]
title = title.replace('\u200b', '')
title = title.replace('\r', '')
title = title.replace('\n', '')
tempThumbUrl = profileJson["props"]["pageProps"]["dehydratedState"]["queries"][0]["state"]["data"]["ss"] + "?" + str(int(time.time()))
icon = profileJson["props"]["pageProps"]["dehydratedState"]["queries"][0]["state"]["data"]["avatar"]
except requests.exceptions.ConnectTimeout:
Expand Down
10 changes: 2 additions & 8 deletions checkers/Manyvids.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
except ImportError:
from DefaultConstants import Constants as Constants
from utils.StaticMethods import GetThumbnail
from utils.StaticMethods import GetProxies
import logging
import re

Expand All @@ -18,7 +19,7 @@ def isModelOnline(mvUserName):
icon = Constants.defaultIcon
pageUrl = f"https://www.manyvids.com/live/cam/{mvUserName.lower()}"
if Constants.MV_PROXY:
page = requests.get(pageUrl, proxies=GetProxies())
page = requests.get(pageUrl, proxies=GetProxies(Constants.MV_PROXY))
else:
page = requests.get(pageUrl)
soup = BeautifulSoup(page.content, "html.parser")
Expand All @@ -40,10 +41,3 @@ def GetIcon(soup:BeautifulSoup, mvUserName):
if icon:
icon = icon.group()
return icon

def GetProxies():
proxies = {
'http': f'{Constants.MV_PROXY}',
'https': f'{Constants.MV_PROXY}',
}
return proxies
6 changes: 5 additions & 1 deletion checkers/Myfreecams.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from bs4 import BeautifulSoup
import logging
from utils.StaticMethods import GetThumbnail
from utils.StaticMethods import GetProxies

logger = logging.getLogger(__name__)
logger.setLevel(Constants.SASSBOT_LOG_LEVEL)
Expand All @@ -17,7 +18,10 @@ def isModelOnline(mfcUserName):
tempThumbUrl = ""
icon = Constants.defaultIcon
try:
request = requests.get(f"https://share.myfreecams.com/{mfcUserName}")
if Constants.MFC_PROXY:
request = requests.get(f"https://share.myfreecams.com/{mfcUserName}", proxies=GetProxies(Constants.MFC_PROXY))
else:
request = requests.get(f"https://share.myfreecams.com/{mfcUserName}")
time.sleep(1)
soup = BeautifulSoup(request.content, "html.parser")
vidPreview = soup.find(class_='campreview d-none')
Expand Down
6 changes: 5 additions & 1 deletion checkers/Stripchat.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from utils.NoDriverBrowserCreator import getUserAgent
import logging
from utils.StaticMethods import GetThumbnail
from utils.StaticMethods import GetProxies

logger = logging.getLogger(__name__)
logger.setLevel(Constants.SASSBOT_LOG_LEVEL)
Expand All @@ -20,7 +21,10 @@ def isModelOnline(scUserName):
agent = getUserAgent()
headers = {"User-Agent": agent}
try:
page = requests.get(f'https://stripchat.com/api/vr/v2/models/username/{scUserName}', headers=headers)
if Constants.SC_PROXY:
page = requests.get(f'https://stripchat.com/api/vr/v2/models/username/{scUserName}', headers=headers, proxies=GetProxies(Constants.SC_PROXY))
else:
page = requests.get(f'https://stripchat.com/api/vr/v2/models/username/{scUserName}', headers=headers)
time.sleep(1)
if page.status_code == 200:
try:
Expand Down
Binary file modified requirements.txt
Binary file not shown.
7 changes: 7 additions & 0 deletions utils/StaticMethods.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,3 +283,10 @@ def GetThumbnail(tempThumbUrl, constantsThumbnail):
thumbnail = tempThumbUrl

return thumbnail

def GetProxies(proxyIpPort):
proxies = {
'http': f'socks5://{proxyIpPort}',
'https': f'socks5://{proxyIpPort}'
}
return proxies

0 comments on commit f905b44

Please sign in to comment.