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
1e268b41
Commit
1e268b41
authored
May 28, 2025
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
better logic
parent
4a329d55
Pipeline
#36917
passed with stages
in 59 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
9 deletions
+16
-9
backend_requests.py
backend_requests.py
+16
-9
No files found.
backend_requests.py
View file @
1e268b41
...
@@ -210,7 +210,12 @@ def checkCookies():
...
@@ -210,7 +210,12 @@ def checkCookies():
bad
.
append
(
cookie
)
bad
.
append
(
cookie
)
return
good
,
bad
return
good
,
bad
def
extract_tweet
(
tweet
):
if
'rest_id'
in
tweet
:
return
tweet
if
'tweet'
in
tweet
and
'rest_id'
in
tweet
[
'tweet'
]:
return
tweet
[
'tweet'
]
return
None
@
app
.
route
(
"/<screen_name>"
)
@
app
.
route
(
"/<screen_name>"
)
def
searchban
(
screen_name
):
def
searchban
(
screen_name
):
...
@@ -389,8 +394,10 @@ def searchban(screen_name):
...
@@ -389,8 +394,10 @@ def searchban(screen_name):
for
entry_item
in
item
[
'entries'
]:
for
entry_item
in
item
[
'entries'
]:
if
not
entry_item
[
'entryId'
]
.
startswith
(
'tweet-'
):
if
not
entry_item
[
'entryId'
]
.
startswith
(
'tweet-'
):
continue
continue
found_id
=
entry_item
[
'content'
][
'itemContent'
][
'tweet_results'
][
'result'
][
'rest_id'
]
tweet
=
extract_tweet
(
entry_item
[
'content'
][
'itemContent'
][
'tweet_results'
][
'result'
])
break
if
tweet
is
None
:
continue
found_id
=
tweet
[
'rest_id'
]
if
found_id
:
if
found_id
:
break
break
if
found_id
:
if
found_id
:
...
@@ -455,8 +462,8 @@ def searchban(screen_name):
...
@@ -455,8 +462,8 @@ def searchban(screen_name):
if
not
ghostban
:
if
not
ghostban
:
# all checks done
# all checks done
break
break
if
ent
[
"entryId"
]
.
startswith
(
"tweet"
)
and
"legacy"
in
e
nt
[
"content"
][
"itemContent"
][
"tweet_results"
][
"result"
]
:
if
ent
[
"entryId"
]
.
startswith
(
"tweet"
)
and
"legacy"
in
e
xtract_tweet
(
ent
[
"content"
][
"itemContent"
][
"tweet_results"
][
"result"
])
:
tmp
=
e
nt
[
"content"
][
"itemContent"
][
"tweet_results"
][
"result"
]
[
"legacy"
]
tmp
=
e
xtract_tweet
(
ent
[
"content"
][
"itemContent"
][
"tweet_results"
][
"result"
])
[
"legacy"
]
if
"in_reply_to_status_id_str"
in
tmp
and
tmp
[
"in_reply_to_status_id_str"
]
not
in
checkedTweets
:
if
"in_reply_to_status_id_str"
in
tmp
and
tmp
[
"in_reply_to_status_id_str"
]
not
in
checkedTweets
:
reply
=
tmp
reply
=
tmp
tweetId
=
reply
[
"in_reply_to_status_id_str"
]
tweetId
=
reply
[
"in_reply_to_status_id_str"
]
...
@@ -495,8 +502,8 @@ def searchban(screen_name):
...
@@ -495,8 +502,8 @@ def searchban(screen_name):
print
(
"Current entry of {} is: {}"
.
format
(
screen_name
,
ent
[
"entryId"
]))
print
(
"Current entry of {} is: {}"
.
format
(
screen_name
,
ent
[
"entryId"
]))
if
ent
[
"entryId"
]
.
startswith
(
"conversationthread"
)
and
ghostban
:
if
ent
[
"entryId"
]
.
startswith
(
"conversationthread"
)
and
ghostban
:
for
item
in
ent
[
"content"
][
"items"
]:
for
item
in
ent
[
"content"
][
"items"
]:
if
"tweet_results"
in
item
[
"item"
][
"itemContent"
]
and
"legacy"
in
item
[
"item"
][
"itemContent"
][
"tweet_results"
][
"result"
]
and
item
[
"item"
][
"itemContent"
][
"tweet_results"
][
"result"
]
[
"legacy"
][
"user_id_str"
]
==
user_id
:
if
"tweet_results"
in
item
[
"item"
][
"itemContent"
]
and
"legacy"
in
extract_tweet
(
item
[
"item"
][
"itemContent"
][
"tweet_results"
][
"result"
])
and
extract_tweet
(
item
[
"item"
][
"itemContent"
][
"tweet_results"
][
"result"
])
[
"legacy"
][
"user_id_str"
]
==
user_id
:
replyId
=
item
[
"item"
][
"itemContent"
][
"tweet_results"
][
"result"
]
[
"legacy"
][
"id_str"
]
replyId
=
extract_tweet
(
item
[
"item"
][
"itemContent"
][
"tweet_results"
][
"result"
])
[
"legacy"
][
"id_str"
]
returnjson
[
"tests"
][
"ghost"
]
=
{
"ban"
:
False
,
"tweet"
:
tweetId
,
"in_reply_to"
:
replyId
}
returnjson
[
"tests"
][
"ghost"
]
=
{
"ban"
:
False
,
"tweet"
:
tweetId
,
"in_reply_to"
:
replyId
}
ghostban
=
False
ghostban
=
False
print
(
"Found valid reply {} => {}, so {} is not ghost banned."
.
format
(
tweetId
,
replyId
,
screen_name
))
print
(
"Found valid reply {} => {}, so {} is not ghost banned."
.
format
(
tweetId
,
replyId
,
screen_name
))
...
@@ -518,8 +525,8 @@ def searchban(screen_name):
...
@@ -518,8 +525,8 @@ def searchban(screen_name):
if
c_ent
[
"entryId"
]
.
startswith
(
"conversationthread"
):
if
c_ent
[
"entryId"
]
.
startswith
(
"conversationthread"
):
print
(
"Checking more contents of {} by {}"
.
format
(
tweetId
,
screen_name
))
print
(
"Checking more contents of {} by {}"
.
format
(
tweetId
,
screen_name
))
for
c_item
in
c_ent
[
"content"
][
"items"
]:
for
c_item
in
c_ent
[
"content"
][
"items"
]:
if
"legacy"
in
c_item
[
"item"
][
"itemContent"
][
"tweet_results"
][
"result"
]
and
c_item
[
"item"
][
"itemContent"
][
"tweet_results"
][
"result"
]
[
"legacy"
][
"user_id_str"
]
==
user_id
:
if
"legacy"
in
extract_tweet
(
c_item
[
"item"
][
"itemContent"
][
"tweet_results"
][
"result"
])
and
extract_tweet
(
c_item
[
"item"
][
"itemContent"
][
"tweet_results"
][
"result"
])
[
"legacy"
][
"user_id_str"
]
==
user_id
:
replyId
=
c_item
[
"item"
][
"itemContent"
][
"tweet_results"
][
"result"
]
[
"legacy"
][
"id_str"
]
replyId
=
extract_tweet
(
c_item
[
"item"
][
"itemContent"
][
"tweet_results"
][
"result"
])
[
"legacy"
][
"id_str"
]
returnjson
[
"tests"
][
"more_replies"
]
=
{
"ban"
:
True
,
"in_reply_to"
:
replyId
,
"tweet"
:
tweetId
}
returnjson
[
"tests"
][
"more_replies"
]
=
{
"ban"
:
True
,
"in_reply_to"
:
replyId
,
"tweet"
:
tweetId
}
print
(
"{} is reply deboosted because of {} => {}."
.
format
(
screen_name
,
tweetId
,
replyId
))
print
(
"{} is reply deboosted because of {} => {}."
.
format
(
screen_name
,
tweetId
,
replyId
))
showmore
=
True
showmore
=
True
...
...
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