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
2ea5f4a3
Commit
2ea5f4a3
authored
Feb 16, 2022
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make reply not none
parent
ea8cdbfb
Pipeline
#9701
passed with stage
in 26 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
82 additions
and
77 deletions
+82
-77
backend_requests.py
backend_requests.py
+82
-77
No files found.
backend_requests.py
View file @
2ea5f4a3
...
...
@@ -192,84 +192,89 @@ def searchban(screen_name):
reply
=
tmp
# print("Found a reply!", tmp["full_text"])
break
tweet_detail_vars
=
{
"focalTweetId"
:
reply
[
"in_reply_to_status_id_str"
],
"includePromotedContent"
:
False
,
"withBirdwatchNotes"
:
False
,
"withSuperFollowsUserFields"
:
False
,
"withDownvotePerspective"
:
False
,
"withReactionsMetadata"
:
False
,
"withReactionsPerspective"
:
False
,
"withSuperFollowsTweetFields"
:
False
,
"withVoice"
:
False
,
"__fs_interactive_text"
:
False
,
"__fs_responsive_web_uc_gql_enabled"
:
False
,
"__fs_dont_mention_me_view_api_enabled"
:
False
}
tweetdetails
=
twitter_b
.
get
(
"https://twitter.com/i/api/graphql/{}/{}"
.
format
(
ENDPOINT
[
"TweetDetail"
],
"TweetDetail"
),
params
=
{
"variables"
:
json
.
dumps
(
tweet_detail_vars
)})
insts
=
tweetdetails
.
json
()[
"data"
][
"threaded_conversation_with_injections"
][
"instructions"
]
showmore
=
False
for
inst
in
insts
:
if
inst
[
"type"
]
==
"TimelineAddEntries"
:
for
ent
in
inst
[
"entries"
]:
print
(
"Current entry of {} is: {}"
.
format
(
screen_name
,
ent
[
"entryId"
]))
if
ent
[
"entryId"
]
.
startswith
(
"conversationthread"
):
ghostban
=
True
for
item
in
ent
[
"content"
][
"items"
]:
if
"tweet_results"
in
item
[
"item"
][
"itemContent"
]
and
item
[
"item"
][
"itemContent"
][
"tweet_results"
][
"result"
][
"legacy"
][
"user_id_str"
]
==
user_id
:
returnjson
[
"tests"
][
"ghost"
]
=
{
"ban"
:
False
}
ghostban
=
False
break
if
ghostban
:
print
(
"{} is ghost banned."
.
format
(
screen_name
))
returnjson
[
"tests"
][
"ghost"
]
=
{
"ban"
:
True
}
if
ent
[
"entryId"
]
.
startswith
(
"cursor-bottom"
):
print
(
"{}'s test touched bottom."
.
format
(
screen_name
))
#returnjson["tests"]["ghost"] = {}
#returnjson["tests"]["more_replies"] = {}
break
if
ent
[
"entryId"
]
.
startswith
(
"cursor-showmorethreadsprompt"
):
showmore
=
True
cursor_vars
=
tweet_detail_vars
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
)})
cursor_insts
=
cursor
.
json
()[
"data"
][
"threaded_conversation_with_injections"
][
"instructions"
]
for
c_i
in
cursor_insts
:
if
c_i
[
"type"
]
==
"TimelineAddEntries"
:
if
len
(
c_i
[
"entries"
])
==
0
:
returnjson
[
"tests"
][
"more_replies"
]
=
{
"ban"
:
True
}
break
for
c_ent
in
c_i
[
"entries"
]:
if
c_ent
[
"entryId"
]
.
startswith
(
"conversationthread"
):
more
=
True
print
(
"Checking more contents of {}"
.
format
(
screen_name
))
for
c_item
in
c_ent
[
"content"
][
"items"
]:
if
c_item
[
"item"
][
"itemContent"
][
"tweet_results"
][
"result"
][
"legacy"
][
"user_id_str"
]
==
user_id
:
returnjson
[
"tests"
][
"ghost"
]
=
{
"ban"
:
False
}
returnjson
[
"tests"
][
"more_replies"
]
=
{
"ban"
:
True
,
"tweet"
:
reply
[
"id_str"
],
"in_reply_to"
:
c_item
[
"item"
][
"itemContent"
][
"tweet_results"
][
"result"
][
"legacy"
][
"id_str"
]}
print
(
"{} is reply deboosted."
.
format
(
screen_name
))
more
=
False
break
if
more
:
print
(
"{} is both ghost banned and reply deboosted."
.
format
(
screen_name
))
returnjson
[
"tests"
][
"ghost"
]
=
{
"ban"
:
True
}
returnjson
[
"tests"
][
"more_replies"
]
=
{
"ban"
:
True
}
if
not
showmore
:
returnjson
[
"tests"
][
"more_replies"
]
=
{
"ban"
:
False
,
"in_reply_to"
:
"-1"
,
"tweet"
:
"-1"
if
reply
is
None
:
returnjson
[
"tests"
][
"ghost"
]
=
{}
returnjson
[
"tests"
][
"more_replies"
]
=
{}
else
:
tweet_detail_vars
=
{
"focalTweetId"
:
reply
[
"in_reply_to_status_id_str"
],
"includePromotedContent"
:
False
,
"withBirdwatchNotes"
:
False
,
"withSuperFollowsUserFields"
:
False
,
"withDownvotePerspective"
:
False
,
"withReactionsMetadata"
:
False
,
"withReactionsPerspective"
:
False
,
"withSuperFollowsTweetFields"
:
False
,
"withVoice"
:
False
,
"__fs_interactive_text"
:
False
,
"__fs_responsive_web_uc_gql_enabled"
:
False
,
"__fs_dont_mention_me_view_api_enabled"
:
False
}
tweetdetails
=
twitter_b
.
get
(
"https://twitter.com/i/api/graphql/{}/{}"
.
format
(
ENDPOINT
[
"TweetDetail"
],
"TweetDetail"
),
params
=
{
"variables"
:
json
.
dumps
(
tweet_detail_vars
)})
insts
=
tweetdetails
.
json
()[
"data"
][
"threaded_conversation_with_injections"
][
"instructions"
]
showmore
=
False
for
inst
in
insts
:
if
inst
[
"type"
]
==
"TimelineAddEntries"
:
for
ent
in
inst
[
"entries"
]:
print
(
"Current entry of {} is: {}"
.
format
(
screen_name
,
ent
[
"entryId"
]))
if
ent
[
"entryId"
]
.
startswith
(
"conversationthread"
):
ghostban
=
True
for
item
in
ent
[
"content"
][
"items"
]:
if
"tweet_results"
in
item
[
"item"
][
"itemContent"
]
and
item
[
"item"
][
"itemContent"
][
"tweet_results"
][
"result"
][
"legacy"
][
"user_id_str"
]
==
user_id
:
returnjson
[
"tests"
][
"ghost"
]
=
{
"ban"
:
False
}
ghostban
=
False
break
if
ghostban
:
print
(
"{} is ghost banned."
.
format
(
screen_name
))
returnjson
[
"tests"
][
"ghost"
]
=
{
"ban"
:
True
}
if
ent
[
"entryId"
]
.
startswith
(
"cursor-bottom"
):
print
(
"{}'s test touched bottom."
.
format
(
screen_name
))
#returnjson["tests"]["ghost"] = {}
#returnjson["tests"]["more_replies"] = {}
break
if
ent
[
"entryId"
]
.
startswith
(
"cursor-showmorethreadsprompt"
):
showmore
=
True
cursor_vars
=
tweet_detail_vars
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
)})
cursor_insts
=
cursor
.
json
()[
"data"
][
"threaded_conversation_with_injections"
][
"instructions"
]
for
c_i
in
cursor_insts
:
if
c_i
[
"type"
]
==
"TimelineAddEntries"
:
if
len
(
c_i
[
"entries"
])
==
0
:
returnjson
[
"tests"
][
"more_replies"
]
=
{
"ban"
:
True
}
break
for
c_ent
in
c_i
[
"entries"
]:
if
c_ent
[
"entryId"
]
.
startswith
(
"conversationthread"
):
more
=
True
print
(
"Checking more contents of {}"
.
format
(
screen_name
))
for
c_item
in
c_ent
[
"content"
][
"items"
]:
if
c_item
[
"item"
][
"itemContent"
][
"tweet_results"
][
"result"
][
"legacy"
][
"user_id_str"
]
==
user_id
:
returnjson
[
"tests"
][
"ghost"
]
=
{
"ban"
:
False
}
returnjson
[
"tests"
][
"more_replies"
]
=
{
"ban"
:
True
,
"tweet"
:
reply
[
"id_str"
],
"in_reply_to"
:
c_item
[
"item"
][
"itemContent"
][
"tweet_results"
][
"result"
][
"legacy"
][
"id_str"
]}
print
(
"{} is reply deboosted."
.
format
(
screen_name
))
more
=
False
break
if
more
:
print
(
"{} is both ghost banned and reply deboosted."
.
format
(
screen_name
))
returnjson
[
"tests"
][
"ghost"
]
=
{
"ban"
:
True
}
returnjson
[
"tests"
][
"more_replies"
]
=
{
"ban"
:
True
}
if
not
showmore
:
returnjson
[
"tests"
][
"more_replies"
]
=
{
"ban"
:
False
,
"in_reply_to"
:
"-1"
,
"tweet"
:
"-1"
}
except
KeyError
as
e
:
print
(
"Errored testing {}"
.
format
(
screen_name
))
print
(
Exception
.
with_traceback
(
e
))
...
...
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