python - Twitter API: How to parse URL's out of the text of the tweet using the given list of API's -


so i'm working python , twitter api, using tweepy , twitter's stream api, returns tweet objects in real-time. part of app queries different api doesn't play nice urls in tweet text, i'm using python re module replace them harmless identifier string. however, i'm having trouble finding urls need parsed out of text. instead of having search through text myself urls, decided use ones api delivers , "find , replace" in text.

here is documentation on api gives me. gives t.co url, display url, , expanded url. problem using t.co url twiter doesn't automatically convert urls in tweets t.co, ones past length. means t.co url isn't same 1 appears in tweet text.

so need figure out how get, api, version of url appears in text of tweet.

thanks! evamvid

try using extended_url:

tweet_url = str(tweet.expanded_url) # might not need str(),  #test if you'd like.  # replace tweet loop/function have json extracted  tweet_url = tweet_url.replace('\\', '')  print(tweet_url) 

that should give link without way want it.


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -