(i’ve had to modify several links because I’m only able to post 2 of them due to glitch rules)
I’m trying to build a twitter bot that:
- downloads an image from an API,
- downloads some info (via json) from a separate API
- saves image locally and then upload it to twitter
- inserts alt_text for image;
- posts the tweet.
My code is at:
And occasionally, it works as intended!
(see the results at twitter user: publiccleveland)
How it’s run:
- hit the secret endpoint. (server.js:166:0) e.g. spiral-tennis.glitch.me/mysecretendpoint which
(the downloads of the image, adds metadata, posts the tweet)
I’ve observed that, if I do not visit my bot’s endpoint for at least 4-5 hours and then visit it,
what happens is:
The b64content of my image is logged in my console and the tweet is successfully sent out!
If I do visit my endpoint within a 4-5 hour as the last time that I did:
the b64content of my image does not appear in the console (server.js:123:2) and tries to upload the media/upload function
"Error: media type unrecognized."
As far as I can tell, I’ve double checked that I’m not rate-limited by twitter, according to the output of:
twurl /1.1/application/rate_limit_status.json | jq .
I’ve read glitch’s restrictions
and I don’t think that I’m encountering any of them (the image that is download to the same file name)
but I’m not sure…
Any ideas on the glitch side of things that I am doing incorrectly?
Am I being rate limited by glitch of downloading photos into my account?
Is this a twitter API rate limit?
Lastly, the twit library, a popular twitter api library for node, has many outstanding PRs, so I’m using a modified fork of it that has the PRs merged in. (I can’t post more than 2 links, so see package.json for the library link)
Thanks in advance for any assistance.