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
937cae76
Commit
937cae76
authored
May 18, 2022
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
the variables/features migration
parent
5093a721
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
10 deletions
+19
-10
backend_requests.py
backend_requests.py
+19
-10
No files found.
backend_requests.py
View file @
937cae76
...
...
@@ -13,6 +13,14 @@ TWITTER_AUTH_KEY = 'AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%
ENDPOINT
=
endpoint
()
FeaturesDict
=
{
"responsive_web_uc_gql_enabled"
:
False
,
"dont_mention_me_view_api_enabled"
:
False
,
"interactive_text_enabled"
:
False
,
"responsive_web_edit_tweet_api_enabled"
:
False
}
FeaturesJson
=
json
.
dumps
(
FeaturesDict
)
@
app
.
route
(
'/{screen_name}'
)
def
shadowban
(
screen_name
):
# DO IT
...
...
@@ -172,17 +180,21 @@ def searchban(screen_name):
print
(
"User ID of {}: {}"
.
format
(
screen_name
,
user_id
))
get_reply_vars
=
{
"count"
:
700
,
"userId"
:
user_id
,
get_reply_vars
=
{
"count"
:
700
,
"userId"
:
user_id
,
"includePromotedContent"
:
False
,
"withSuperFollowsUserFields"
:
False
,
"withBirdwatchPivots"
:
False
,
"withDownvotePerspective"
:
False
,
"withReactionsMetadata"
:
False
,
"withReactionsPerspective"
:
False
,
"withSuperFollowsTweetFields"
:
False
,
"withVoice"
:
False
,
"withV2Timeline"
:
False
,
"__fs_interactive_text"
:
False
,
"__fs_responsive_web_uc_gql_enabled"
:
False
,
"__fs_dont_mention_me_view_api_enabled"
:
False
}
get_reply_param
=
param
=
{
"variables"
:
json
.
dumps
(
get_reply_vars
)}
"withReactionsPerspective"
:
False
,
"withSuperFollowsTweetFields"
:
False
,
"withVoice"
:
False
,
"withV2Timeline"
:
False
,
}
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
:
maindata
=
replies
.
json
()[
"data"
][
"user"
][
"result"
][
"timeline"
][
"timeline"
][
"instructions"
]
repliesJson
=
replies
.
json
()
print
(
repliesJson
)
maindata
=
repliesJson
[
"data"
][
"user"
][
"result"
][
"timeline"
][
"timeline"
][
"instructions"
]
for
d
in
maindata
:
if
d
[
"type"
]
==
"TimelineAddEntries"
:
for
ent
in
d
[
"entries"
]:
...
...
@@ -207,11 +219,8 @@ def searchban(screen_name):
"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
)})
tweetdetails
=
twitter_b
.
get
(
"https://twitter.com/i/api/graphql/{}/{}"
.
format
(
ENDPOINT
[
"TweetDetail"
],
"TweetDetail"
),
params
=
{
"variables"
:
json
.
dumps
(
tweet_detail_vars
)
,
"features"
:
FeaturesJson
})
insts
=
tweetdetails
.
json
()[
"data"
][
"threaded_conversation_with_injections"
][
"instructions"
]
...
...
@@ -246,7 +255,7 @@ def searchban(screen_name):
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
=
twitter_b
.
get
(
"https://twitter.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"
]
for
c_i
in
cursor_insts
:
...
...
@@ -281,7 +290,7 @@ def searchban(screen_name):
returnjson
[
"tests"
][
testField
][
"tweet"
]
=
replyTweet
except
KeyError
as
e
:
print
(
"Errored testing {}"
.
format
(
screen_name
))
print
(
Exception
.
with_traceback
(
e
))
#
print(Exception.with_traceback(e))
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