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
ad845e15
Commit
ad845e15
authored
Feb 17, 2020
by
Raphael Beer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add: count sensitive flags on user's latest tweets
parent
9d137208
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
1 deletion
+23
-1
backend.py
backend.py
+4
-1
statistics.py
statistics.py
+19
-0
No files found.
backend.py
View file @
ad845e15
...
@@ -12,8 +12,9 @@ import time
...
@@ -12,8 +12,9 @@ import time
from
aiohttp
import
web
from
aiohttp
import
web
from
bs4
import
BeautifulSoup
from
bs4
import
BeautifulSoup
from
db
import
connect
from
db
import
connect
from
statistics
import
count_sensitives
from
typeahead
import
test
as
test_typeahead
from
typeahead
import
test
as
test_typeahead
routes
=
web
.
RouteTableDef
()
routes
=
web
.
RouteTableDef
()
...
@@ -421,6 +422,8 @@ class TwitterSession:
...
@@ -421,6 +422,8 @@ class TwitterSession:
if
not
profile
[
"exists"
]
or
profile
.
get
(
"suspended"
,
False
)
or
profile
.
get
(
"protected"
,
False
)
or
not
profile
.
get
(
'has_tweets'
):
if
not
profile
[
"exists"
]
or
profile
.
get
(
"suspended"
,
False
)
or
profile
.
get
(
"protected"
,
False
)
or
not
profile
.
get
(
'has_tweets'
):
return
result
return
result
result
[
"profile"
][
"sensitives"
]
=
await
count_sensitives
(
self
,
user_id
)
result
[
"tests"
]
=
{}
result
[
"tests"
]
=
{}
search_raw
=
await
self
.
search_raw
(
"from:@"
+
username
)
search_raw
=
await
self
.
search_raw
(
"from:@"
+
username
)
...
...
statistics.py
0 → 100644
View file @
ad845e15
import
sys
# Count amount of "possibly_sensitive_editable" and "possibly_sensitive"
# flagged tweets in user's timeline
async
def
count_sensitives
(
session
,
user_id
):
profile_timeline
=
await
session
.
get_profile_tweets_raw
(
user_id
)
profile_tweets
=
profile_timeline
[
"globalObjects"
][
"tweets"
]
.
values
()
counted
=
len
(
profile_tweets
)
possibly_sensitive
=
len
([
1
for
tweet
in
profile_tweets
if
"possibly_sensitive"
in
tweet
.
keys
()])
possibly_sensitive_editable
=
len
([
1
for
tweet
in
profile_tweets
if
"possibly_sensitive_editable"
in
tweet
.
keys
()])
result
=
{
"counted"
:
counted
,
"possibly_sensitive"
:
possibly_sensitive
,
"possibly_sensitive_editable"
:
possibly_sensitive_editable
}
return
result
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