diff --git a/megalodon/src/friendica.ts b/megalodon/src/friendica.ts index 3de3b6cf..bc81e088 100644 --- a/megalodon/src/friendica.ts +++ b/megalodon/src/friendica.ts @@ -487,6 +487,9 @@ export default class Friendica implements MegalodonInterface { converted = Object.assign({}, converted, { data: [...converted.data, ...nextRes.data.map(a => FriendicaAPI.Converter.account(a))] }) + if (nextRes.headers.link === undefined) { + break + } parsed = parseLinkHeader(nextRes.headers.link) if (sleep_ms) { await new Promise(converted => setTimeout(converted, sleep_ms)) diff --git a/megalodon/src/mastodon.ts b/megalodon/src/mastodon.ts index 744cdb76..17ed007a 100644 --- a/megalodon/src/mastodon.ts +++ b/megalodon/src/mastodon.ts @@ -564,6 +564,9 @@ export default class Mastodon implements MegalodonInterface { converted = Object.assign({}, converted, { data: [...converted.data, ...nextRes.data.map(a => MastodonAPI.Converter.account(a))] }) + if (nextRes.headers.link === undefined) { + break + } parsed = parseLinkHeader(nextRes.headers.link) if (sleep_ms) { await new Promise(converted => setTimeout(converted, sleep_ms))