Conversation
add img method for get Image from twitter
|
@sterzuccio Good day, I made a similar implementation following Twitter docs directions from here: Message attachments#Retrieving media I keep getting 302 redirections. Thanks. |
|
I made a simple modification to be able to take the images I receive from the Twitter chat. So far everything is working fine and I have not received any 302s. |
Are you referring to the Direct Messages returned from Account Activity API? |
|
Yes, Direct Messages and Twitter API |
I'm so confused about this |
|
code 302 is a temporary redirect code. I don't know why it gives you this error. But can you download / view the image? Or can't you even download it? |
I can view it for sure on Twitter. But via code, no luck. Nothing in the docs helps at all... however, this line: The endpoint must deny all cross-origin requests |
|
have you tried to fork my code? maybe you have more luck and you can start from that |
I have used the OAuth code here as a reference. |
|
I have no knowledge of elixir. If it can help you, the problem that the library had was that it didn't always take the file size and I solved it by putting an if in line which, in case it doesn't find the size, it just puts 0 |
I'm not sure I follow what you mean by file size, but do you mean attaching one of the size-keys from the https://ton.twitter.com/i/ton/data/dm/1547580822294646788/1547580751654203394/T7xt1pvd.jpg:small when I right-click an image in Twitter Direct Message and view in a new tab, the image URLs always have a IF I remove this |
|
does not show me the image, 401 error because I do not have the authorization. The link that opens to you from the right click has nothing to do with the link that passes you in the DM if I remember correctly. That is generated differently I think. |
Just saw these 2: https://twittercommunity.com/t/fetching-dm-media-problems-302-response-code/131887 Maybe I'll get something. Thanks again for your time. |
|
I have read. From what I understand the problem lies in the authentication. To be able to view, and therefore to be able to download, an image from a DM you must be authenticated. You should develop the code with this in mind. I believe there are no different solutions. |
|
Sure I am using Oauth authentication, as usual, what is confusing is the conversation from https://twittercommunity.com/t/dm-media-download-results-in-redirection-loop/95301 seems he had to manually modify the headers which is weird |
|
the code suggested as a solution doesn't work for you? |
I will try that and see if I Can get same or similar response, apparently something is foul in my OAuth implementation |
|
Let me know if you can find a solution. I'm curious. Good luck with the development. |
|
@sterzuccio so sorry for all this disturbance I had hard-coded |
|
no disturbance |
Add img method for get Image from twitter