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
c92379b7
Commit
c92379b7
authored
Jan 13, 2023
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tmp bad
parent
0a2b143e
Pipeline
#19457
passed with stage
in 26 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
13 deletions
+16
-13
backend_requests.py
backend_requests.py
+16
-13
No files found.
backend_requests.py
View file @
c92379b7
...
...
@@ -45,6 +45,7 @@ FeaturesDict = {
"responsive_web_twitter_blue_verified_badge_is_enabled"
:
False
,
"view_counts_public_visibility_enabled"
:
False
,
"view_counts_everywhere_api_enabled"
:
False
,
"longform_notetweets_consumption_enabled"
:
False
,
}
FeaturesJson
=
json
.
dumps
(
FeaturesDict
)
...
...
@@ -57,16 +58,18 @@ def getTwitterSession():
return
twitter_b
def
doSearch
(
screen_name
,
twitter_b
):
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"
}
search_v2
=
twitter_b
.
get
(
searchurl_v2
,
params
=
params_v2
)
.
json
()
isHealthy
=
'globalObjects'
in
search_v2
if
isHealthy
:
return
search_v2
[
"globalObjects"
][
"tweets"
]
else
:
print
(
"Rate limit occurred, marking as unavailable."
)
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
@
app
.
route
(
'/_healthy'
)
def
healthy
():
...
...
@@ -246,7 +249,6 @@ def searchban(screen_name):
}
get_reply_param
=
param
=
{
"variables"
:
json
.
dumps
(
get_reply_vars
),
"features"
:
FeaturesJson
}
replies
=
twitter_b
.
get
(
"https://twitter.com/i/api/graphql/{}/{}"
.
format
(
ENDPOINT
[
"UserTweetsAndReplies"
],
"UserTweetsAndReplies"
),
params
=
get_reply_param
)
# print(replies.text)
try
:
ghostban
=
True
...
...
@@ -373,6 +375,7 @@ def searchban(screen_name):
except
KeyError
as
e
:
print
(
"Errored testing {}"
.
format
(
screen_name
))
print
(
e
)
print
(
"Response: "
+
replies
.
text
)
returnjson
[
"tests"
][
"ghost"
]
=
{}
returnjson
[
"tests"
][
"more_replies"
]
=
{}
...
...
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