Skip to content

Instantly share code, notes, and snippets.

@tml

tml/Dockerfile Secret

Created March 28, 2023 04:24
Embed
What would you like to do?
docker run --rm -it --shm-size=2g selenium-chrome bash
seluser@345b5a3e4b96:/app$ python3 jmike.py
seluser@345b5a3e4b96:/app$ cat download.log
```2023-03-28 04:22:43,444 DEBUG Started executable: `chromedriver` in a child process with pid: 10
2023-03-28 04:22:43,948 DEBUG POST http://localhost:34079/session {"capabilities": {"firstMatch": [{}], "alwaysMatch": {"browserName": "chrome", "pageLoadStrategy": "normal", "goog:chromeOptions": {"extensions": [], "args": ["--ignore-certificate-errors", "--ignore-ssl-errors", "--disable-dev-shm-usage", "--no-sandbox", "--headless"]}}}}
2023-03-28 04:22:43,949 DEBUG Starting new HTTP connection (1): localhost:34079
2023-03-28 04:22:44,247 DEBUG http://localhost:34079 "POST /session HTTP/1.1" 200 822
2023-03-28 04:22:44,247 DEBUG Remote response: status=200 | data={"value":{"capabilities":{"acceptInsecureCerts":false,"browserName":"chrome","browserVersion":"111.0.5563.110","chrome":{"chromedriverVersion":"111.0.5563.64 (c710e93d5b63b7095afe8c2c17df34408078439d-refs/branch-heads/5563@{#995})","userDataDir":"/tmp/.com.google.Chrome.66uLOY"},"goog:chromeOptions":{"debuggerAddress":"localhost:32919"},"networkConnectionEnabled":false,"pageLoadStrategy":"normal","platformName":"linux","proxy":{},"setWindowRect":true,"strictFileInteractability":false,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"unhandledPromptBehavior":"dismiss and notify","webauthn:extension:credBlob":true,"webauthn:extension:largeBlob":true,"webauthn:extension:minPinLength":true,"webauthn:extension:prf":true,"webauthn:virtualAuthenticators":true},"sessionId":"2c521cccd2640c4f1070216099044edf"}} | headers=HTTPHeaderDict({'Content-Length': '822', 'Content-Type': 'application/json; charset=utf-8', 'cache-control': 'no-cache'})
2023-03-28 04:22:44,248 DEBUG Finished Request
2023-03-28 04:22:44,248 DEBUG POST http://localhost:34079/session/2c521cccd2640c4f1070216099044edf/url {"url": "https://9gag.com/tag/funny/fresh"}
2023-03-28 04:22:44,510 DEBUG http://localhost:34079 "POST /session/2c521cccd2640c4f1070216099044edf/url HTTP/1.1" 200 14
2023-03-28 04:22:44,510 DEBUG Remote response: status=200 | data={"value":null} | headers=HTTPHeaderDict({'Content-Length': '14', 'Content-Type': 'application/json; charset=utf-8', 'cache-control': 'no-cache'})
2023-03-28 04:22:44,510 DEBUG Finished Request
2023-03-28 04:22:49,513 DEBUG POST http://localhost:34079/session/2c521cccd2640c4f1070216099044edf/execute/sync {"script": "window.scrollTo(0, document.body.scrollHeight);", "args": []}
2023-03-28 04:22:49,518 DEBUG http://localhost:34079 "POST /session/2c521cccd2640c4f1070216099044edf/execute/sync HTTP/1.1" 200 14
2023-03-28 04:22:49,519 DEBUG Remote response: status=200 | data={"value":null} | headers=HTTPHeaderDict({'Content-Length': '14', 'Content-Type': 'application/json; charset=utf-8', 'cache-control': 'no-cache'})
2023-03-28 04:22:49,519 DEBUG Finished Request
2023-03-28 04:22:51,521 DEBUG POST http://localhost:34079/session/2c521cccd2640c4f1070216099044edf/execute/sync {"script": "window.scrollTo(0, document.body.scrollHeight);", "args": []}
2023-03-28 04:22:51,525 DEBUG http://localhost:34079 "POST /session/2c521cccd2640c4f1070216099044edf/execute/sync HTTP/1.1" 200 14
2023-03-28 04:22:51,526 DEBUG Remote response: status=200 | data={"value":null} | headers=HTTPHeaderDict({'Content-Length': '14', 'Content-Type': 'application/json; charset=utf-8', 'cache-control': 'no-cache'})
2023-03-28 04:22:51,526 DEBUG Finished Request
2023-03-28 04:22:53,528 DEBUG POST http://localhost:34079/session/2c521cccd2640c4f1070216099044edf/execute/sync {"script": "window.scrollTo(0, document.body.scrollHeight);", "args": []}
2023-03-28 04:22:53,532 DEBUG http://localhost:34079 "POST /session/2c521cccd2640c4f1070216099044edf/execute/sync HTTP/1.1" 200 14
2023-03-28 04:22:53,532 DEBUG Remote response: status=200 | data={"value":null} | headers=HTTPHeaderDict({'Content-Length': '14', 'Content-Type': 'application/json; charset=utf-8', 'cache-control': 'no-cache'})
2023-03-28 04:22:53,532 DEBUG Finished Request
2023-03-28 04:23:00,538 DEBUG POST http://localhost:34079/session/2c521cccd2640c4f1070216099044edf/elements {"using": "xpath", "value": "//img[not(contains(@src, '.webm')) and contains(@style, 'height:') and substring-before(substring-after(@style, 'height:'), 'px') > 320]"}
2023-03-28 04:23:00,568 DEBUG http://localhost:34079 "POST /session/2c521cccd2640c4f1070216099044edf/elements HTTP/1.1" 200 12
2023-03-28 04:23:00,569 DEBUG Remote response: status=200 | data={"value":[]} | headers=HTTPHeaderDict({'Content-Length': '12', 'Content-Type': 'application/json; charset=utf-8', 'cache-control': 'no-cache'})
2023-03-28 04:23:00,570 DEBUG Finished Request
2023-03-28 04:23:00,570 DEBUG POST http://localhost:34079/session/2c521cccd2640c4f1070216099044edf/elements {"using": "css selector", "value": "video[not(contains(@src, '.webm')) and @height > 320]"}
2023-03-28 04:23:00,592 DEBUG http://localhost:34079 "POST /session/2c521cccd2640c4f1070216099044edf/elements HTTP/1.1" 400 937
2023-03-28 04:23:00,593 DEBUG Remote response: status=400 | data={"value":{"error":"invalid selector","message":"invalid selector: An invalid or illegal selector was specified\n (Session info: headless chrome=111.0.5563.110)","stacktrace":"#0 0x55d3eaa23243 \u003Cunknown>\n#1 0x55d3ea7e77a6 \u003Cunknown>\n#2 0x55d3ea7ead03 \u003Cunknown>\n#3 0x55d3ea7eaa72 \u003Cunknown>\n#4 0x55d3ea7ead8c \u003Cunknown>\n#5 0x55d3ea824221 \u003Cunknown>\n#6 0x55d3ea824761 \u003Cunknown>\n#7 0x55d3ea85fde1 \u003Cunknown>\n#8 0x55d3ea8450ad \u003Cunknown>\n#9 0x55d3ea85d932 \u003Cunknown>\n#10 0x55d3ea844e53 \u003Cunknown>\n#11 0x55d3ea8179ea \u003Cunknown>\n#12 0x55d3ea818b2e \u003Cunknown>\n#13 0x55d3eaa77d5e \u003Cunknown>\n#14 0x55d3eaa7ba80 \u003Cunknown>\n#15 0x55d3eaa5d8b0 \u003Cunknown>\n#16 0x55d3eaa7cb63 \u003Cunknown>\n#17 0x55d3eaa4ef75 \u003Cunknown>\n#18 0x55d3eaa9f998 \u003Cunknown>\n#19 0x55d3eaa9fb27 \u003Cunknown>\n#20 0x55d3eaabac23 \u003Cunknown>\n#21 0x7fe1f1915609 start_thread\n"}} | headers=HTTPHeaderDict({'Content-Length': '937', 'Content-Type': 'application/json; charset=utf-8', 'cache-control': 'no-cache'})
2023-03-28 04:23:00,593 DEBUG Finished Request
2023-03-28 04:23:00,593 ERROR An error occurred: Message: invalid selector: An invalid or illegal selector was specified
(Session info: headless chrome=111.0.5563.110)
Stacktrace:
#0 0x55d3eaa23243 <unknown>
#1 0x55d3ea7e77a6 <unknown>
#2 0x55d3ea7ead03 <unknown>
#3 0x55d3ea7eaa72 <unknown>
#4 0x55d3ea7ead8c <unknown>
#5 0x55d3ea824221 <unknown>
#6 0x55d3ea824761 <unknown>
#7 0x55d3ea85fde1 <unknown>
#8 0x55d3ea8450ad <unknown>
#9 0x55d3ea85d932 <unknown>
#10 0x55d3ea844e53 <unknown>
#11 0x55d3ea8179ea <unknown>
#12 0x55d3ea818b2e <unknown>
#13 0x55d3eaa77d5e <unknown>
#14 0x55d3eaa7ba80 <unknown>
#15 0x55d3eaa5d8b0 <unknown>
#16 0x55d3eaa7cb63 <unknown>
#17 0x55d3eaa4ef75 <unknown>
#18 0x55d3eaa9f998 <unknown>
#19 0x55d3eaa9fb27 <unknown>
#20 0x55d3eaabac23 <unknown>
#21 0x7fe1f1915609 start_thread
```
FROM selenium/standalone-chrome
USER root
RUN apt update && apt install -y python3-pip && python3 -m pip install selenium
WORKDIR /app
COPY jmike.py /app/jmike.py
RUN chown -Rv seluser /app
USER seluser
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment