Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
EI Twitter
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Guillaume Di Fatta
EI Twitter
Commits
73185cf8
Commit
73185cf8
authored
2 years ago
by
Guillaume Di Fatta
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
471b702c
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
main.py
+23
-0
23 additions, 0 deletions
main.py
with
23 additions
and
0 deletions
main.py
0 → 100644
+
23
−
0
View file @
73185cf8
import
snscrape.modules.twitter
as
sntwitter
import
pandas
as
pd
import
datetime
as
dt
# cool
df
=
pd
.
DataFrame
(
columns
=
[
'
date
'
,
'
tweet
'
])
limit
=
100
for
i
,
tweet
in
enumerate
(
sntwitter
.
TwitterSearchScraper
(
query
=
"
Metaverse -filter:replies -filter:links -filter:retweets -filter:nativeretweets
"
).
get_items
()):
if
i
>
limit
:
break
if
(
tweet
.
lang
==
"
en
"
):
df2
=
{
'
date
'
:
tweet
.
date
.
strftime
(
"
%m/%d/%Y, %H:%M:%S
"
),
'
tweet
'
:
tweet
.
rawContent
}
df
=
pd
.
concat
([
df
,
pd
.
DataFrame
.
from_records
([
df2
])])
print
(
i
/
limit
*
100
)
df
=
df
.
drop_duplicates
(
subset
=
[
"
tweet
"
])
df
=
df
.
sort_values
(
by
=
[
"
tweet
"
])
df
.
to_json
(
"
twitter_data.json
"
,
orient
=
"
split
"
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment