blocare trackere
This commit is contained in:
@@ -397,6 +397,21 @@ class BTGoScraper:
|
|||||||
)
|
)
|
||||||
|
|
||||||
context = browser.new_context(viewport={'width': 1920, 'height': 1080})
|
context = browser.new_context(viewport={'width': 1920, 'height': 1080})
|
||||||
|
|
||||||
|
# Blocheaza trackere care fac polling continuu pe homepage BT si
|
||||||
|
# pun renderer-ul la 80-100% CPU pe hardware slab. Nu sunt folosite
|
||||||
|
# de aplicatia BT, doar de marketing.
|
||||||
|
blocked_hosts = (
|
||||||
|
'googletagmanager.com', 'google-analytics.com',
|
||||||
|
'doubleclick.net', 'facebook.com', 'facebook.net',
|
||||||
|
'linkedin.com', 'licdn.com', 'omniconvert.com',
|
||||||
|
'hotjar.com', 'clarity.ms',
|
||||||
|
)
|
||||||
|
context.route(
|
||||||
|
lambda url: any(host in url for host in blocked_hosts),
|
||||||
|
lambda route: route.abort(),
|
||||||
|
)
|
||||||
|
|
||||||
self.page = context.new_page()
|
self.page = context.new_page()
|
||||||
logging.info(f"Browser lansat (headless={self.config.HEADLESS})")
|
logging.info(f"Browser lansat (headless={self.config.HEADLESS})")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user