Instantly share code, notes, and snippets.

Embed
What would you like to do?
Hacking together bits of mastodon.el to load @Gargron's toots with media
(defun lookup-user (user)
(let* ((json (mastodon-http--get-json
(mastodon-http--api (concat "search?q="
user))))
(accounts (cdr(assoc 'accounts json)))
(acct (mapcar (lambda(account) (cdr (assoc 'acct account)))
accounts))
(ids (mapcar (lambda(account) (cdr (assoc 'id account)))
accounts)))
(cl-mapcar (lambda(a b) (list a b)) acct ids)))
(defun user-media-timelines-init (id)
(mastodon-tl--init "media"
(concat "accounts/" id "/statuses?only_media=true")
'mastodon-tl--timeline))
(defun user-media-timelines (username)
(user-media-timelines-init (cadar (lookup-user username))))
;; set mastodon-instance-url to your instance
(let ((mastodon-instance-url "https://cybre.space"))
(user-media-timelines "gargron@mastodon.social"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment