Bypass failed
jw-star opened this issue · 3 comments
jw-star commented
Some pages can be bypassed ,some not working
if browser is None:
p = await async_playwright().start()
browser = await p.chromium.launch(headless=False,
channel='chrome',
args=["--no-sandbox"])
page = await context.new_page()
await async_stealth(page, pure=True)
await page.goto(url, timeout=0)
res = await async_cf_retry(page)
await page.wait_for_timeout(1000 * 2)
``
jw-star commented
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"]
vvanglro commented
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/"))
jw-star commented
ok thanks, looks like i have to save cookies