Back to articles
How to Build a Social Proof Aggregator: Track Mentions Across Twitter, Reddit, and HN
How-ToSystems

How to Build a Social Proof Aggregator: Track Mentions Across Twitter, Reddit, and HN

via Dev.to Tutorialagenthustler

Social proof drives conversions. Aggregate product mentions from Reddit and HN automatically. Reddit Search import requests from bs4 import BeautifulSoup import time from datetime import datetime , timedelta class SocialProof : def __init__ ( self , keywords ): self . kw = keywords self . mentions = [] self . s = requests . Session () self . s . headers [ " User-Agent " ] = " SocialProofBot/1.0 " def reddit ( self , limit = 100 ): found = [] for kw in self . kw : r = self . s . get ( " https://www.reddit.com/search.json " , params = { " q " : kw , " sort " : " new " , " limit " : min ( limit , 100 ), " t " : " month " }) if r . status_code != 200 : continue for p in r . json (). get ( " data " ,{}). get ( " children " ,[]): d = p [ " data " ] found . append ({ " platform " : " reddit " , " text " : d . get ( " title " , "" ), " url " : f " https://reddit.com { d . get ( ' permalink ' , '' ) } " , " score " : d . get ( " score " , 0 ), " date " : datetime . fromtimestamp ( d [ " created

Continue reading on Dev.to Tutorial

Opens in a new tab

Read Full Article
2 views

Related Articles