Skip to content

Commit

Permalink
Updated requirements + parse tweet
Browse files Browse the repository at this point in the history
  • Loading branch information
StephanAkkerman committed Jul 29, 2024
1 parent a7b9b21 commit 2d69d14
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
11 changes: 6 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
yahoo-fin==0.8.9.1
numpy==1.26.4
yfinance==0.2.40
yfinance==0.2.41
pycoingecko==3.1.0
pandas==2.2.2
requests==2.32.3
PyYAML==6.0.1
tradingview-ta==3.3.0
aiohttp==3.9.5
asyncpraw==7.7.1
ccxt==4.3.65
transformers==4.41.1
matplotlib==3.9.0
ccxt==4.3.68
transformers==4.43.3
matplotlib==3.9.1
scipy==1.14.0
brotli==1.1.0
py-cord==2.6.0
Expand All @@ -19,4 +19,5 @@ tls-client==1.0.1
uncurl==0.0.11
yahooquery==2.3.7
nltk==3.8.1
timm==1.0.7
timm==1.0.8
seaborn==0.13.2
18 changes: 15 additions & 3 deletions src/util/parse_tweet.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,18 +203,30 @@ def parse_tweet(tweet: dict, update_tweet_id: bool = False):
hashtags += r_hashtags

if reply and replied_tweet:
e_title = f"{util.vars.custom_emojis['reply']} {user_name} replied to {r_user_name}"
if "reply" in util.vars.custom_emojis:
e_title = f"{util.vars.custom_emojis['reply']} {user_name} replied to {r_user_name}"
else:
e_title = f"{user_name} replied to {r_user_name}"

text = "\n".join(map(lambda line: "> " + line, text.split("\n")))
text = f"> [@{r_user_screen_name}](https://twitter.com/{r_user_screen_name}):\n{text}\n\n{r_text}"

# Add text on top
if quoted_status_result and replied_tweet:
e_title = f"{util.vars.custom_emojis['quote_tweet']} {user_name} quote tweeted {r_user_name}"
if "quote_tweet" in util.vars.custom_emojis:
e_title = f"{util.vars.custom_emojis['quote_tweet']} {user_name} quote tweeted {r_user_name}"
else:
e_title = f"{user_name} quote tweeted {r_user_name}"

q_text = "\n".join(map(lambda line: "> " + line, r_text.split("\n")))
text = f"{text}\n\n> [@{r_user_screen_name}](https://twitter.com/{r_user_screen_name}):\n{q_text}"

if retweeted_status_result and replied_tweet:
e_title = f"{util.vars.custom_emojis['retweet']} {user_name} retweeted {r_user_name}"
if "retweet" in util.vars.custom_emojis:
e_title = f"{util.vars.custom_emojis['retweet']} {user_name} retweeted {r_user_name}"
else:
e_title = f"{user_name} retweeted {r_user_name}"

# Use the full retweeted text (otherwise the tweet text is cut off)
text = r_text

Expand Down

0 comments on commit 2d69d14

Please sign in to comment.