tuskyapp / Tusky

An Android client for the microblogging server Mastodon
https://tusky.app
GNU General Public License v3.0
2.49k stars 389 forks source link

Support Explore/Trends #2109

Open soudk opened 3 years ago

soudk commented 3 years ago

Wouldn't it be cool to have a trending page in the sidebar to see what hashtags are trending on local timelines, maybe with a toggle to view trends across Mastodon?

I think Fedilab has this but I'm not sure if it works.

guerda commented 2 years ago

There finally is a trends API, based on the instance you're on that gives you this. Maybe it can be implemented in the search tab like in the web app?

https://docs.joinmastodon.org/methods/instance/trends/

e.g. https://>instance>/api/v1/trends/statuses

guerda commented 2 years ago

The status trends (called "Explore" in the UI) is behind the instance trends API. It seems to return a simple list of toots, like the search API in the element statuses. Unfortunately, it's not yet documented on docs.joinmastodon.org (see https://github.com/mastodon/documentation/issues/947 for more information).

Here's an example for the statuses result:

[
  {
      "id": "108521492941340842",
      "created_at": "2022-06-22T14:02:48.000Z",
      "in_reply_to_id": null,
      "in_reply_to_account_id": null,
      "sensitive": false,
      "spoiler_text": "",
      "visibility": "public",
      "language": "de",
      "uri": "https://mastodon.social/users/watch_union/statuses/108521492880858106",
      "url": "https://mastodon.social/@watch_union/108521492880858106",
      "replies_count": 4,
      "reblogs_count": 19,
      "favourites_count": 2,
      "edited_at": null,
      "content": "<p><a href=\"https://mastodon.social/tags/Lindner\" class=\"mention hashtag\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">#<span>Lindner</span></a> will die deutsche Bevölkerung auf \"5 Jahre der Knappheit\" einstellen.</p><p>Währenddessen schütten deutsche Konzerne 70 Mrd. € an Dividenden aus.<br>Da ist nicht knapp, nur scheiße verteilt und der <a href=\"https://mastodon.social/tags/FDP\" class=\"mention hashtag\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">#<span>FDP</span></a> gefällt es.<br>/PM</p>",
      "reblog": null,
      "account": {
          "id": "108238000644624010",
          "username": "watch_union",
          "acct": "watch_union@mastodon.social",
          "display_name": "UnionWatch",
          "locked": false,
          "bot": false,
          "discoverable": true,
          "group": false,
          "created_at": "2022-05-03T00:00:00.000Z",
          "note": "<p>Tagespolitische Kommentare und Nachrichten rund um <a href=\"https://mastodon.social/tags/CDU\" class=\"mention hashtag\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">#<span>CDU</span></a>, <a href=\"https://mastodon.social/tags/CSU\" class=\"mention hashtag\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">#<span>CSU</span></a> und ihre Skandale.</p><p>Hinweise?<br>DM: info@union-watch.de (pgp 0xA2BFFF6C) <br>Tel:  +49 (0) 89-21536700</p><p><a href=\"https://mastodon.social/tags/FCKNZS\" class=\"mention hashtag\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">#<span>FCKNZS</span></a></p><p><a href=\"https://union-watch.de/\" rel=\"nofollow noopener noreferrer\" target=\"_blank\"><span class=\"invisible\">https://</span><span class=\"\">union-watch.de/</span><span class=\"invisible\"></span></a></p>",
          "url": "https://mastodon.social/@watch_union",
          "avatar": "https://s3-eu-central-1.amazonaws.com/ruhr-social/cache/accounts/avatars/108/238/000/644/624/010/original/1fca62e4b66ce43b.gif",
          "avatar_static": "https://s3-eu-central-1.amazonaws.com/ruhr-social/cache/accounts/avatars/108/238/000/644/624/010/static/1fca62e4b66ce43b.png",
          "header": "https://s3-eu-central-1.amazonaws.com/ruhr-social/cache/accounts/headers/108/238/000/644/624/010/original/53fa8389c12db971.gif",
          "header_static": "https://s3-eu-central-1.amazonaws.com/ruhr-social/cache/accounts/headers/108/238/000/644/624/010/static/53fa8389c12db971.png",
          "followers_count": 1047,
          "following_count": 1,
          "statuses_count": 2345,
          "last_status_at": "2022-06-23",
          "emojis": [],
          "fields": []
      },
      "media_attachments": [],
      "mentions": [],
      "tags": [
          {
              "name": "lindner",
              "url": "https://ruhr.social/tags/lindner"
          },
          {
              "name": "fdp",
              "url": "https://ruhr.social/tags/fdp"
          }
      ],
      "emojis": [],
      "card": null,
      "poll": null
  },
  {
      "id": "108521671780523612",
      "created_at": "2022-06-22T14:48:12.000Z",
      "in_reply_to_id": null,
      "in_reply_to_account_id": null,
      "sensitive": false,
      "spoiler_text": "",
      "visibility": "public",
      "language": "de",
      "uri": "https://chaos.social/users/fff/statuses/108521671368530013",
      "url": "https://chaos.social/@fff/108521671368530013",
      "replies_count": 2,
      "reblogs_count": 13,
      "favourites_count": 0,
      "edited_at": null,
      "content": "<p>🚨 @OlafScholz bricht das Pariser Klima-Abkommen!</p><p>Wenn er damit durchkommt, reißen wir sowohl die 1,5°C-Grenze als auch die 2°C-Marke! Ja, es steht wirklich so schlimm!</p><p>Was Scholz gerade plant, erfahrt ihr hier im Thread:</p>",
      "reblog": null,
      "account": {
          "id": "106002",
          "username": "fff",
          "acct": "fff@chaos.social",
          "display_name": "Fridays for Future Germany",
          "locked": false,
          "bot": false,
          "discoverable": true,
          "group": false,
          "created_at": "2020-09-08T00:00:00.000Z",
          "note": "<p><a href=\"https://chaos.social/tags/FridaysForFuture\" class=\"mention hashtag\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">#<span>FridaysForFuture</span></a> – oder auch: \"Dreimal F, F ist am sechsten Platz im Alphabet, also in dem Fall 666, da weiß man ja auch wieder, wer dahinter steckt.”</p>",
          "url": "https://chaos.social/@fff",
          "avatar": "https://s3-eu-central-1.amazonaws.com/ruhr-social/cache/accounts/avatars/000/106/002/original/4af3cf7c42ca7175.png",
          "avatar_static": "https://s3-eu-central-1.amazonaws.com/ruhr-social/cache/accounts/avatars/000/106/002/original/4af3cf7c42ca7175.png",
          "header": "https://s3-eu-central-1.amazonaws.com/ruhr-social/cache/accounts/headers/000/106/002/original/57a476b74d945e94.jpeg",
          "header_static": "https://s3-eu-central-1.amazonaws.com/ruhr-social/cache/accounts/headers/000/106/002/original/57a476b74d945e94.jpeg",
          "followers_count": 8969,
          "following_count": 17,
          "statuses_count": 1427,
          "last_status_at": "2022-06-22",
          "emojis": [],
          "fields": [
              {
                  "name": "Website",
                  "value": "<a href=\"https://fridaysforfuture.de\" rel=\"nofollow noopener noreferrer\" target=\"_blank\"><span class=\"invisible\">https://</span><span class=\"\">fridaysforfuture.de</span><span class=\"invisible\"></span></a>",
                  "verified_at": "2022-06-22T14:48:22.330+00:00"
              },
              {
                  "name": "Linktree",
                  "value": "<a href=\"https://ffftre.es\" rel=\"nofollow noopener noreferrer\" target=\"_blank\"><span class=\"invisible\">https://</span><span class=\"\">ffftre.es</span><span class=\"invisible\"></span></a>",
                  "verified_at": "2022-06-22T14:48:22.458+00:00"
              }
          ]
      },
      "media_attachments": [
          {
              "id": "108521671748860402",
              "type": "image",
              "url": "https://s3-eu-central-1.amazonaws.com/ruhr-social/cache/media_attachments/files/108/521/671/748/860/402/original/9787736f772ee4ad.jpg",
              "preview_url": "https://s3-eu-central-1.amazonaws.com/ruhr-social/cache/media_attachments/files/108/521/671/748/860/402/small/9787736f772ee4ad.jpg",
              "remote_url": "https://chaos.social/system/media_attachments/files/108/521/671/365/916/987/original/42f05f68fc7ba4ee.jpg",
              "preview_remote_url": null,
              "text_url": null,
              "meta": {
                  "original": {
                      "width": 1200,
                      "height": 675,
                      "size": "1200x675",
                      "aspect": 1.7777777777777777
                  },
                  "small": {
                      "width": 533,
                      "height": 300,
                      "size": "533x300",
                      "aspect": 1.7766666666666666
                  }
              },
              "description": null,
              "blurhash": "UaI{{OXTNHad}WSgWAWV9|Rjs,kCENt7bHae"
          }
      ],
      "mentions": [],
      "tags": [],
      "emojis": [],
      "card": null,
      "poll": null
  }

]

nikclayton commented 1 year ago

It's documented now, https://docs.joinmastodon.org/methods/trends/

https://mastodon.social/@stonedonkey/109526221538025375 is an request from a user for this feature.

nikclayton commented 1 year ago

Going to start working on implementing trending statuses and trending links.