Pergunta

I'm retrieving tweets via the Twitter anywhere API. I would like to treat pure text tweets and tweets that contain a picture differently.
I can do that by filtering for pic.twitter.com urls. Unfortunately the API delivers short urls ala t.co.

Is there a way to resolve these via Javascript (jQuery)?

Foi útil?

Solução

You won't be able to resolve t.co URLs with AJAX because of Same Origin Policy. Basically, you are only allow to make requests to the server that hosts your page.

However, Twitter has a very rich API and contains very detailed metadata about elements in each tweet. You should read the tweet entities documentation. These fields appear in the JSON documents of the REST API.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top