Skip to content

Commit

Permalink
add: reddit comment tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
MagicTheDev committed Jul 14, 2024
1 parent efe7816 commit c4dc6f6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
27 changes: 12 additions & 15 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions bot/reddit/track.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import re
import orjson
import pendulum as pend
from loguru import logger

from kafka import KafkaProducer
from os import getenv
Expand All @@ -26,6 +27,7 @@


async def post_stream():
logger.info("Started Post Stream")
while True:
try:
count = 0
Expand All @@ -47,9 +49,11 @@ async def post_stream():
"tags" : tags}}
producer.send(topic="reddit", value=orjson.dumps(json_data), timestamp_ms=int(pend.now(tz=pend.UTC).timestamp()) * 1000)
except Exception as e:
logger.error(str(e))
continue

async def comment_stream():
logger.info("Started Comment Stream")
while True:
try:
count = 0
Expand All @@ -69,6 +73,7 @@ async def comment_stream():
}}
producer.send(topic="reddit", value=orjson.dumps(json_data), timestamp_ms=int(pend.now(tz=pend.UTC).timestamp()) * 1000)
except Exception as e:
logger.error(str(e))
continue


Expand Down

0 comments on commit c4dc6f6

Please sign in to comment.