Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
shadowban-eu-backend
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-eu-backend
Commits
a56e4369
Commit
a56e4369
authored
Jan 18, 2023
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix up search ban
parent
c92379b7
Pipeline
#19657
passed with stage
in 8 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
12 deletions
+47
-12
backend_requests.py
backend_requests.py
+47
-12
No files found.
backend_requests.py
View file @
a56e4369
...
...
@@ -58,18 +58,53 @@ def getTwitterSession():
return
twitter_b
def
doSearch
(
screen_name
,
twitter_b
):
return
None
#global isHealthy
#searchurl_v2 = "https://api.twitter.com/2/search/adaptive.json"
#params_v2 = {"q": "from:@{}".format(screen_name), "count": 1, "spelling_corrections": 0, "tweet_search_mode": "live"}
#response = twitter_b.get(searchurl_v2, params=params_v2)
#search_v2 = response.json()
#isHealthy = 'globalObjects' in search_v2
#if isHealthy:
# return search_v2["globalObjects"]["tweets"]
#else:
# print("Search error: " + response.text)
# return None
global
isHealthy
searchurl_v2
=
"https://api.twitter.com/2/search/adaptive.json"
params_v2
=
{
"q"
:
"from:@{}"
.
format
(
screen_name
),
"count"
:
1
,
# "spelling_corrections": 0,
"tweet_search_mode"
:
"live"
,
"include_profile_interstitial_type"
:
1
,
"include_blocked_by"
:
1
,
"include_blocking"
:
1
,
"include_followed_by"
:
1
,
"include_want_retweets"
:
1
,
"include_mute_edge"
:
1
,
"include_can_dm"
:
1
,
"include_can_media_tag"
:
1
,
"skip_status"
:
1
,
"cards_platform"
:
"Web-12"
,
"include_cards"
:
1
,
"include_ext_alt_text"
:
'true'
,
"include_quote_count"
:
'true'
,
"include_ext_limited_action_results"
:
'false'
,
"include_reply_count"
:
1
,
"tweet_mode"
:
"extended"
,
"include_ext_collab_control"
:
'false'
,
"include_ext_views"
:
'true'
,
"include_entities"
:
'true'
,
"include_user_entities"
:
'true'
,
"include_ext_media_color"
:
'true'
,
"include_ext_media_availability"
:
'true'
,
"include_ext_sensitive_media_warning"
:
'true'
,
"include_ext_trusted_friends_metadata"
:
'true'
,
"send_error_codes"
:
'true'
,
"simple_quoted_tweet"
:
'true'
,
"query_source"
:
"recent_search_click"
,
"pc"
:
1
,
"spelling_corrections"
:
1
,
"include_ext_edit_control"
:
'true'
,
"ext"
:
'mediaStats,highlightedLabel,hasNftAvatar,voiceInfo,birdwatchPivot,enrichments,superFollowMetadata,unmentionInfo,editControl,collab_control,vibe'
,
}
response
=
twitter_b
.
get
(
searchurl_v2
,
params
=
params_v2
)
search_v2
=
response
.
json
()
isHealthy
=
'globalObjects'
in
search_v2
if
isHealthy
:
return
search_v2
[
"globalObjects"
][
"tweets"
]
else
:
print
(
"Search error: "
+
response
.
text
)
return
None
@
app
.
route
(
'/_healthy'
)
def
healthy
():
...
...
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