Skip to content

Commit

Permalink
adding proxy support for mv, temp file change for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Bombg committed Oct 21, 2024
1 parent c24404d commit 7070f8f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
16 changes: 14 additions & 2 deletions checkers/Manyvids.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,16 @@ def isModelOnline(mvUserName):
isOnline = False
icon = Constants.defaultIcon
pageUrl = f"https://www.manyvids.com/live/cam/{mvUserName.lower()}"
page = requests.get(pageUrl)
if Constants.MV_PROXY:
page = requests.get(pageUrl, proxies=GetProxies())
else:
page = requests.get(pageUrl)
soup = BeautifulSoup(page.content, "html.parser")
onlineStatus = soup.find("div", {"class":"status_box__v1drl"})
if onlineStatus:
logger.debug(onlineStatus.text)
else:
logger.debug("no online status")
if onlineStatus and (onlineStatus.text == "LIVE" or onlineStatus.text == "IN PRIVATE"):
isOnline = True
icon = GetIcon(soup, mvUserName)
Expand All @@ -34,4 +39,11 @@ def GetIcon(soup:BeautifulSoup, mvUserName):
icon = re.search(reString, soup.prettify())
if icon:
icon = icon.group()
return icon
return icon

def GetProxies():
proxies = {
'http': f'{Constants.MV_PROXY}',
'https': f'{Constants.MV_PROXY}',
}
return proxies
5 changes: 3 additions & 2 deletions utils/NoDriverBrowserCreator.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,19 @@ async def GetBrowser(proxy=""):
await asyncio.sleep(1 * Constants.NODRIVER_WAIT_MULTIPLIER)
toSandbox = not IsRoot()
toHeadless = False if platform.system() == "Linux" else True
dataDir = "/ndTemp" if platform.system() == "Linux" else None
if proxy:
browser = await uc.start(sandbox=toSandbox,
headless=toHeadless,
browser_args=[f'--proxy-server={proxy}','--mute-audio','--disable-3d-apis','--disable-dev-shm-usage','--disable-gpu','--disable-blink-features=AutomationControlled'],
retries = Constants.NODRIVER_BROWSER_CONNECT_RETRIES,
user_data_dir="/ndTemp"
user_data_dir=dataDir
)
else:
browser = await uc.start(sandbox=toSandbox,
headless=toHeadless,
retries = Constants.NODRIVER_BROWSER_CONNECT_RETRIES,
user_data_dir="/ndTemp"
user_data_dir=dataDir
)
except Exception as e:
logger.warning(f"error creating browser in GetBrowser: {e}")
Expand Down

0 comments on commit 7070f8f

Please sign in to comment.