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
9e65bf45
Commit
9e65bf45
authored
Jun 02, 2024
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update search suggestion ban thing
parent
c2a36243
Pipeline
#27423
passed with stages
in 48 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
8 deletions
+11
-8
backend_requests.py
backend_requests.py
+11
-8
No files found.
backend_requests.py
View file @
9e65bf45
...
@@ -91,7 +91,7 @@ def getTwitterSession(specifyCookie = None):
...
@@ -91,7 +91,7 @@ def getTwitterSession(specifyCookie = None):
def
doSearch
(
screen_name
):
def
doSearch
(
screen_name
):
global
isHealthy
global
isHealthy
twitter_b
=
getTwitterSession
()
twitter_b
=
getTwitterSession
()
searchurl_v2
=
"https://
twitter
.com/i/api/graphql/nK1dw4oV3k4w5TdtcAdSww/SearchTimeline"
searchurl_v2
=
"https://
x
.com/i/api/graphql/nK1dw4oV3k4w5TdtcAdSww/SearchTimeline"
params_v2
=
{
params_v2
=
{
"features"
:
json
.
dumps
({
"features"
:
json
.
dumps
({
"rweb_lists_timeline_redesign_enabled"
:
True
,
"rweb_lists_timeline_redesign_enabled"
:
True
,
...
@@ -162,7 +162,7 @@ def checkCookies():
...
@@ -162,7 +162,7 @@ def checkCookies():
if
response
.
status_code
==
200
:
if
response
.
status_code
==
200
:
return
True
return
True
usertlurl
=
'https://
twitter
.com/i/api/graphql/oUZZZ8Oddwxs8Cd3iW3UEA/UserByScreenName'
usertlurl
=
'https://
x
.com/i/api/graphql/oUZZZ8Oddwxs8Cd3iW3UEA/UserByScreenName'
screen_name
=
'Sena_n_Karin'
screen_name
=
'Sena_n_Karin'
params
=
{
params
=
{
'variables'
:
json
.
dumps
({
'variables'
:
json
.
dumps
({
...
@@ -275,7 +275,7 @@ def searchban(screen_name):
...
@@ -275,7 +275,7 @@ def searchban(screen_name):
# check whether the user has any tweets
# check whether the user has any tweets
#usertlurl = "https://api.twitter.com/1.1/statuses/user_timeline.json"
#usertlurl = "https://api.twitter.com/1.1/statuses/user_timeline.json"
#params = {"screen_name": screen_name, "count": 200}
#params = {"screen_name": screen_name, "count": 200}
usertlurl
=
'https://
twitter
.com/i/api/graphql/oUZZZ8Oddwxs8Cd3iW3UEA/UserByScreenName'
usertlurl
=
'https://
x
.com/i/api/graphql/oUZZZ8Oddwxs8Cd3iW3UEA/UserByScreenName'
params
=
{
params
=
{
'variables'
:
json
.
dumps
({
'variables'
:
json
.
dumps
({
'screen_name'
:
screen_name
,
'screen_name'
:
screen_name
,
...
@@ -358,11 +358,14 @@ def searchban(screen_name):
...
@@ -358,11 +358,14 @@ def searchban(screen_name):
# return returnjson
# return returnjson
print
(
"Checking search suggestion banned of {}"
.
format
(
screen_name
))
print
(
"Checking search suggestion banned of {}"
.
format
(
screen_name
))
suggestions
=
twitter_b
.
get
(
"https://api.twitter.com/1.1/search/typeahead.json?src=search_box&result_type=users&q=@"
+
screen_name
)
.
json
()
suggestions
=
twitter_b
.
get
(
"https://x.com/i/api/1.1/search/typeahead.json?include_ext_is_blue_verified=1&include_ext_verified_type=1&include_ext_profile_image_shape=1&src=search_box&result_type=users&q=@"
+
screen_name
)
.
json
()
print
(
"Suggestions: "
+
str
(
suggestions
))
try
:
try
:
returnjson
[
"tests"
][
"typeahead"
]
=
len
([
1
for
user
in
suggestions
[
"users"
]
if
user
[
"screen_name"
]
.
lower
()
==
screen_name
.
lower
()])
>
0
returnjson
[
"tests"
][
"typeahead"
]
=
len
([
1
for
user
in
suggestions
[
"users"
]
if
user
[
"screen_name"
]
.
lower
()
==
screen_name
.
lower
()])
>
0
except
:
except
:
returnjson
[
"tests"
][
"typeahead"
]
=
False
hasFailure
=
True
print
(
"Error checking typeahead of {}"
.
format
(
screen_name
))
returnjson
[
"tests"
][
"typeahead"
]
=
'_error'
if
returnjson
[
"tests"
][
"typeahead"
]
==
False
:
if
returnjson
[
"tests"
][
"typeahead"
]
==
False
:
print
(
"{} is search suggestion banned, checking search ban."
.
format
(
screen_name
))
print
(
"{} is search suggestion banned, checking search ban."
.
format
(
screen_name
))
...
@@ -422,7 +425,7 @@ def searchban(screen_name):
...
@@ -422,7 +425,7 @@ def searchban(screen_name):
replies
=
None
replies
=
None
try
:
try
:
replies
=
twitter_b
.
get
(
"https://
twitter
.com/i/api/graphql/{}/{}"
.
format
(
ENDPOINT
[
"UserTweetsAndReplies"
],
"UserTweetsAndReplies"
),
params
=
get_reply_param
)
replies
=
twitter_b
.
get
(
"https://
x
.com/i/api/graphql/{}/{}"
.
format
(
ENDPOINT
[
"UserTweetsAndReplies"
],
"UserTweetsAndReplies"
),
params
=
get_reply_param
)
ghostban
=
True
ghostban
=
True
ghostTweetId
=
None
ghostTweetId
=
None
ghostReplyId
=
None
ghostReplyId
=
None
...
@@ -464,7 +467,7 @@ def searchban(screen_name):
...
@@ -464,7 +467,7 @@ def searchban(screen_name):
"withSuperFollowsTweetFields"
:
False
,
"withSuperFollowsTweetFields"
:
False
,
"withVoice"
:
False
,
"withVoice"
:
False
,
}
}
tweetdetails
=
twitter_b
.
get
(
"https://
twitter
.com/i/api/graphql/{}/{}"
.
format
(
ENDPOINT
[
"TweetDetail"
],
"TweetDetail"
),
params
=
{
"variables"
:
json
.
dumps
(
tweet_detail_vars
),
"features"
:
FeaturesJson
})
tweetdetails
=
twitter_b
.
get
(
"https://
x
.com/i/api/graphql/{}/{}"
.
format
(
ENDPOINT
[
"TweetDetail"
],
"TweetDetail"
),
params
=
{
"variables"
:
json
.
dumps
(
tweet_detail_vars
),
"features"
:
FeaturesJson
})
tweetData
=
tweetdetails
.
json
()[
"data"
]
tweetData
=
tweetdetails
.
json
()[
"data"
]
if
"threaded_conversation_with_injections"
not
in
tweetData
:
if
"threaded_conversation_with_injections"
not
in
tweetData
:
continue
continue
...
@@ -491,7 +494,7 @@ def searchban(screen_name):
...
@@ -491,7 +494,7 @@ def searchban(screen_name):
# showmore = True
# showmore = True
cursor_vars
=
tweet_detail_vars
cursor_vars
=
tweet_detail_vars
cursor_vars
[
"cursor"
]
=
ent
[
"content"
][
"itemContent"
][
"value"
]
cursor_vars
[
"cursor"
]
=
ent
[
"content"
][
"itemContent"
][
"value"
]
cursor
=
twitter_b
.
get
(
"https://
twitter
.com/i/api/graphql/{}/{}"
.
format
(
ENDPOINT
[
"TweetDetail"
],
"TweetDetail"
),
params
=
{
"variables"
:
json
.
dumps
(
cursor_vars
),
"features"
:
FeaturesJson
})
cursor
=
twitter_b
.
get
(
"https://
x
.com/i/api/graphql/{}/{}"
.
format
(
ENDPOINT
[
"TweetDetail"
],
"TweetDetail"
),
params
=
{
"variables"
:
json
.
dumps
(
cursor_vars
),
"features"
:
FeaturesJson
})
cursor_insts
=
cursor
.
json
()[
"data"
][
"threaded_conversation_with_injections"
][
"instructions"
]
cursor_insts
=
cursor
.
json
()[
"data"
][
"threaded_conversation_with_injections"
][
"instructions"
]
for
c_i
in
cursor_insts
:
for
c_i
in
cursor_insts
:
...
...
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