Merge pull request #40 from yangrq1018/pr

fix: get phone from phone pool when ENABLE_IP_PROXY is False
This commit is contained in:
relakkes 2023-08-31 08:09:06 -05:00 committed by GitHub
commit 7698c41d51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -136,11 +136,11 @@ class XiaoHongShuCrawler(AbstractCrawler):
def create_proxy_info(self) -> Tuple[Optional[str], Optional[Dict], Optional[str]]:
"""Create proxy info for playwright and httpx"""
if not config.ENABLE_IP_PROXY:
return None, None, None
utils.logger.info("Begin proxy info for playwright and httpx ...")
# phone: 13012345671 ip_proxy: 111.122.xx.xx1:8888
phone, ip_proxy = self.account_pool.get_account()
if not config.ENABLE_IP_PROXY:
return phone, None, None
utils.logger.info("Begin proxy info for playwright and httpx ...")
playwright_proxy = {
"server": f"{config.IP_PROXY_PROTOCOL}{ip_proxy}",
"username": config.IP_PROXY_USER,