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 7ba770d commit f2906db
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
20 changes: 10 additions & 10 deletions .idea/workspace.xml

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

32 changes: 16 additions & 16 deletions bot/reddit/track.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,12 @@
from dotenv import load_dotenv
load_dotenv()

subreddit = "ClashOfClansRecruit"
secret = getenv("REDDIT_SECRET")
RPW = getenv("REDDIT_PW")

reddit = asyncpraw.Reddit(
client_id="-dOCgLIHqUJK7g",
client_secret= secret,
username="Powerful-Flight2605",
password=RPW,
user_agent="Reply Recruit"
)

producer = KafkaProducer(bootstrap_servers=["85.10.200.219:9092"], api_version=(3, 6, 0))

subreddit = "ClashOfClansRecruit"


async def post_stream():
async def post_stream(reddit: asyncpraw.Reddit):
logger.info("Started Post Stream")
while True:
try:
Expand All @@ -52,7 +42,7 @@ async def post_stream():
logger.error(str(e))
continue

async def comment_stream():
async def comment_stream(reddit: asyncpraw.Reddit):
logger.info("Started Comment Stream")
while True:
try:
Expand Down Expand Up @@ -80,8 +70,18 @@ async def comment_stream():


async def main():
secret = getenv("REDDIT_SECRET")
RPW = getenv("REDDIT_PW")

reddit = asyncpraw.Reddit(
client_id="-dOCgLIHqUJK7g",
client_secret=secret,
username="Powerful-Flight2605",
password=RPW,
user_agent="Reply Recruit"
)
loop = asyncio.get_event_loop()
loop.create_task(comment_stream())
loop.create_task(post_stream())
loop.create_task(comment_stream(reddit))
loop.create_task(post_stream(reddit))


0 comments on commit f2906db

Please sign in to comment.