Skip to content

Commit 4c0f276

Browse files
committed
fixed MFC, SC, BC checkers, attempt to fix fd leak
1 parent 3547b34 commit 4c0f276

10 files changed

+27
-9
lines changed

NoDriverBrowserCreator.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ def getUserAgent():
3535
page = requests.get('https://jnrbsn.github.io/user-agents/user-agents.json')
3636
userAgentsJson = page.json()
3737
userAgent = random.choice(userAgentsJson)
38+
page.close()
3839
except:
3940
print("Trouble getting user agent from jnrbsn's github. Using default")
4041
return userAgent
@@ -50,7 +51,7 @@ async def GetBrowser(proxy=""):
5051
if proxy:
5152
browser = await uc.start(sandbox=toSandbox,
5253
headless=toHeadless,
53-
browser_args=[f'--proxy-server={proxy}'],
54+
browser_args=[f'--proxy-server={proxy}','--mute-audio','--disable-3d-apis','--disable-dev-shm-usage','--disable-gpu','--disable-blink-features=AutomationControlled'],
5455
retries = Constants.NODRIVER_BROWSER_CONNECT_RETRIES)
5556
else:
5657
browser = await uc.start(sandbox=toSandbox,

README.MD

+3
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,11 @@
8181
1. If multiple accounts are streaming on the same platform at the same time, /rebroadcast will only show an announcement for one of the accounts.
8282
2. Cam4 api ban your IP if you make too many calls from the same ip. May need to switch methods in the future.
8383
3. Fansly will 404 you for a period of time if you make too many requests from the same ip
84+
4. If you are in a state that requires age verification, some of these checkers wont work.
8485

8586
### Update History
87+
- 10/3/2024
88+
- Fixed MFC, SC, BC checkers
8689
- 9/24/2024
8790
- Checkers that once used selenium now use nodriver instead. Chromedriver no longer required or supported
8891
- works with Chromium as well as Chrome. Other browsers are untested.

checkers/Bongacams.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@
33
from bs4 import BeautifulSoup
44
import json
55
from Constants import Constants
6+
from NoDriverBrowserCreator import getUserAgent
67

78
def isModelOnline(bcUserName):
89
title = Constants.bcDefaultTitle
910
thumbUrl = ''
1011
isOnline = False
1112
icon = 'images/errIcon.png'
12-
page = requests.get(f'https://bongacams.com/{bcUserName}')
13+
agent = getUserAgent()
14+
headers = {"User-Agent": agent}
15+
page = requests.get(f'https://bongacams.com/{bcUserName}',headers=headers)
1316
time.sleep(1)
1417
if page.status_code == 200:
1518
soup = BeautifulSoup(page.content, "html.parser")
@@ -28,6 +31,7 @@ def isModelOnline(bcUserName):
2831
icon = bcJson['chatHeaderOptions']['profileImage']
2932
icon = "https:" + icon
3033
isOnline = not bcJson['chatShowStatusOptions']['isOffline']
34+
page.close()
3135
return isOnline, title, thumbUrl, icon
3236

3337

checkers/Cam4.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,24 @@
33
import json.decoder
44
import time
55
from Constants import Constants
6+
from NoDriverBrowserCreator import getUserAgent
67

78
def isModelOnline(cam4UserName):
89
title = Constants.cam4DefaultTitle
910
thumbUrl = ''
1011
isOnline = False
1112
icon = 'images/errIcon.png'
13+
agent = getUserAgent()
1214
try:
13-
headers = {"User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:75.0) Gecko/20100101 Firefox/75.0"}
15+
headers = {"User-Agent": agent}
1416
results = requests.get(f"https://www.cam4.com/rest/v1.0/search/performer/{cam4UserName}", headers=headers)
1517
time.sleep(1)
1618
try:
1719
cam4Json = results.json()
1820
if cam4Json['online']:
1921
isOnline = True
2022
icon = cam4Json['profileImageUrl']
23+
results.close()
2124
except json.decoder.JSONDecodeError:
2225
print("cam4 api didn't respond?")
2326
except requests.exceptions.ConnectTimeout:

checkers/Chaturbate.py

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ def isModelOnline(cbUserName):
2828
results = onlineModels.json()["results"]
2929
count = onlineModels.json()['count']
3030
iterations = iterations + 1
31+
onlineModels.close()
3132
except json.decoder.JSONDecodeError:
3233
print("cb api didn't respond")
3334
return isOnline, title, thumbUrl, icon

checkers/Eplay.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def isModelOnline(epUserName):
1919
title = profileJson["props"]["pageProps"]["dehydratedState"]["queries"][0]["state"]["data"]["title"]
2020
thumbUrl = profileJson["props"]["pageProps"]["dehydratedState"]["queries"][0]["state"]["data"]["ss"]
2121
icon = profileJson["props"]["pageProps"]["dehydratedState"]["queries"][0]["state"]["data"]["avatar"]
22-
22+
request.close()
2323
except requests.exceptions.ConnectTimeout:
2424
print("connection timed out to eplay.com. Bot detection or rate limited?")
2525
return isOnline, title, thumbUrl, icon

checkers/Myfreecams.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ def isModelOnline(mfcUserName):
1212
request = requests.get(f"https://share.myfreecams.com/{mfcUserName}")
1313
time.sleep(1)
1414
soup = BeautifulSoup(request.content, "html.parser")
15-
vidPreview = soup.find(class_='campreview-link')
15+
vidPreview = soup.find(class_='campreview d-none')
1616
if vidPreview:
1717
isOnline = True
1818
icon = soup.find(class_='avatar online').find("img")['src'] if soup.find(class_='avatar online') else soup.find(class_='avatar').find("img")['src']
19+
request.close()
1920
except requests.exceptions.ConnectTimeout:
2021
print("connection timed out to share.myfreecams.com. Bot detection or rate limited?")
2122
return isOnline, title, thumbUrl, icon

checkers/Stripchat.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,25 @@
22
import json
33
import time
44
from Constants import Constants
5+
from NoDriverBrowserCreator import getUserAgent
56

67
def isModelOnline(scUserName):
78
title = Constants.scDefaultTitle
89
thumbUrl = ''
910
isOnline = False
1011
icon = 'images/errIcon.png'
11-
headers = {"User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:75.0) Gecko/20100101 Firefox/75.0"}
12-
scJson = requests.get(f'https://stripchat.com/api/vr/v2/models/username/{scUserName}', headers=headers)
12+
agent = getUserAgent()
13+
headers = {"User-Agent": agent}
14+
page = requests.get(f'https://stripchat.com/api/vr/v2/models/username/{scUserName}', headers=headers)
1315
time.sleep(1)
14-
if scJson.status_code == 200:
16+
if page.status_code == 200:
1517
try:
16-
scJson = scJson.json()
18+
scJson = page.json()
1719
isOnline = True if scJson['model']['status'] != 'off' else False
1820
icon = scJson['model']['avatarUrl']
1921
title = scJson['goal']['description'] if scJson['goal']['description'] else Constants.scDefaultTitle
2022
thumbUrl = scJson['model']['previewUrl']
2123
except json.decoder.JSONDecodeError:
2224
pass
25+
page.close()
2326
return isOnline, title, thumbUrl, icon

checkers/Twitch.py

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ def isModelOnline(twitchChannelName):
2323
isOnlineJson = twitchJson['@graph'][0]['publication']['isLiveBroadcast']
2424
if isOnlineJson and thumbUrl == thumbUrlReq.url:
2525
isOnline = True
26+
page.close()
2627
return isOnline, title, thumbUrl, icon
2728

2829
def getTwitchJson(soup):

checkers/Youtube.py

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ def isModelOnline(ytUserName):
2424
icon = iconJson['contents']['twoColumnWatchNextResults']['results']['results']['contents'][1]['videoSecondaryInfoRenderer']['owner']['videoOwnerRenderer']['thumbnail']['thumbnails'][0]['url']
2525
else:
2626
print("can't get yt icon")
27+
page.close()
2728
return online,title, thumbUrl, icon
2829

2930
def getIconJson(scripts):

0 commit comments

Comments
 (0)