Fixing bug where tweet text cannot be found in HTML structure
parent
91a325e937
commit
74bc7398bb
11
social.py
11
social.py
|
@ -45,8 +45,17 @@ def getTweets():
|
||||||
for tweet in timeline:
|
for tweet in timeline:
|
||||||
|
|
||||||
tweet_id = tweet['data-item-id']
|
tweet_id = tweet['data-item-id']
|
||||||
tweet_text = tweet.select('p.tweet-text')[0].get_text()
|
|
||||||
|
try:
|
||||||
|
|
||||||
|
tweet_text = tweet.select('p.tweet-text')[0].get_text()
|
||||||
|
|
||||||
|
except:
|
||||||
|
|
||||||
|
helpers._info('getTweets() => No tweet text found. Moving on...')
|
||||||
|
|
||||||
|
continue
|
||||||
|
|
||||||
all_tweets.append({"id": tweet_id, "text": tweet_text})
|
all_tweets.append({"id": tweet_id, "text": tweet_text})
|
||||||
|
|
||||||
return all_tweets if len(all_tweets) > 0 else None
|
return all_tweets if len(all_tweets) > 0 else None
|
||||||
|
|
Loading…
Reference in New Issue