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
a322b59a
Commit
a322b59a
authored
Dec 22, 2022
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
handle cases with no tweets found
parent
90f622dd
Pipeline
#18765
passed with stage
in 34 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
28 deletions
+36
-28
backend_requests.py
backend_requests.py
+36
-28
No files found.
backend_requests.py
View file @
a322b59a
...
...
@@ -249,6 +249,7 @@ def searchban(screen_name):
# print(replies.text)
try
:
foundTweet
=
False
ghostban
=
True
ghostTweetId
=
None
ghostReplyId
=
None
...
...
@@ -265,6 +266,7 @@ def searchban(screen_name):
if
"in_reply_to_status_id_str"
in
tmp
:
reply
=
tmp
tweetId
=
reply
[
"in_reply_to_status_id_str"
]
foundTweet
=
True
if
ghostTweetId
is
None
:
ghostTweetId
=
tweetId
ghostReplyId
=
reply
[
"id_str"
]
...
...
@@ -328,34 +330,40 @@ def searchban(screen_name):
print
(
"{} is reply deboosted because of {} => {}."
.
format
(
screen_name
,
tweetId
,
replyId
))
showmore
=
True
break
if
ghostban
:
print
(
"{} is ghost banned."
.
format
(
screen_name
))
returnjson
[
"tests"
][
"ghost"
]
=
{
"ban"
:
True
,
"tweet"
:
ghostTweetId
,
"in_reply_to"
:
ghostReplyId
}
if
not
showmore
:
returnjson
[
"tests"
][
"more_replies"
]
=
{
"ban"
:
False
,
"in_reply_to"
:
showmoreReplyId
,
"tweet"
:
showmoreTweetId
}
# No search ban || more replies => No ghost ban
if
returnjson
[
"tests"
][
"search"
]
and
returnjson
[
"tests"
][
"search"
]
!=
"_error"
and
"ban"
in
returnjson
[
"tests"
][
"ghost"
]
and
returnjson
[
"tests"
][
"ghost"
][
"ban"
]
==
True
or
"ban"
in
returnjson
[
"tests"
][
"more_replies"
]
and
returnjson
[
"tests"
][
"more_replies"
][
"ban"
]
==
True
:
returnjson
[
"tests"
][
"ghost"
]
=
{
"ban"
:
False
,
"tweet"
:
ghostTweetId
,
"in_reply_to"
:
ghostReplyId
}
# No ghost ban && unknown more replies => No more replies ban
if
"ban"
not
in
returnjson
[
"tests"
][
"more_replies"
]
and
"ban"
in
returnjson
[
"tests"
][
"ghost"
]
and
returnjson
[
"tests"
][
"ghost"
][
"ban"
]
==
False
:
returnjson
[
"tests"
][
"more_replies"
]
=
{
"ban"
:
False
,
"in_reply_to"
:
showmoreReplyId
,
"tweet"
:
showmoreTweetId
}
if
foundTweet
:
if
ghostban
:
print
(
"{} is ghost banned."
.
format
(
screen_name
))
returnjson
[
"tests"
][
"ghost"
]
=
{
"ban"
:
True
,
"tweet"
:
ghostTweetId
,
"in_reply_to"
:
ghostReplyId
}
if
not
showmore
:
print
(
"{} is not reply deboosted."
.
format
(
screen_name
))
returnjson
[
"tests"
][
"more_replies"
]
=
{
"ban"
:
False
,
"in_reply_to"
:
showmoreReplyId
,
"tweet"
:
showmoreTweetId
}
# No search ban || more replies => No ghost ban
if
returnjson
[
"tests"
][
"search"
]
and
returnjson
[
"tests"
][
"search"
]
!=
"_error"
and
"ban"
in
returnjson
[
"tests"
][
"ghost"
]
and
returnjson
[
"tests"
][
"ghost"
][
"ban"
]
==
True
or
"ban"
in
returnjson
[
"tests"
][
"more_replies"
]
and
returnjson
[
"tests"
][
"more_replies"
][
"ban"
]
==
True
:
returnjson
[
"tests"
][
"ghost"
]
=
{
"ban"
:
False
,
"tweet"
:
ghostTweetId
,
"in_reply_to"
:
ghostReplyId
}
# No ghost ban && unknown more replies => No more replies ban
if
"ban"
not
in
returnjson
[
"tests"
][
"more_replies"
]
and
"ban"
in
returnjson
[
"tests"
][
"ghost"
]
and
returnjson
[
"tests"
][
"ghost"
][
"ban"
]
==
False
:
returnjson
[
"tests"
][
"more_replies"
]
=
{
"ban"
:
False
,
"in_reply_to"
:
showmoreReplyId
,
"tweet"
:
showmoreTweetId
}
else
:
print
(
"No replies found for {}."
.
format
(
screen_name
))
returnjson
[
"tests"
][
"ghost"
]
=
{}
returnjson
[
"tests"
][
"more_replies"
]
=
{}
except
KeyError
as
e
:
print
(
"Errored testing {}"
.
format
(
screen_name
))
print
(
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