diff options
-rw-r--r-- | mastodon/Mastodon.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index 13373d1..1d71e94 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py | |||
@@ -781,8 +781,8 @@ class Mastodon: | |||
781 | Returns the previous page or None if no further data is available. | 781 | Returns the previous page or None if no further data is available. |
782 | """ | 782 | """ |
783 | if isinstance(next_page, list): | 783 | if isinstance(next_page, list): |
784 | if '_pagination_prev' in next_page[-1]: | 784 | if '_pagination_prev' in next_page[0]: |
785 | params = copy.deepcopy(next_page[-1]['_pagination_prev']) | 785 | params = copy.deepcopy(next_page[0]['_pagination_prev']) |
786 | else: | 786 | else: |
787 | return None | 787 | return None |
788 | else: | 788 | else: |
@@ -970,6 +970,8 @@ class Mastodon: | |||
970 | next_params['_pagination_method'] = method | 970 | next_params['_pagination_method'] = method |
971 | next_params['_pagination_endpoint'] = endpoint | 971 | next_params['_pagination_endpoint'] = endpoint |
972 | next_params['max_id'] = int(matchgroups.group(1)) | 972 | next_params['max_id'] = int(matchgroups.group(1)) |
973 | if "since_id" in next_params: | ||
974 | del next_params['since_id'] | ||
973 | response[-1]['_pagination_next'] = next_params | 975 | response[-1]['_pagination_next'] = next_params |
974 | 976 | ||
975 | if url['rel'] == 'prev': | 977 | if url['rel'] == 'prev': |
@@ -981,7 +983,9 @@ class Mastodon: | |||
981 | prev_params = copy.deepcopy(params) | 983 | prev_params = copy.deepcopy(params) |
982 | prev_params['_pagination_method'] = method | 984 | prev_params['_pagination_method'] = method |
983 | prev_params['_pagination_endpoint'] = endpoint | 985 | prev_params['_pagination_endpoint'] = endpoint |
984 | prev_params['max_id'] = int(matchgroups.group(1)) | 986 | prev_params['since_id'] = int(matchgroups.group(1)) |
987 | if "max_id" in prev_params: | ||
988 | del prev_params['max_id'] | ||
985 | response[0]['_pagination_prev'] = prev_params | 989 | response[0]['_pagination_prev'] = prev_params |
986 | 990 | ||
987 | # Handle rate limiting | 991 | # Handle rate limiting |