سؤال

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)?

هل كانت مفيدة؟

المحلول

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top