prajwalrajup / Social-Stream

Social Stream is a tool for social media managers and marketers that simplifies the content creation process. It allows users to set up customized feeds based on relevant sources, curate AI-generated descriptions and schedule posts for social media platforms. This ensures users have fresh content and consistent posting.
GNU General Public License v3.0
2 stars 1 forks source link

reddit api to fetch top videos from differernt subredits #2

Open prajwalrajup opened 1 year ago

Joji-dev commented 1 year ago

If you just want to fetch the top x amount of posts instead of a stream you can just use the following

for submission in reddit.subreddit("forsen").top(limit=25):
    print(submission)

You can also use that method to fetch the top posts from multiple subreddits

for submission in reddit.subreddit("forsen+twitch").top(time_filter="all"):
    print(submission)

Alternatively after setting up PRAW you can just use the stream method to get a continuous stream of submissions and/or comments.

for submission in reddit.subreddit("forsen").stream.submissions(skip_existing=True):
    print(submission)

By using skip_existing you will not fetch posts that have already been placed, only posts that are placed after you started running the script.

If you want to check if the post is a video just use

if submission.is_video
    print(submission)
prajwalrajup commented 1 year ago

If you just want to fetch the top x amount of posts instead of a stream you can just use the following

for submission in reddit.subreddit("forsen").top(limit=25):
    print(submission)

You can also use that method to fetch the top posts from multiple subreddits

for submission in reddit.subreddit("forsen+twitch").top(time_filter="all"):
    print(submission)

Alternatively after setting up PRAW you can just use the stream method to get a continuous stream of submissions and/or comments.

for submission in reddit.subreddit("forsen").stream.submissions(skip_existing=True):
    print(submission)

By using skip_existing you will not fetch posts that have already been placed, only posts that are placed after you started running the script.

If you want to check if the post is a video just use

if submission.is_video
    print(submission)

I'm able to get the submissions, but I'm unsure how to convert the stream into an MP4 file that can be uploaded to Instagram. can you please help me with that.