Skip to content

Commit

Permalink
Fixed Figma check (soxoj#1932)
Browse files Browse the repository at this point in the history
Fixed cookies bug
Improved self-check mode: don't disable sites because of check errors
  • Loading branch information
soxoj authored Dec 4, 2024
1 parent e701c88 commit cb9f01c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
13 changes: 10 additions & 3 deletions maigret/checking.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ async def check(self) -> Tuple[str, int, Optional[CheckError]]:
async with ClientSession(
connector=connector,
trust_env=True,
cookie_jar=self.cookie_jar.copy() if self.cookie_jar else None,
# TODO: tests
cookie_jar=self.cookie_jar if self.cookie_jar else None,
) as session:
html_text, status_code, error = await self._make_request(
session,
Expand Down Expand Up @@ -799,6 +800,7 @@ async def site_self_check(
proxy=None,
tor_proxy=None,
i2p_proxy=None,
skip_errors=False,
):
changes = {
"disabled": False,
Expand Down Expand Up @@ -850,8 +852,13 @@ async def site_self_check(
logger.warning(
f"Error while searching {username} in {site.name}: {result.context}, {msgs}, type {etype}"
)
# don't disable sites after the error
# meaning that the site could be available, but returned error for the check
# e.g. many sites protected by cloudflare and available in general
if skip_errors:
pass
# don't disable in case of available username
if status == QueryStatus.CLAIMED:
elif status == QueryStatus.CLAIMED:
changes["disabled"] = True
elif status == QueryStatus.CLAIMED:
logger.warning(
Expand Down Expand Up @@ -904,7 +911,7 @@ def disabled_count(lst):

for _, site in all_sites.items():
check_coro = site_self_check(
site, logger, sem, db, silent, proxy, tor_proxy, i2p_proxy
site, logger, sem, db, silent, proxy, tor_proxy, i2p_proxy, skip_errors=True
)
future = asyncio.ensure_future(check_coro)
tasks.append(future)
Expand Down
6 changes: 4 additions & 2 deletions maigret/resources/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -4960,6 +4960,9 @@
},
"Figma": {
"checkType": "message",
"headers": {
"User-Agent": "curl/8.6.0"
},
"presenceStrs": [
"twitter:title"
],
Expand All @@ -4973,8 +4976,7 @@
"alexaRank": 240,
"tags": [
"design"
],
"disabled": true
]
},
"8tracks.com": {
"checkType": "message",
Expand Down

0 comments on commit cb9f01c

Please sign in to comment.