Skip to content

Commit 474e36b

Browse files
authored
Merge pull request #33 from IMXEren/feat/browser
feat: improve browser to use pydoll
2 parents f5c0585 + 2f3f172 commit 474e36b

File tree

15 files changed

+581
-264
lines changed

15 files changed

+581
-264
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ LICENSE
66
README.md
77
docker-compose.yml
88
venv
9+
.venv

.github/workflows/build-artifact.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,10 @@ jobs:
114114
run: |
115115
if [[ "${{ inputs.CI_TEST }}" =~ ^(true|True|1)$ ]]; then
116116
echo "In CI Testing. Using local compose file."
117-
docker compose -f docker-compose-local.yml up --build
117+
docker compose -f docker-compose-local.yml up --build revanced
118118
else
119119
echo "Using Prod compose file."
120-
docker compose up --build
120+
docker compose up --build revanced
121121
fi
122122
- name: Upload Build APKS
123123
uses: actions/upload-artifact@main

Dockerfile

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,16 @@ RUN python -m pip install --no-cache-dir --upgrade pip && \
66
pip install --no-cache-dir -r requirements.txt
77

88
## Chrome dependencies
9-
RUN apt-get update -y && \
10-
apt-get install -y --no-install-recommends \
11-
curl gnupg2 unzip xvfb
9+
RUN apt-get update && apt-get install -y --no-install-recommends \
10+
gnupg unzip libx11-xcb1 \
11+
&& rm -rf /var/lib/apt/lists/*
1212

13-
# Install chrome and chromedriver
14-
COPY ./src/browser/setup_browser.sh /setup_chrome_webdriver.sh
15-
RUN sed -i 's/\r$//g' /setup_chrome_webdriver.sh && \
16-
sed -i 's/sudo\s//g' /setup_chrome_webdriver.sh
17-
RUN bash /setup_chrome_webdriver.sh
13+
# Install chrome
14+
COPY ./src/browser/setup_browser.sh /setup_browser.sh
15+
RUN sed -i 's/\r$//g' /setup_browser.sh && \
16+
sed -i 's/sudo\s//g' /setup_browser.sh && \
17+
chmod +x /setup_browser.sh && \
18+
/setup_browser.sh "google-chrome"
1819

1920
# Copy entrypoint script
2021
COPY ./entrypoint /entrypoint

docker-compose-local.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,29 @@ services:
55
dockerfile: Dockerfile
66
image: revanced-builder
77
container_name: revanced-builder
8+
depends_on:
9+
- display
10+
- novnc
11+
environment:
12+
- DISPLAY=display:0
813
env_file:
914
- .env
1015
volumes:
1116
- .:/app:z
17+
display:
18+
image: ghcr.io/dtinth/xtigervnc-docker:main
19+
tmpfs: /tmp
20+
restart: always
21+
environment:
22+
VNC_GEOMETRY: 1920x1080
23+
ports:
24+
- 127.0.0.1:5900:5900
25+
- 127.0.0.1:6000:6000
26+
novnc:
27+
image: geek1011/easy-novnc
28+
restart: always
29+
depends_on:
30+
- display
31+
command: -a :5800 -h display --no-url-password
32+
ports:
33+
- 127.0.0.1:5800:5800

docker-compose.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,29 @@ services:
33
image: imxeren/docker-py-revanced
44
container_name: revanced-builder
55
pull_policy: always
6+
depends_on:
7+
- display
8+
# - novnc
9+
environment:
10+
- DISPLAY=display:0
611
env_file:
712
- .env
813
volumes:
914
- .:/app:z
15+
display:
16+
image: ghcr.io/dtinth/xtigervnc-docker:main
17+
tmpfs: /tmp
18+
restart: always
19+
environment:
20+
VNC_GEOMETRY: 1920x1080
21+
ports:
22+
- 127.0.0.1:5900:5900
23+
- 127.0.0.1:6000:6000
24+
novnc:
25+
image: geek1011/easy-novnc
26+
restart: always
27+
depends_on:
28+
- display
29+
command: -a :5800 -h display --no-url-password
30+
ports:
31+
- 127.0.0.1:5800:5800

entrypoint

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,7 @@ set -o pipefail
55
set -o nounset
66

77

8-
## Ref: https://github.com/Ulyssedev/Rust-undetected-chromedriver/blob/7da3bea/xvfb.sh
9-
## Set up the Display for XVFB server,
10-
## to support running Chrome in headful mode
11-
export DISPLAY=:99
12-
function keepUpScreen() {
13-
echo "Running keepUpScreen() [Xvfb Server]"
14-
while true; do
15-
sleep .25
16-
if [ -z $(pidof Xvfb) ]; then
17-
Xvfb $DISPLAY -screen $DISPLAY 1280x1024x24 -ac +extension GLX +render -noreset &
18-
## PyVirtualDisplay is another alternative to manage
19-
## running the server from the code itself.
20-
fi;
21-
done;
22-
}
23-
24-
## Starting the XVFB server in background
25-
keepUpScreen &
26-
278
## Browser tests
289
# python src/browser/test.py
10+
2911
python main.py

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ packaging==24.2
88
pre-commit==4.2.0
99
python-dotenv==1.1.0
1010
requests==2.32.4
11-
selenium-driverless==1.9.4
1211
tqdm==4.67.1
12+
pydoll-python==2.15.1

src/browser/apkmirror.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class APKMirror(Site):
1515
def __init__(self: Self, browser: Browser) -> None:
1616
super().__init__(browser)
1717

18-
async def get(self: Self, url: str, timeout: float) -> Source: # noqa: D102
18+
async def get(self: Self, url: str, timeout: int) -> Source: # noqa: ASYNC109, D102
1919
return await super().get(url, timeout)
2020

2121
async def check_if_loaded(self: Self) -> bool: # noqa: D102

0 commit comments

Comments
 (0)