logo
Tags down

shadow

PRAW bot only parsing one subreddit when wanted to parse multiple


By : Kuopawn
Date : October 17 2020, 06:10 PM
wish of those help If you want 5 results from each sub youd be better off using a for loop over a list of subs.
code :
subs_to_search = ['nba', 'nbadiscussion', 'warriors', 'NYKnicks']

for sub_name in subs_to_search:
    sub = r.subreddit(sub_name)
    subs = sub.top('year', limit=5)

    for posts in subs:
        article_url = posts.url
        post_title = posts.title
        print(post_title)
        print(article_url)



Share : facebook icon twitter icon

I'd like to get a list of the top posts of all time in a subreddit using praw


By : Marco Tranchino
Date : March 29 2020, 07:55 AM
should help you out From the documentation, looks like get_top_from_all()

Getting all submissions for the past two months from a particular subreddit (using PRAW)?


By : Mark Bennett
Date : March 29 2020, 07:55 AM
like below fixes the issue You can use the Cloudsearch syntax to search between 2 timestamps. The syntax is:
code :
timestamp:START_UNIX_TIMESTAMP..END_UNIX_TIMESTAMP
import time
current_timestamp = time.time()
# 60 seconds * 60 minutes * 24 hours * 60 days = 2 months
two_months_timestamp = current_timestamp - (60 * 60 * 24 * 60)
query = 'timestamp:{}..{}'.format(current_timestamp, two_months_timestamp)
results = reddit.subreddit('test').search(query, sort='new')

PRAW 6: Get all submission of a subreddit


By : crolfe
Date : March 29 2020, 07:55 AM
To fix this issue Unfortunately, Reddit removed this function from their API.
Check out the PRAW changelog. One of the changes in version 6.0.0 is:
code :
https://api.pushshift.io/reddit/submission/search/?after=1334426439&before=1339696839&sort_type=score&sort=desc&subreddit=translator

How to get a random subreddit using praw and python3?


By : Kirill Miroshnychenk
Date : March 29 2020, 07:55 AM
I hope this helps you . I've tried googling and all I could find was how to get a random submission from a specific subreddit, but not a random subreddit. I remember reading about it weeks ago on some website but for the life of me I cannot find out where it was. ,
random_subreddit(nsfw=False)

Can you use PRAW to find someone's first comment in a subreddit?


By : Jonny
Date : March 29 2020, 07:55 AM
Hope that helps The only way I can think of doing it is by parsing all his comments and filtering out those comments made on that specific subreddit. You can then sort that list based on comment.created_utc and get the oldest comment.
You can parse all the comments of a user and filter comments from a specific subreddit like so -
code :
user = reddit.redditor('username')
target_subreddit = 'target_subreddit'
comment_list = []
# This iterates over all the comments made by the user
for comment in user.comments.new(limit=None):
    # Check if a comment belongs to your target subreddit
    if str(comment.subreddit) == target_subreddit:
        comment_list.append(comment)

# Sort comment_list based on comment.created_utc to get the oldest comment
...
Related Posts Related Posts :
  • Ensure positive difference of two numbers
  • i keep getting an error that my list index is out of range
  • Is there a way to create gantt charts in python?
  • How to view network weights and bias during training
  • How can I force SAS to wait for a command to fully execute?
  • Remove all occurences of a value from a nested dictionary
  • How to ensure secure randomization for python password generator
  • Amazon SageMaker deploying from model artifacts - what object do we load from archive?
  • [] parameter or input used in sum() function - what is it doing?
  • Outlook email text formatting from Python application
  • Python 3 - comparing enums against hex value
  • Elegant way to check if a float is between two numbers in Python?
  • Understanding return [0,size-1][nums[0]<nums[size-1]] in Python
  • How do I make this script that heats up my CPU safe
  • RegEx for matching capital letters and numbers
  • What is differnces between array[0] and array[0:1] in Python?
  • How to run both items in scrapy function?
  • How to count the number of sequences of n numbers where no two adjacent numbers are the same?
  • Is there a more efficient way to re-write multi if-else statement
  • ValueError: Error when checking target: expected dense_3 to have shape (1000,) but got array with shape (1,)
  • SytanxError: Invalid Sytax
  • Setting debug = False makes the Django app crash with the following error, how to fix it?
  • How to get the average of many lists embedded within each other?
  • Paramiko with subprocess
  • 2D table conversion for example: y = f(x1,x2) => x1 = f(y, x2)
  • Return a literal string of a tuple in python
  • How to split a Column when you have same values?
  • How to perform str.strip in dataframe and save it with inplace=true?
  • why zip(*k) can't work when k is a iterator?
  • How to get list as an input from command line python?
  • Is Tensorflow Dataset.from_generator deprecated in tensorflow 2.0 ? It throws tf.py_func deprecation error
  • Loop as long as input is greater then previous input
  • How to combine 2 rows based on different column values
  • Extracting 3 levels deep product details. Getting error NameError: name 'item' is not defined
  • How do I get the default fill values?
  • How to convert single list's elements in form of dictionary
  • Search a user given number inside a list using for loop
  • How to extract a particular value from this data structure?
  • How to save a df into two excel files in multiple locations?
  • How to get the sum of a field in Django
  • i+ =1 generating a Syntax error in for loop
  • Lookup if Dictionary key contains items in Python
  • How to comma separate an array of integers in python?
  • Extract rows from pandas dataframe corresponding to list of month-day
  • Reading formatted array from file in Python
  • Python Error: can't install scipy.optimize.brentq
  • Why isn't my gradient descent algorithm working?
  • How to find a 'str' in a 2-D array and return element in next column?
  • Code not outputting a value in hackerrank
  • Fibonacci sequence calculator seems correct but can't find similar code online. Is there something wrong?
  • Can't call attribute of class within the class itself in Python 3.6.5
  • How to make a loop in dictionary to extract values?
  • Is there a way of aggregating rows without summing up their results?
  • I am having a problem with understanding this python code
  • Stop number decrease once 0 reached on dice game - Python
  • Is possible to make a binary search by searching between unknown values?
  • pass object method as function argument for method chaining in python
  • pylint W0622 (Redefining built-in) when overriding "standard" methods in subclasses
  • Extract values from String using Python
  • How do I get a bytearray from a Tkinter entry widget
  • shadow
    Privacy Policy - Terms - Contact Us © 35dp-dentalpractice.co.uk