En Reddit, un redditor es el término dado a un usuario. Un redditor puede ganar ciertos trofeos. Aquí veremos cómo obtener todos los trofeos que tiene un redditor. Usaremos el trophies()
método de la Redditor
clase para obtener todos los trofeos que tiene un redditor.
trofeos()
Sintaxis: Redditor.trophies()
Parámetro: Ninguno
Devoluciones : Lista de objetos de clase Trofeo
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 tropies trophies = redditor.trophies() # printing the name of the trophies for trophy in trophies: print(trophy)
Producción :
15-Year Club Inciteful Comment Inciteful Link RPAN Viewer Not Forgotten Sequence | Editor Spared Alpha Tester Inciteful Comment Inciteful Link redditgifts Exchanges Inciteful Comment Beta Team Inciteful Link Inciteful Comment Inciteful Link Inciteful Link Inciteful Link Inciteful Link Best Comment Best Comment Reddit Premium reddit mold Rally Monkey Verified Email ComboCommenter
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 tropies trophies = redditor.trophies() # printing the name of the trophies for trophy in trophies: print(trophy)
Producción :
Eight-Year Club Undead | Zombie Inciteful Comment Inciteful Comment Well-rounded Inciteful Comment Well-rounded Well-rounded Reddit Premium