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
815c30bb
Commit
815c30bb
authored
Dec 23, 2019
by
Netzdenunziant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace GraphQL endpoint with normal API endpoint
parent
734c6f52
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
7 deletions
+6
-7
backend.py
backend.py
+6
-7
No files found.
backend.py
View file @
815c30bb
...
@@ -208,8 +208,7 @@ class TwitterSession:
...
@@ -208,8 +208,7 @@ class TwitterSession:
return
await
self
.
get
(
"https://api.twitter.com/1.1/search/typeahead.json?src=search_box&result_type=users&q="
+
urllib
.
parse
.
quote
(
query
))
return
await
self
.
get
(
"https://api.twitter.com/1.1/search/typeahead.json?src=search_box&result_type=users&q="
+
urllib
.
parse
.
quote
(
query
))
async
def
profile_raw
(
self
,
username
):
async
def
profile_raw
(
self
,
username
):
obj
=
json
.
dumps
({
"screen_name"
:
username
,
"withHighlightedLabel"
:
True
})
return
await
self
.
get
(
"https://api.twitter.com/1.1/users/show.json?screen_name="
+
urllib
.
parse
.
quote
(
username
))
return
await
self
.
get
(
self
.
_user_url
+
urllib
.
parse
.
quote
(
obj
))
async
def
get_profile_tweets_raw
(
self
,
user_id
):
async
def
get_profile_tweets_raw
(
self
,
user_id
):
return
await
self
.
get
(
"https://api.twitter.com/2/timeline/profile/"
+
str
(
user_id
)
+
".json?include_tweet_replies=1&include_want_retweets=0&include_reply_count=1&count=1000"
)
return
await
self
.
get
(
"https://api.twitter.com/2/timeline/profile/"
+
str
(
user_id
)
+
".json?include_tweet_replies=1&include_want_retweets=0&include_reply_count=1&count=1000"
)
...
@@ -390,22 +389,22 @@ class TwitterSession:
...
@@ -390,22 +389,22 @@ class TwitterSession:
raise
UnexpectedApiError
raise
UnexpectedApiError
try
:
try
:
user_id
=
str
(
profile_raw
[
"
data"
][
"user"
][
"rest_
id"
])
user_id
=
str
(
profile_raw
[
"id"
])
except
KeyError
:
except
KeyError
:
user_id
=
None
user_id
=
None
try
:
try
:
profile
[
"screen_name"
]
=
profile_raw
[
"
data"
][
"user"
][
"legacy"
][
"
screen_name"
]
profile
[
"screen_name"
]
=
profile_raw
[
"screen_name"
]
except
KeyError
:
except
KeyError
:
profile
[
"screen_name"
]
=
username
profile
[
"screen_name"
]
=
username
try
:
try
:
profile
[
"restriction"
]
=
profile_raw
[
"
data"
][
"user"
][
"legacy"
][
"
profile_interstitial_type"
]
profile
[
"restriction"
]
=
profile_raw
[
"profile_interstitial_type"
]
except
KeyError
:
except
KeyError
:
pass
pass
if
profile
.
get
(
"restriction"
,
None
)
==
""
:
if
profile
.
get
(
"restriction"
,
None
)
==
""
:
del
profile
[
"restriction"
]
del
profile
[
"restriction"
]
try
:
try
:
profile
[
"protected"
]
=
profile_raw
[
"
data"
][
"user"
][
"legacy"
][
"
protected"
]
profile
[
"protected"
]
=
profile_raw
[
"protected"
]
except
KeyError
:
except
KeyError
:
pass
pass
profile
[
"exists"
]
=
not
is_error
(
profile_raw
,
50
)
profile
[
"exists"
]
=
not
is_error
(
profile_raw
,
50
)
...
@@ -413,7 +412,7 @@ class TwitterSession:
...
@@ -413,7 +412,7 @@ class TwitterSession:
if
suspended
:
if
suspended
:
profile
[
"suspended"
]
=
suspended
profile
[
"suspended"
]
=
suspended
try
:
try
:
profile
[
"has_tweets"
]
=
int
(
profile_raw
[
"
data"
][
"user"
][
"legacy"
][
"
statuses_count"
])
>
0
profile
[
"has_tweets"
]
=
int
(
profile_raw
[
"statuses_count"
])
>
0
except
KeyError
:
except
KeyError
:
profile
[
"has_tweets"
]
=
False
profile
[
"has_tweets"
]
=
False
...
...
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