quick hack with the mastodon golang library
Find a file
Vincent Batts 1bda3de425
main: ioutil.ReadFile is deprecated
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2023-10-31 09:38:13 -04:00
.gitignore main: working stream of hashtag and timeline 2023-02-13 15:53:08 -05:00
go.mod *: various minor changes 2023-04-10 09:20:44 -04:00
go.sum *: various minor changes 2023-04-10 09:20:44 -04:00
LICENSE tmp Name and LICENSE formating 2023-03-14 16:00:51 -04:00
main.go main: ioutil.ReadFile is deprecated 2023-10-31 09:38:13 -04:00
README.md README: show example 2023-02-13 15:58:15 -05:00

mst

quick hack with the mastodon golang library

config.json

create it with tokens created from the mastodon accout you're using. An example would be:

{
  "Server": "https://mastodon.social",
  "ClientID": "asdfasdfafd",
  "ClientSecret": "asfdasdfasfd",
  "AccessToken": "asdfasdfadfasfd"
}

sample interaction

vbatts@melisma:~/tmp.tAT0gR1Esl$ gr main.go --hash photomonday
{
  "id": "109859399790133344",
  "uri": "https://social.cologne/users/voyager/statuses/109859399645988048",
  "url": "https://social.cologne/@voyager/109859399645988048",
  "account": {
    "id": "109389721534238340",
    "username": "voyager",
    "acct": "voyager@social.cologne",
    "display_name": "Voyager",
    "locked": false,
    "created_at": "2022-11-19T00:00:00Z",
    "followers_count": 194,
    "following_count": 223,
    "statuses_count": 1072,
    "note": "\u003cp\u003e📸🚀🛫⛵💻🌎🎱🚌🏂🤘:effzeh:\u003cbr\u003eAll pictures posted by me are taken by me and can be used under \u003ca href=\"https://creativecommons.org/licenses/by-nc-nd/4.0/\" rel=\"nofollow noopener noreferrer\" target=\"_blank\"\u003e\u003cspan class=\"invisible\"\u003ehttps://\u003c/span\u003e\u003cspan class=\"ellipsis\"\u003ecreativecommons.org/licenses/b\u003c/span\u003e\u003cspan class=\"invisible\"\u003ey-nc-nd/4.0/\u003c/span\u003e\u003c/a\u003e\u003cbr\u003eIf you are interested in full resolution feel free to contact me\u003c/p\u003e\u003cp\u003eAlle getröteteten Bilder sind von mir (oder besonders gekennzeichnet) und könnnen unter \u003ca href=\"https://creativecommons.org/licenses/by-nc-nd/4.0/\" rel=\"nofollow noopener noreferrer\" target=\"_blank\"\u003e\u003cspan class=\"invisible\"\u003ehttps://\u003c/span\u003e\u003cspan class=\"ellipsis\"\u003ecreativecommons.org/licenses/b\u003c/span\u003e\u003cspan class=\"invisible\"\u003ey-nc-nd/4.0/\u003c/span\u003e\u003c/a\u003e verwendet werden\u003cbr\u003eBei Interesse an der vollen Auflösung sprecht mich gerne an\u003c/p\u003e",
    "url": "https://social.cologne/@voyager",
    "avatar": "https://cdn.fosstodon.org/cache/accounts/avatars/109/389/721/534/238/340/original/7fb96acf94ddedcd.png",
    "avatar_static": "https://cdn.fosstodon.org/cache/accounts/avatars/109/389/721/534/238/340/original/7fb96acf94ddedcd.png",
    "header": "https://cdn.fosstodon.org/cache/accounts/headers/109/389/721/534/238/340/original/d1b060a8afcce449.jpeg",
    "header_static": "https://cdn.fosstodon.org/cache/accounts/headers/109/389/721/534/238/340/original/d1b060a8afcce449.jpeg",
    "emojis": [
      {
        "shortcode": "effzeh",
        "static_url": "https://cdn.fosstodon.org/cache/custom_emojis/images/000/777/155/static/cf14c4d8252f767b.png",
        "url": "https://cdn.fosstodon.org/cache/custom_emojis/images/000/777/155/original/cf14c4d8252f767b.png",
        "visible_in_picker": true
      }
    ],
    "moved": null,
    "fields": [
      {
        "name": "Apple / Android",
        "value": "Apple",
        "verified_at": "0001-01-01T00:00:00Z"
      },
      {
        "name": "Tee / Kaffee",
        "value": "Kaffee",
        "verified_at": "0001-01-01T00:00:00Z"
      },
      {
        "name": "Ski / Snowboard",
        "value": "Snowboard",
        "verified_at": "0001-01-01T00:00:00Z"
      },
      {
        "name": "Nikon / Sony",
        "value": "Olympus :-)",
        "verified_at": "0001-01-01T00:00:00Z"
      }
    ],
    "bot": false,
    "discoverable": false,
    "source": null
  },
  "in_reply_to_id": null,
  "in_reply_to_account_id": null,
  "reblog": null,
  "content": "\u003cp\u003eHi yall! …for \u003ca href=\"https://social.cologne/tags/photomonday\" class=\"mention hashtag\" rel=\"nofollow noopener noreferrer\" target=\"_blank\"\u003e#\u003cspan\u003ephotomonday\u003c/span\u003e\u003c/a\u003e \u003ca href=\"https://social.cologne/tags/Fotomontag\" class=\"mention hashtag\" rel=\"nofollow noopener noreferrer\" target=\"_blank\"\u003e#\u003cspan\u003eFotomontag\u003c/span\u003e\u003c/a\u003e I found today this nice \u003ca href=\"https://social.cologne/tags/bird\" class=\"mention hashtag\" rel=\"nofollow noopener noreferrer\" target=\"_blank\"\u003e#\u003cspan\u003ebird\u003c/span\u003e\u003c/a\u003e from \u003ca href=\"https://social.cologne/tags/Mauritius\" class=\"mention hashtag\" rel=\"nofollow noopener noreferrer\" target=\"_blank\"\u003e#\u003cspan\u003eMauritius\u003c/span\u003e\u003c/a\u003e..\u003c/p\u003e\u003cp\u003e\u003ca href=\"https://social.cologne/tags/photography\" class=\"mention hashtag\" rel=\"nofollow noopener noreferrer\" target=\"_blank\"\u003e#\u003cspan\u003ephotography\u003c/span\u003e\u003c/a\u003e \u003ca href=\"https://social.cologne/tags/fotografie\" class=\"mention hashtag\" rel=\"nofollow noopener noreferrer\" target=\"_blank\"\u003e#\u003cspan\u003efotografie\u003c/span\u003e\u003c/a\u003e \u003ca href=\"https://social.cologne/tags/birdphotography\" class=\"mention hashtag\" rel=\"nofollow noopener noreferrer\" target=\"_blank\"\u003e#\u003cspan\u003ebirdphotography\u003c/span\u003e\u003c/a\u003e \u003ca href=\"https://social.cologne/tags/wildlife\" class=\"mention hashtag\" rel=\"nofollow noopener noreferrer\" target=\"_blank\"\u003e#\u003cspan\u003ewildlife\u003c/span\u003e\u003c/a\u003e \u003ca href=\"https://social.cologne/tags/wildlifephotography\" class=\"mention hashtag\" rel=\"nofollow noopener noreferrer\" target=\"_blank\"\u003e#\u003cspan\u003ewildlifephotography\u003c/span\u003e\u003c/a\u003e \u003ca href=\"https://social.cologne/tags/birdsofmastodon\" class=\"mention hashtag\" rel=\"nofollow noopener noreferrer\" target=\"_blank\"\u003e#\u003cspan\u003ebirdsofmastodon\u003c/span\u003e\u003c/a\u003e\u003c/p\u003e",
  "created_at": "2023-02-13T20:50:05Z",
  "emojis": [],
  "replies_count": 0,
  "reblogs_count": 0,
  "favourites_count": 0,
  "reblogged": null,
  "favourited": null,
  "bookmarked": null,
  "muted": null,
  "sensitive": false,
  "spoiler_text": "",
  "visibility": "public",
  "media_attachments": [
    {
      "id": "109859399697262979",
      "type": "image",
      "url": "https://cdn.fosstodon.org/cache/media_attachments/files/109/859/399/697/262/979/original/94818cc07245876d.jpeg",
      "remote_url": "https://media.social.cologne/media_attachments/files/109/859/373/609/386/397/original/661e39cd56749973.jpeg",
      "preview_url": "https://cdn.fosstodon.org/cache/media_attachments/files/109/859/399/697/262/979/small/94818cc07245876d.jpeg",
      "text_url": "",
      "description": "Orange bird sitting on a railing",
      "meta": {
        "original": {
          "width": 1280,
          "height": 1138,
          "size": "1280x1138",
          "aspect": 1.124780316344464
        },
        "small": {
          "width": 509,
          "height": 453,
          "size": "509x453",
          "aspect": 1.1236203090507726
        }
      }
    }
  ],
  "mentions": [],
  "tags": [
    {
      "name": "Photomonday",
      "url": "https://fosstodon.org/tags/Photomonday",
      "history": null
    },
    {
      "name": "Fotomontag",
      "url": "https://fosstodon.org/tags/Fotomontag",
      "history": null
    },
    {
      "name": "bird",
      "url": "https://fosstodon.org/tags/bird",
      "history": null
    },
    {
      "name": "mauritius",
      "url": "https://fosstodon.org/tags/mauritius",
      "history": null
    },
    {
      "name": "photography",
      "url": "https://fosstodon.org/tags/photography",
      "history": null
    },
    {
      "name": "fotografie",
      "url": "https://fosstodon.org/tags/fotografie",
      "history": null
    },
    {
      "name": "birdphotography",
      "url": "https://fosstodon.org/tags/birdphotography",
      "history": null
    },
    {
      "name": "wildlife",
      "url": "https://fosstodon.org/tags/wildlife",
      "history": null
    },
    {
      "name": "wildlifephotography",
      "url": "https://fosstodon.org/tags/wildlifephotography",
      "history": null
    },
    {
      "name": "birdsofmastodon",
      "url": "https://fosstodon.org/tags/birdsofmastodon",
      "history": null
    }
  ],
  "card": null,
  "poll": null,
  "application": {
    "id": "",
    "redirect_uri": "",
    "client_id": "",
    "client_secret": ""
  },
  "language": "de",
  "pinned": null
}
{
  "id": "109859401840324023",
  "uri": "https://mastodon.social/users/colindean/statuses/109859401664414169",
  "url": "https://mastodon.social/@colindean/109859401664414169",
  "account": {
    "id": "272569",
    "username": "colindean",
    "acct": "colindean@mastodon.social",
    "display_name": "Colin Dean",
    "locked": false,
    "created_at": "2017-10-21T00:00:00Z",
    "followers_count": 138,
    "following_count": 132,
    "statuses_count": 523,
    "note": "\u003cp\u003eBon vivant, scholar, champion of the oppressed. Software engineer and community builder. My words are my own. Quotes and boosts are not necessarily my views, but something I want followers to see.\u003c/p\u003e",
    "url": "https://mastodon.social/@colindean",
    "avatar": "https://cdn.fosstodon.org/cache/accounts/avatars/000/272/569/original/c714b634330e6db7.jpg",
    "avatar_static": "https://cdn.fosstodon.org/cache/accounts/avatars/000/272/569/original/c714b634330e6db7.jpg",
    "header": "https://cdn.fosstodon.org/cache/accounts/headers/000/272/569/original/a39b4d960e369076.jpg",
    "header_static": "https://cdn.fosstodon.org/cache/accounts/headers/000/272/569/original/a39b4d960e369076.jpg",
    "emojis": [],
    "moved": null,
    "fields": [
      {
        "name": "Website",
        "value": "\u003ca href=\"https://cad.cx\" rel=\"nofollow noopener noreferrer\" target=\"_blank\"\u003e\u003cspan class=\"invisible\"\u003ehttps://\u003c/span\u003e\u003cspan class=\"\"\u003ecad.cx\u003c/span\u003e\u003cspan class=\"invisible\"\u003e\u003c/span\u003e\u003c/a\u003e",
        "verified_at": "2023-02-03T17:36:45.517Z"
      },
      {
        "name": "Code",
        "value": "\u003ca href=\"https://github.com/colindean\" rel=\"nofollow noopener noreferrer\" target=\"_blank\"\u003e\u003cspan class=\"invisible\"\u003ehttps://\u003c/span\u003e\u003cspan class=\"\"\u003egithub.com/colindean\u003c/span\u003e\u003cspan class=\"invisible\"\u003e\u003c/span\u003e\u003c/a\u003e",
        "verified_at": "2023-02-03T17:36:46.755Z"
      },
      {
        "name": "Writing",
        "value": "\u003ca href=\"https://medium.com/colindean\" rel=\"nofollow noopener noreferrer\" target=\"_blank\"\u003e\u003cspan class=\"invisible\"\u003ehttps://\u003c/span\u003e\u003cspan class=\"\"\u003emedium.com/colindean\u003c/span\u003e\u003cspan class=\"invisible\"\u003e\u003c/span\u003e\u003c/a\u003e",
        "verified_at": "0001-01-01T00:00:00Z"
      },
      {
        "name": "Twitter",
        "value": "\u003ca href=\"https://twitter.com/colindean\" rel=\"nofollow noopener noreferrer\" target=\"_blank\"\u003e\u003cspan class=\"invisible\"\u003ehttps://\u003c/span\u003e\u003cspan class=\"\"\u003etwitter.com/colindean\u003c/span\u003e\u003cspan class=\"invisible\"\u003e\u003c/span\u003e\u003c/a\u003e",
        "verified_at": "0001-01-01T00:00:00Z"
      }
    ],
    "bot": false,
    "discoverable": false,
    "source": null
  },
  "in_reply_to_id": null,
  "in_reply_to_account_id": null,
  "reblog": null,
  "content": "\u003cp\u003e\u003ca href=\"https://mastodon.social/tags/photomonday\" class=\"mention hashtag\" rel=\"nofollow noopener noreferrer\" target=\"_blank\"\u003e#\u003cspan\u003ephotomonday\u003c/span\u003e\u003c/a\u003e\u003c/p\u003e",
  "created_at": "2023-02-13T20:50:36Z",
  "emojis": [],
  "replies_count": 0,
  "reblogs_count": 0,
  "favourites_count": 0,
  "reblogged": null,
  "favourited": null,
  "bookmarked": null,
  "muted": null,
  "sensitive": false,
  "spoiler_text": "",
  "visibility": "public",
  "media_attachments": [
    {
      "id": "109859401761118977",
      "type": "image",
      "url": "https://cdn.fosstodon.org/cache/media_attachments/files/109/859/401/761/118/977/original/2dc86faf0bb29223.jpeg",
      "remote_url": "https://files.mastodon.social/media_attachments/files/109/859/393/577/852/164/original/09a33d25ed6f4660.jpeg",
      "preview_url": "https://cdn.fosstodon.org/cache/media_attachments/files/109/859/401/761/118/977/small/2dc86faf0bb29223.jpeg",
      "text_url": "",
      "description": "The Triumphal Arch at  \nParc du Cinquantenaire in Brussels, Belgium. February 2023.",
      "meta": {
        "original": {
          "width": 2589,
          "height": 801,
          "size": "2589x801",
          "aspect": 3.2322097378277155
        },
        "small": {
          "width": 863,
          "height": 267,
          "size": "863x267",
          "aspect": 3.2322097378277155
        }
      }
    }
  ],
  "mentions": [],
  "tags": [
    {
      "name": "Photomonday",
      "url": "https://fosstodon.org/tags/Photomonday",
      "history": null
    }
  ],
  "card": null,
  "poll": null,
  "application": {
    "id": "",
    "redirect_uri": "",
    "client_id": "",
    "client_secret": ""
  },
  "language": "en",
  "pinned": null
}