Use simple URL captions for large/unsupported files
When people post URLs pointing to large binary files (e.g. videos), theobot should not try to fetch the entire file only to fail due to timeout or the response size limit.
Instead, it should send a HEAD
request and see what the server reports for Content-Length
and Content-Type
. If the file exceeds the response size limit — or if a content type is reported that we can't produce a meaningful caption for anyway — download should be skipped entirely and a simple caption should be used instead, e.g.:
<alan1> https://pomf2.lain.la/f/nrvd3s1.mp4
NOTICE(theobot) video/mp4, 17.32 MB