Closed jw-star closed 1 year ago
FROM ubuntu:jammy
MAINTAINER jwstar
ENV DEBIAN_FRONTEND=noninteractive
RUN mkdir /config \
&& mkdir /app && apt-get -y update \
&& apt-get install -y --no-install-recommends wget xz-utils python3.10 python3-pip python3.10-dev xvfb \
#安装amd64 ffmpeg二进制
&& wget https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz \
&& tar xvf ffmpeg-*.xz \
&& mv ffmpeg-*/ffmpeg /usr/bin/ \
&& rm -rf ffmpeg-* \
# 用完包管理器后安排打扫卫生可以显著的减少镜像大小 \
&& apt-get remove -y wget xz-utils --purge \
&& apt-get clean \
&& apt-get autoclean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
COPY . /app
RUN pip --no-cache-dir install --user -r /app/requirements.txt \
&& python3.10 -m playwright install --force chrome --with-deps \
&& apt-get autoremove -y \
&& apt-get remove -y python3-pip
WORKDIR /app
CMD ["/bin/bash", "-c", "set -e && xvfb-run python3.10 -u pornbot.py -s -screen 0 1920x1080x16"]
You can try pip install cf_clearance==0.28.1
, Version 0.28.1 can bypass, Under normal circumstances, frequent visits will also trigger captcha.
from playwright.async_api import async_playwright
from cf_clearance import async_stealth, async_cf_retry
async def test_cf_challenge(url: str):
async with async_playwright() as p:
browser = await p.chromium.launch(headless=False, proxy={"server": "socks5://localhost:7890"})
page = await browser.new_page()
await async_stealth(page, pure=True)
await page.goto(url)
res = await async_cf_retry(page)
if res:
cookies = await page.context.cookies()
for cookie in cookies:
if cookie.get('name') == 'cf_clearance':
cf_clearance_value = cookie.get('value')
print(cf_clearance_value)
ua = await page.evaluate('() => {return navigator.userAgent}')
print(ua)
else:
print("cf challenge fail")
await browser.close()
if __name__ == '__main__':
import asyncio
asyncio.run(test_cf_challenge("https://cableav.tv/"))
ok thanks, looks like i have to save cookies
Some pages can be bypassed ,some not working![image](https://user-images.githubusercontent.com/48782751/205477554-f0aefa9e-afc6-4480-b699-46d233e9b1a3.png)