Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
shadowban-revive
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
shadowban-revive
Commits
d4ac0fca
Commit
d4ac0fca
authored
May 28, 2025
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
doSearch use same session
parent
328ce5e3
Pipeline
#36922
passed with stages
in 1 minute and 49 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
10 deletions
+9
-10
main.py
main.py
+9
-10
No files found.
main.py
View file @
d4ac0fca
...
...
@@ -216,7 +216,7 @@ def extract_tweet(tweet):
return
None
async
def
doSearch
(
screen_name
:
str
)
->
Optional
[
List
[
dict
]]:
async
def
doSearch
(
screen_name
:
str
,
client
:
httpx
.
AsyncClient
)
->
Optional
[
List
[
dict
]]:
"""Port of `doSearch`; unchanged except for async/await & httpx."""
searchurl_v2
=
(
...
...
@@ -258,13 +258,12 @@ async def doSearch(screen_name: str) -> Optional[List[dict]]:
"fieldToggles"
:
json
.
dumps
({
"withArticleRichContentState"
:
False
}),
}
async
with
getTwitterSession
()
as
client
:
r
=
await
client
.
get
(
searchurl_v2
,
params
=
params_v2
)
try
:
data
=
r
.
json
()
except
ValueError
:
print
(
"Search Error parsing JSON:"
,
r
.
text
)
return
None
r
=
await
client
.
get
(
searchurl_v2
,
params
=
params_v2
)
try
:
data
=
r
.
json
()
except
ValueError
:
print
(
"Search Error parsing JSON:"
,
r
.
text
)
return
None
global
_is_healthy
_is_healthy
=
"data"
in
data
...
...
@@ -317,7 +316,7 @@ async def searchbanLogic(screen_name: str) -> tuple[dict, bool]:
# }
}
async
with
(
getTwitterSession
()
as
client
)
:
async
with
getTwitterSession
()
as
client
:
usertlurl
=
'https://x.com/i/api/graphql/oUZZZ8Oddwxs8Cd3iW3UEA/UserByScreenName'
params
=
{
'variables'
:
json
.
dumps
({
...
...
@@ -411,7 +410,7 @@ async def searchbanLogic(screen_name: str) -> tuple[dict, bool]:
if
returnjson
[
"tests"
][
"typeahead"
]
!=
True
:
print
(
"{} is search suggestion banned or errored, checking search ban."
.
format
(
screen_name
))
search_result
=
await
doSearch
(
screen_name
)
search_result
=
await
doSearch
(
screen_name
,
client
)
if
search_result
is
None
:
returnjson
[
"tests"
][
"search"
]
=
'_error'
hasFailure
=
True
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment