-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
manyvids support, proxy support, requirements update, nodriver improv…
…emens, docker improvements
- Loading branch information
Showing
20 changed files
with
210 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,4 +19,5 @@ KickScreenshot.jpg | |
ofScreenshot.jpg | ||
NoDriverTest.py | ||
AppConstants.py | ||
tests | ||
tests | ||
.dockerignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,31 @@ | ||
# syntax=docker/dockerfile:1 | ||
FROM python:3.11.3-slim | ||
# Build Stage | ||
FROM python:3.11.3-slim AS build | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
# Install dependencies | ||
RUN apt update -y | ||
RUN apt install -y chromium xvfb git | ||
RUN apt update -y && apt install -y git | ||
|
||
WORKDIR /opt/SassBot | ||
COPY . . | ||
RUN python3 -m venv /venv | ||
ENV PATH=/venv/bin:$PATH | ||
|
||
# Clone repo and install requirements | ||
COPY requirements.txt . | ||
RUN pip install -r requirements.txt && \ | ||
pip install uvloop | ||
|
||
# Buidling final image, moving over venv | ||
FROM python:3.11.3-slim | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
WORKDIR /opt/SassBot | ||
|
||
RUN apt update -y && apt install -y --no-install-recommends chromium xvfb | ||
|
||
COPY --from=build /venv /venv | ||
ENV PATH=/venv/bin:$PATH | ||
|
||
COPY . . | ||
|
||
RUN chmod +x docker-entrypoint.sh | ||
|
||
ENTRYPOINT ["/bin/sh", "-c", "./docker-entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import requests | ||
from bs4 import BeautifulSoup | ||
try: | ||
from AppConstants import Constants as Constants | ||
except ImportError: | ||
from DefaultConstants import Constants as Constants | ||
from utils.StaticMethods import GetThumbnail | ||
from utils.StaticMethods import GetProxies | ||
import logging | ||
import re | ||
|
||
logger = logging.getLogger(__name__) | ||
logger.setLevel(Constants.SASSBOT_LOG_LEVEL) | ||
|
||
def isModelOnline(mvUserName): | ||
title = Constants.mvDefaultTitle | ||
tempThumbUrl = '' | ||
isOnline = False | ||
icon = Constants.defaultIcon | ||
pageUrl = f"https://www.manyvids.com/live/cam/{mvUserName.lower()}" | ||
if Constants.MV_PROXY: | ||
page = requests.get(pageUrl, proxies=GetProxies(Constants.MV_PROXY)) | ||
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) | ||
thumbUrl = GetThumbnail(tempThumbUrl, Constants.mvThumbnail) | ||
return isOnline, title, thumbUrl, icon | ||
|
||
def GetIcon(soup:BeautifulSoup, mvUserName): | ||
icon = Constants.defaultIcon | ||
reString = r"https:\/\/cdn5\.manyvids\.com\/php_uploads\/profile\/" + mvUserName + r"\/image\/cropped-image_\d+.jpeg" | ||
icon = re.search(reString, soup.prettify()) | ||
if icon: | ||
icon = icon.group() | ||
return icon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.