Skip to content

Commit 7070f8f

Browse files
committed
adding proxy support for mv, temp file change for windows
1 parent c24404d commit 7070f8f

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

checkers/Manyvids.py

+14-2
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,16 @@ def isModelOnline(mvUserName):
1717
isOnline = False
1818
icon = Constants.defaultIcon
1919
pageUrl = f"https://www.manyvids.com/live/cam/{mvUserName.lower()}"
20-
page = requests.get(pageUrl)
20+
if Constants.MV_PROXY:
21+
page = requests.get(pageUrl, proxies=GetProxies())
22+
else:
23+
page = requests.get(pageUrl)
2124
soup = BeautifulSoup(page.content, "html.parser")
2225
onlineStatus = soup.find("div", {"class":"status_box__v1drl"})
2326
if onlineStatus:
2427
logger.debug(onlineStatus.text)
28+
else:
29+
logger.debug("no online status")
2530
if onlineStatus and (onlineStatus.text == "LIVE" or onlineStatus.text == "IN PRIVATE"):
2631
isOnline = True
2732
icon = GetIcon(soup, mvUserName)
@@ -34,4 +39,11 @@ def GetIcon(soup:BeautifulSoup, mvUserName):
3439
icon = re.search(reString, soup.prettify())
3540
if icon:
3641
icon = icon.group()
37-
return icon
42+
return icon
43+
44+
def GetProxies():
45+
proxies = {
46+
'http': f'{Constants.MV_PROXY}',
47+
'https': f'{Constants.MV_PROXY}',
48+
}
49+
return proxies

utils/NoDriverBrowserCreator.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,19 @@ async def GetBrowser(proxy=""):
5454
await asyncio.sleep(1 * Constants.NODRIVER_WAIT_MULTIPLIER)
5555
toSandbox = not IsRoot()
5656
toHeadless = False if platform.system() == "Linux" else True
57+
dataDir = "/ndTemp" if platform.system() == "Linux" else None
5758
if proxy:
5859
browser = await uc.start(sandbox=toSandbox,
5960
headless=toHeadless,
6061
browser_args=[f'--proxy-server={proxy}','--mute-audio','--disable-3d-apis','--disable-dev-shm-usage','--disable-gpu','--disable-blink-features=AutomationControlled'],
6162
retries = Constants.NODRIVER_BROWSER_CONNECT_RETRIES,
62-
user_data_dir="/ndTemp"
63+
user_data_dir=dataDir
6364
)
6465
else:
6566
browser = await uc.start(sandbox=toSandbox,
6667
headless=toHeadless,
6768
retries = Constants.NODRIVER_BROWSER_CONNECT_RETRIES,
68-
user_data_dir="/ndTemp"
69+
user_data_dir=dataDir
6970
)
7071
except Exception as e:
7172
logger.warning(f"error creating browser in GetBrowser: {e}")

0 commit comments

Comments
 (0)