mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-22 19:28:09 -06:00
Fixed long tweets display for retweeted statuses
This commit is contained in:
parent
cdedd41101
commit
44ca5a7f83
@ -18,13 +18,15 @@
|
|||||||
############################################################
|
############################################################
|
||||||
import requests
|
import requests
|
||||||
import keys
|
import keys
|
||||||
|
import logging
|
||||||
|
log = logging.getLogger("long_tweets.twishort")
|
||||||
from twitter import utils
|
from twitter import utils
|
||||||
from requests_oauthlib import OAuth1Session
|
from requests_oauthlib import OAuth1Session
|
||||||
|
|
||||||
def get_twishort_uri(url):
|
def get_twishort_uri(url):
|
||||||
try:
|
try:
|
||||||
return url.split("twishort.com/")[1]
|
return url.split("twishort.com/")[1]
|
||||||
except IndexError:
|
except ValueError:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def is_long(tweet):
|
def is_long(tweet):
|
||||||
@ -33,8 +35,15 @@ def is_long(tweet):
|
|||||||
try:
|
try:
|
||||||
if "twishort.com" in tweet["entities"]["urls"][url]["expanded_url"]:
|
if "twishort.com" in tweet["entities"]["urls"][url]["expanded_url"]:
|
||||||
long = get_twishort_uri(tweet["entities"]["urls"][url]["expanded_url"])
|
long = get_twishort_uri(tweet["entities"]["urls"][url]["expanded_url"])
|
||||||
except TypeError:
|
except IndexError:
|
||||||
pass
|
pass
|
||||||
|
if long == False and tweet.has_key("retweeted_status"):
|
||||||
|
for url in range(0, len(tweet["retweeted_status"]["entities"]["urls"])):
|
||||||
|
try:
|
||||||
|
if "twishort.com" in tweet["retweeted_status"]["entities"]["urls"][url]["expanded_url"]:
|
||||||
|
long = get_twishort_uri(tweet["retweeted_status"]["entities"]["urls"][url]["expanded_url"])
|
||||||
|
except IndexError:
|
||||||
|
pass
|
||||||
return long
|
return long
|
||||||
|
|
||||||
def get_full_text(uri):
|
def get_full_text(uri):
|
||||||
|
Loading…
Reference in New Issue
Block a user