added Hasaki crawler
This commit is contained in:
parent
30732aa065
commit
ed49c2e464
|
@ -92,12 +92,20 @@ class HasakiProductInfo:
|
||||||
for _ in range(retries):
|
for _ in range(retries):
|
||||||
try:
|
try:
|
||||||
with sync_playwright() as p:
|
with sync_playwright() as p:
|
||||||
browser = p.chromium.launch(headless=False)
|
browser = p.chromium.launch(
|
||||||
|
headless=False,
|
||||||
|
args=[
|
||||||
|
"--disable-dev-shm-usage",
|
||||||
|
"--disable-blink-features=AutomationControlled",
|
||||||
|
"--disable-component-extensions-with-background-pages"
|
||||||
|
]
|
||||||
|
)
|
||||||
ua = UserAgent(platforms='mobile')
|
ua = UserAgent(platforms='mobile')
|
||||||
random_mobile_ua = ua.random
|
random_mobile_ua = ua.random
|
||||||
logging.info("using user agent: {}".format(random_mobile_ua))
|
logging.info("using user agent: {}".format(random_mobile_ua))
|
||||||
|
|
||||||
context = browser.new_context(user_agent=random_mobile_ua)
|
context = browser.new_context(user_agent=random_mobile_ua)
|
||||||
|
context.add_init_script("Object.defineProperty(navigator, 'webdriver', {get: () => undefined})")
|
||||||
page = context.new_page()
|
page = context.new_page()
|
||||||
|
|
||||||
api_requests = {}
|
api_requests = {}
|
||||||
|
|
|
@ -6,12 +6,17 @@ import logging
|
||||||
|
|
||||||
|
|
||||||
with sync_playwright() as p:
|
with sync_playwright() as p:
|
||||||
browser = p.chromium.launch(headless=False)
|
browser = p.chromium.launch(headless=False, args=[
|
||||||
|
"--disable-dev-shm-usage",
|
||||||
|
"--disable-blink-features=AutomationControlled",
|
||||||
|
"--disable-component-extensions-with-background-pages"
|
||||||
|
])
|
||||||
ua = UserAgent(platforms='mobile')
|
ua = UserAgent(platforms='mobile')
|
||||||
random_mobile_ua = ua.random
|
random_mobile_ua = ua.random
|
||||||
logging.info("using user agent: {}".format(random_mobile_ua))
|
logging.info("using user agent: {}".format(random_mobile_ua))
|
||||||
|
|
||||||
context = browser.new_context(user_agent=random_mobile_ua)
|
context = browser.new_context(user_agent=random_mobile_ua)
|
||||||
|
context.add_init_script("Object.defineProperty(navigator, 'webdriver', {get: () => undefined})")
|
||||||
page = context.new_page()
|
page = context.new_page()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue