14 socials integration (#34)

* Create XWrapper.py & ChanWrapper.py
* Tests for in XWrapper & ChanWrapper
* MAX_COMMENTS in social.py
* Soddisfatto Giacomo
* unified_timestamp
This commit was merged in pull request #34.
This commit is contained in:
Nunzi99
2025-10-20 16:56:11 +02:00
committed by GitHub
parent 3adf7ed250
commit 06c660b659
13 changed files with 242 additions and 27 deletions

View File

@@ -1,10 +1,9 @@
import os
from praw import Reddit # type: ignore
from praw.models import Submission # type: ignore
from app.api.core.social import SocialWrapper, SocialPost, SocialComment
from app.api.core.social import *
MAX_COMMENTS = 5
# metterne altri se necessario.
# fonti: https://lkiconsulting.io/marketing/best-crypto-subreddits/
SUBREDDITS = [
@@ -24,13 +23,13 @@ SUBREDDITS = [
def extract_post(post: Submission) -> SocialPost:
social = SocialPost()
social.time = str(post.created)
social.set_timestamp(timestamp_ms=post.created)
social.title = post.title
social.description = post.selftext
for top_comment in post.comments:
comment = SocialComment()
comment.time = str(top_comment.created)
comment.set_timestamp(timestamp_ms=top_comment.created)
comment.description = top_comment.body
social.comments.append(comment)