Skip to content

Instantly share code, notes, and snippets.

@pooza
Last active July 30, 2018 21:15
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 pooza/f33d2122f4bfd41bd56848e982e7dbf3 to your computer and use it in GitHub Desktop.
Save pooza/f33d2122f4bfd41bd56848e982e7dbf3 to your computer and use it in GitHub Desktop.
公開トゥートに含まれる画像/動画を抜き出す。
SELECT
attachments.id AS attachment_id,
toots.id AS toot_id,
attachments.file_content_type AS content_type,
attachments.file_file_name AS file_name,
attachments.file_file_size AS file_size,
attachments.file_meta AS meta,
attachments.updated_at
FROM media_attachments AS attachments
INNER JOIN statuses AS toots ON attachments.status_id=toots.id
INNER JOIN accounts ON toots.account_id=accounts.id
WHERE (accounts.domain IS NULL)
AND (accounts.locked='f')
AND (toots.visibility=0)
ORDER BY toots.updated_at DESC
LIMIT 100 OFFSET 0;
@pooza
Copy link
Author

pooza commented Jul 30, 2018

toots.visibility をいじれば未収載も含められるはず。
というか、想定している用途はむしろこちら。

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