commit
268f5b9159
@ -0,0 +1,112 @@
|
||||
|
||||
|
||||
captcha.jpg
|
||||
|
||||
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
MANIFEST
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
.hypothesis/
|
||||
.pytest_cache/
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
local_settings.py
|
||||
db.sqlite3
|
||||
|
||||
# Flask stuff:
|
||||
instance/
|
||||
.webassets-cache
|
||||
|
||||
# Scrapy stuff:
|
||||
.scrapy
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
target/
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
# pyenv
|
||||
.python-version
|
||||
|
||||
# celery beat schedule file
|
||||
celerybeat-schedule
|
||||
|
||||
# SageMath parsed files
|
||||
*.sage.py
|
||||
|
||||
# Environments
|
||||
.env
|
||||
.venv
|
||||
env/
|
||||
venv/
|
||||
ENV/
|
||||
env.bak/
|
||||
venv.bak/
|
||||
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
.spyproject
|
||||
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
|
||||
# mkdocs documentation
|
||||
/site
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
|
||||
# add
|
||||
.idea/
|
@ -0,0 +1,11 @@
|
||||
[conf]
|
||||
proxy = socks5://localhost:7890
|
||||
headless = 1
|
||||
interval = 1000
|
||||
username = vj.zhzh.dbb.d.udhj.db@gmail.com
|
||||
password = Nijigasaki27
|
||||
cookie =
|
||||
|
||||
[seat]
|
||||
seats = d1 1층 FLOOR 4구역 8열 2번,d2 1층 4구역 7열 4번
|
||||
|
@ -0,0 +1,69 @@
|
||||
|
||||
import time
|
||||
import traceback
|
||||
|
||||
from loguru import logger
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.chrome.options import Options
|
||||
from selenium.webdriver.common.by import By
|
||||
|
||||
from ocr import DdddOcr
|
||||
|
||||
# code by wlt233 | for LoveLive! Series AsiaTour 2024
|
||||
# 2024.11.10 | v0.1
|
||||
# ref: https://www.ticketlink.co.kr/global/zh/product/51390
|
||||
|
||||
def get_cookie(username, password, headless):
|
||||
try:
|
||||
ocr = DdddOcr(origin_onnx_path="./data/common_old.onnx", show_ad=False)
|
||||
ocr.set_ranges(2)
|
||||
|
||||
options = Options()
|
||||
options.headless = headless
|
||||
driver = webdriver.Chrome(chrome_options=options,
|
||||
executable_path="./data/chromedriver.exe")
|
||||
driver.get("https://www.ticketlink.co.kr/global/zh/product/51390")
|
||||
driver.find_element(by=By.ID,value="loginBtn").click()
|
||||
time.sleep(3)
|
||||
|
||||
driver.switch_to.window(driver.window_handles[-1])
|
||||
driver.find_element(by=By.ID,value="id").send_keys(username)
|
||||
driver.find_element(by=By.ID,value="pw").send_keys(password)
|
||||
driver.find_element(by=By.ID,value="loginBtn").click()
|
||||
time.sleep(3)
|
||||
|
||||
driver.switch_to.window(driver.window_handles[-1])
|
||||
driver.get("https://www.ticketlink.co.kr/global/zh/reserve/plan/schedule/1740993756")
|
||||
|
||||
driver.find_element(by=By.ID,value="captcha_img").screenshot("./data/captcha.jpg")
|
||||
with open("./data/captcha.jpg", "rb") as f:
|
||||
img = f.read()
|
||||
result = str(ocr.classification(img)).upper()
|
||||
logger.info(f"验证码:{result}")
|
||||
driver.find_element(by=By.ID,value="ipt_captcha").send_keys(result)
|
||||
driver.find_element(by=By.CLASS_NAME,value="btn_submit").click()
|
||||
time.sleep(1)
|
||||
error_cls = driver.execute_script("return document.getElementsByClassName('txt_error')[0].getAttribute('class');")
|
||||
while not "ng-hide" in error_cls:
|
||||
driver.execute_script("document.getElementsByClassName('btn_refresh')[2].click();")
|
||||
time.sleep(1)
|
||||
driver.find_element(by=By.ID,value="captcha_img").screenshot("./data/captcha.jpg")
|
||||
with open("./data/captcha.jpg", "rb") as f:
|
||||
img = f.read()
|
||||
result = str(ocr.classification(img)).upper()
|
||||
logger.info(f"验证码:{result}")
|
||||
driver.find_element(by=By.ID,value="ipt_captcha").send_keys(result)
|
||||
driver.find_element(by=By.CLASS_NAME,value="btn_submit").click()
|
||||
time.sleep(1)
|
||||
error_cls = driver.execute_script("return document.getElementsByClassName('txt_error')[0].getAttribute('class');")
|
||||
|
||||
cookies = driver.execute_script("return document.cookie;")
|
||||
return cookies
|
||||
except Exception as e:
|
||||
logger.error(f"{e} {e.args}\n{traceback.format_exc()}")
|
||||
return ""
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
get_cookie("vj.zhzh.dbb.d.udhj.db@gmail.com", "Nijigasaki27", False)
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue