Last active
September 10, 2022 13:41
-
-
Save odunola499/4262f076f37e5f2882a9cf9f42273577 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while True: | |
res = requests.get(f'{api}/r/wallstreetbets/new', headers = headers, | |
params = {'limit': '100', 'after':df['name'].iloc[len(df) - 1]}) | |
if len(res.json()['data']['children']) == 0 : | |
break | |
for post in res.json()['data']['children']: | |
df = df.append({ | |
'name':post['data']['name'], | |
'created_utc': post['data']['created_utc'], | |
'subreddit':post['data']['subreddit'], | |
'title':post['data']['title'], | |
'selftext':post['data']['selftext'], | |
'upvote_ratio':post['data']['upvote_ratio'], | |
'ups':post['data']['ups'], | |
'downs':post['data']['downs'], | |
'score':post['data']['score'] | |
}, ignore_index = True) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment