En Reddit, un redditor es el término dado a un usuario. Un moderador es un redditor responsable de la moderación del contenido de un subreddit. Aquí veremos cómo obtener todos los subreddits que está moderando un redditor. Usaremos el moderated()
método de la Redditor
clase para obtener la lista de subreddits moderados del redditor.
moderado()
Sintaxis: Redditor.moderated()
Parámetro: Ninguno
Devoluciones: Lista de objetos de clase Subreddit
Ejemplo 1: Considere el siguiente redditor:
El nombre de usuario del redditor es: spez.
# importing the module import praw # initialize with appropriate values client_id = "" client_secret = "" username = "" password = "" user_agent = "" # creating an authorized reddit instance reddit = praw.Reddit(client_id = client_id, client_secret = client_secret, username = username, password = password, user_agent = user_agent) # the name of the redditor redditor_name = "spez" # instantiating the Redditor class redditor = reddit.redditor(redditor_name) # fetching the list of moderated subreddits subreddits = redditor.moderated() # printing the name of the subreddits for subreddit in subreddits: print(subreddit)
Producción :
announcements blog programming HighQualityGifs OutOfTheLoop SubredditDrama business PartyParrot modnews Layer redditdev redesign hero0fwar reddit_fact_check yourweek spez metaskreddit hipmunk guild modprogramming
Ejemplo 2: Considere el siguiente redditor:
El nombre de usuario del redditor es: AutoModerador
# importing the module import praw # initialize with appropriate values client_id = "" client_secret = "" username = "" password = "" user_agent = "" # creating an authorized reddit instance reddit = praw.Reddit(client_id = client_id, client_secret = client_secret, username = username, password = password, user_agent = user_agent) # the name of the redditor redditor_name = "AutoModerator" # instantiating the Redditor class redditor = reddit.redditor(redditor_name) # fetching the list of moderated subreddits subreddits = redditor.moderated() # counting the number od subreddits moderated print(redditor_name + " is a moderator of " + str(len(subreddits)) + " number of subreddits.")
Producción :
AutoModerator is a moderator of 10024 number of subreddits.