Update talenttweet.py
This commit is contained in:
+8
-5
@@ -83,17 +83,19 @@ class TalentTweet:
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def create_from_tweety(tweety: Tweet):
|
def create_from_tweety(tweety: Tweet):
|
||||||
if tweety.is_retweet:
|
if tweety.is_retweet:
|
||||||
rtm = [int(x.id) for x in tweety.retweeted_tweet.user_mentions]
|
rtm = {int(x.id) for x in tweety.retweeted_tweet.user_mentions}
|
||||||
elif tweety.quoted_tweet:
|
elif tweety.quoted_tweet:
|
||||||
rtm = [int(x.id) for x in tweety.quoted_tweet.user_mentions]
|
rtm = {int(x.id) for x in tweety.quoted_tweet.user_mentions}
|
||||||
|
elif tweety.replied_to:
|
||||||
|
rtm = {int(x.id) for x in tweety.replied_to.user_mentions}
|
||||||
else:
|
else:
|
||||||
rtm = list()
|
rtm = set()
|
||||||
|
|
||||||
return TalentTweet(
|
return TalentTweet(
|
||||||
tweet_id=int(tweety.id), author_id=int(tweety.author.id),
|
tweet_id=int(tweety.id), author_id=int(tweety.author.id),
|
||||||
date_time=tweety.date, text=tweety.text,
|
date_time=tweety.date, text=tweety.text,
|
||||||
mrq=(
|
mrq=(
|
||||||
[int(x.id) for x in tweety.user_mentions],
|
{int(x.id) for x in tweety.user_mentions},
|
||||||
int(tweety.original_tweet['in_reply_to_user_id_str']) if tweety.is_reply else None,
|
int(tweety.original_tweet['in_reply_to_user_id_str']) if tweety.is_reply else None,
|
||||||
int(tweety.quoted_tweet.author.id) if tweety.quoted_tweet is not None else None
|
int(tweety.quoted_tweet.author.id) if tweety.quoted_tweet is not None else None
|
||||||
),
|
),
|
||||||
@@ -145,6 +147,7 @@ class TalentTweet:
|
|||||||
f'parties: {self.get_all_parties_usernames()}\n'
|
f'parties: {self.get_all_parties_usernames()}\n'
|
||||||
f'mentions: {self.mentions}\n'
|
f'mentions: {self.mentions}\n'
|
||||||
f'reply_to: {self.reply_to}\n'
|
f'reply_to: {self.reply_to}\n'
|
||||||
|
f'rtm: {self.rt_mentions}\n'
|
||||||
f'quote_retweeted: {self.quote_tweeted}\n'
|
f'quote_retweeted: {self.quote_tweeted}\n'
|
||||||
f'cross-company? {self.is_cross_company()}\n'
|
f'cross-company? {self.is_cross_company()}\n'
|
||||||
f'{self.serialize()}\n'
|
f'{self.serialize()}\n'
|
||||||
@@ -232,7 +235,7 @@ class TalentTweet:
|
|||||||
# mention line
|
# mention line
|
||||||
if len(mention_usernames) > 0:
|
if len(mention_usernames) > 0:
|
||||||
ret += (
|
ret += (
|
||||||
'\nMentioning '
|
'\nMentions: '
|
||||||
f'{", ".join(mention_usernames)}'
|
f'{", ".join(mention_usernames)}'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user