Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
T
Twint
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
Twint
Commits
a6ab848d
Commit
a6ab848d
authored
Feb 17, 2022
by
minamotorin
Committed by
GitHub
Feb 17, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update feed.py
cope with Twitter's site-change, maybe
parent
382f814f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
9 deletions
+21
-9
twint/feed.py
twint/feed.py
+21
-9
No files found.
twint/feed.py
View file @
a6ab848d
...
...
@@ -55,16 +55,16 @@ def MobileFav(response):
def
_get_cursor
(
response
):
try
:
try
:
# case 1
next_cursor
=
response
[
'timeline'
][
'instructions'
][
0
][
'addEntries'
][
'entries'
][
-
1
][
'content'
][
'operation'
][
'cursor'
][
'value'
]
except
KeyError
:
try
:
try
:
# case 1
# this is needed because after the first request location of cursor is changed
next_cursor
=
response
[
'timeline'
][
'instructions'
][
-
1
][
'replaceEntry'
][
'entry'
][
'content'
][
'operation'
][
'cursor'
][
'value'
]
except
KeyError
:
next_cursor
=
response
[
'timeline'
][
'instructions'
][
0
][
'entries'
][
-
1
][
'content'
][
'value'
]
except
KeyError
:
# case 2
next_cursor
=
response
[
-
1
][
'content'
][
'value'
]
return
next_cursor
...
...
@@ -122,12 +122,24 @@ def parse_tweets(config, response):
'retweet_date'
:
_dt
,
}
feed
.
append
(
temp_obj
)
next_cursor
=
_get_cursor
(
response
)
# case 1
else
:
response
=
response
[
'data'
][
'user'
][
'result'
][
'timeline'
]
for
timeline_entry
in
response
[
'timeline'
][
'instructions'
][
0
][
'entries'
]:
entries
=
response
[
'timeline'
][
'instructions'
]
for
e
in
entries
:
if
e
.
get
(
'entries'
):
entries
=
e
[
'entries'
]
break
if
len
(
entries
)
==
2
:
msg
=
'No more data!'
raise
NoMoreTweetsException
(
msg
)
for
timeline_entry
in
entries
:
if
timeline_entry
[
'content'
]
.
get
(
'itemContent'
):
temp_obj
=
timeline_entry
[
'content'
][
'itemContent'
][
'tweet_results'
][
'result'
][
'legacy'
]
temp_obj
[
'user_data'
]
=
timeline_entry
[
'content'
][
'itemContent'
][
'tweet_results'
][
'result'
][
'core'
][
'user_results'
][
'result'
][
'legacy'
]
feed
.
append
(
temp_obj
)
next_cursor
=
_get_cursor
(
response
)
try
:
temp_obj
=
timeline_entry
[
'content'
][
'itemContent'
][
'tweet_results'
][
'result'
][
'legacy'
]
temp_obj
[
'user_data'
]
=
timeline_entry
[
'content'
][
'itemContent'
][
'tweet_results'
][
'result'
][
'core'
][
'user_results'
][
'result'
][
'legacy'
]
feed
.
append
(
temp_obj
)
except
KeyError
:
# doubtful
next
next_cursor
=
_get_cursor
(
entries
)
# case 2
return
feed
,
next_cursor
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