Skip to content

Instantly share code, notes, and snippets.

@DerGoogler
Last active October 27, 2022 20:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DerGoogler/a79ebebd6744958e607aa564bcd1516c to your computer and use it in GitHub Desktop.
Save DerGoogler/a79ebebd6744958e607aa564bcd1516c to your computer and use it in GitHub Desktop.
Simple script to fetch tells from an Tellonym user

Tellonym API Fetch

Simple script to fetch the tells from an Tellonym user

main.mjs

import fetch from 'node-fetch'

let settings = { method: "Get" };

async function main(username, pages, limit = 25) {
  let resAnswers = []
  for (let index = 0; index < pages; ++index) {
    const json = await fetch(`https://api.tellonym.me/profiles/name/${username}?limit=${limit}&pos=${index}`, settings)
      .then(res => res.json())

    const anwers = json.answers;
    anwers.map((item) => {
      resAnswers.push({
        tell: item.tell,
        answer: item.answer,
        date: item.createdAt,
      })
    })
  }

  console.log(JSON.stringify(resAnswers, null, 4))
}

main('Der_Googler', 1)
@DerGoogler
Copy link
Author

Limit can increased up to 30

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment