Multireddit¶
- class asyncpraw.models.Multireddit(reddit, _data)¶
A class for users’ multireddits.
This is referred to as a “Custom Feed” on the Reddit UI.
Typical Attributes
Note
This table describes attributes that typically belong to objects of this class. Async PRAW dynamically provides the attributes that Reddit returns via the API. Since those attributes are subject to change on Reddit’s end, Async PRAW makes no effort to document any new/removed/changed attributes, other than to instruct you on how to discover what is available. As a result, this table of attributes may not be complete. See Determine Available Attributes of an Object for detailed information.
If you would like to add an attribute to this table, feel free to open a pull request.
Attribute
Description
can_editA
boolrepresenting whether or not the authenticated user may edit the multireddit.copied_fromThe multireddit that the multireddit was copied from, if it exists, otherwise
None.created_utcWhen the multireddit was created, in Unix Time.
description_htmlThe description of the multireddit, as HTML.
description_mdThe description of the multireddit, as Markdown.
display_nameThe display name of the multireddit.
nameThe name of the multireddit.
over_18A
boolrepresenting whether or not the multireddit is restricted for users over 18.subredditsA list of
Subreddits that make up the multireddit.visibilityThe visibility of the multireddit, either
"private","public", or"hidden".- Parameters:
reddit (asyncpraw.Reddit)
- __init__(reddit, _data)¶
Initialize a
Multiredditinstance.
- await add(subreddit)¶
Add a subreddit to this multireddit.
For example, to add r/test to multireddit
bboe/test:subreddit = await reddit.subreddit("test") multireddit = await reddit.multireddit(redditor="bboe", name="test") await multireddit.add(subreddit)
- comments()¶
Provide an instance of
CommentHelper.For example, to output the author of the 25 most recent comments of r/test execute:
subreddit = await reddit.subreddit("test") async for comment in subreddit.comments(limit=25): print(comment.author)
- Return type:
- controversial(*, time_filter='all', **generator_kwargs)¶
Return a
ListingGeneratorfor controversial items.- Parameters:
time_filter (
str) – Can be one of:"all","day","hour","month","week", or"year"(default:"all").generator_kwargs (Unpack[ListingGeneratorKwargs])
- Raises:
ValueErroriftime_filteris invalid.- Return type:
Additional keyword arguments are passed in the initialization of
ListingGenerator.This method can be used like:
reddit.domain("imgur.com").controversial(time_filter="week") multireddit = await reddit.multireddit(redditor="samuraisam", name="programming") multireddit.controversial(time_filter="day") redditor = await reddit.redditor("spez") redditor.controversial(time_filter="month") redditor = await reddit.redditor("spez") redditor.comments.controversial(time_filter="year") redditor = await reddit.redditor("spez") redditor.submissions.controversial(time_filter="all") subreddit = await reddit.subreddit("all") subreddit.controversial(time_filter="hour")
- await copy(*, display_name=None)¶
Copy this multireddit and return the new multireddit.
- Parameters:
display_name (
str|None) – The display name for the copied multireddit. Reddit will generate thenamefield from this display name. When not provided the copy will use the same display name and name as this multireddit.- Return type:
To copy the multireddit
bboe/testwith a name of"testing":multireddit = await reddit.multireddit(redditor="bboe", name="test") await multireddit.copy(display_name="testing")
- property created_datetime: datetime¶
Return the creation time as a timezone-aware
datetime.datetime.The returned object is localized to the system’s timezone.
- await delete()¶
Delete this multireddit.
For example, to delete multireddit
bboe/test:multireddit = await reddit.multireddit(redditor="bboe", name="test") await multireddit.delete()
- Return type:
- hot(**generator_kwargs)¶
Return a
ListingGeneratorfor hot items.Additional keyword arguments are passed in the initialization of
ListingGenerator.This method can be used like:
reddit.domain("imgur.com").hot() multireddit = await reddit.multireddit(redditor="samuraisam", name="programming") multireddit.hot() redditor = await reddit.redditor("spez") redditor.hot() redditor = await reddit.redditor("spez") redditor.comments.hot() redditor = await reddit.redditor("spez") redditor.submissions.hot() subreddit = await reddit.subreddit("all") subreddit.hot()
- Return type:
- Parameters:
generator_kwargs (Unpack[ListingGeneratorKwargs])
- await load()¶
Re-fetches the object.
This is used to explicitly fetch or re-fetch the object from reddit. This method can be used on any
RedditBaseobject.await reddit_base_object.load()
- Return type:
- new(**generator_kwargs)¶
Return a
ListingGeneratorfor new items.Additional keyword arguments are passed in the initialization of
ListingGenerator.This method can be used like:
reddit.domain("imgur.com").new() multireddit = await reddit.multireddit(redditor="samuraisam", name="programming") multireddit.new() redditor = await reddit.redditor("spez") redditor.new() redditor = await reddit.redditor("spez") redditor.comments.new() redditor = await reddit.redditor("spez") redditor.submissions.new() subreddit = await reddit.subreddit("all") subreddit.new()
- Return type:
- Parameters:
generator_kwargs (Unpack[ListingGeneratorKwargs])
- classmethod parse(data, reddit)¶
Return an instance of
clsfromdata.
- await remove(subreddit)¶
Remove a subreddit from this multireddit.
For example, to remove r/test from multireddit
bboe/test:subreddit = await reddit.subreddit("test") multireddit = await reddit.multireddit(redditor="bboe", name="test") await multireddit.remove(subreddit)
- rising(**generator_kwargs)¶
Return a
ListingGeneratorfor rising submissions.Additional keyword arguments are passed in the initialization of
ListingGenerator.For example, to get rising submissions for r/test:
subreddit = await reddit.subreddit("test") async for submission in subreddit.rising(): print(submission.title)
- Return type:
- Parameters:
generator_kwargs (Unpack[ListingGeneratorKwargs])
- staticmethod sluggify(title)¶
Return a slug version of the title.
Adapted from Reddit’s utils.py.
- stream()¶
Provide an instance of
SubredditStream.Streams can be used to indefinitely retrieve new comments made to a multireddit, like:
multireddit = await reddit.multireddit(redditor="spez", name="fun") async for comment in multireddit.stream.comments(): print(comment)
Additionally, new submissions can be retrieved via the stream. In the following example all new submissions to the multireddit are fetched:
multireddit = await reddit.multireddit(redditor="bboe", name="games") async for submission in multireddit.stream.submissions(): print(submission)
- Return type:
- top(*, time_filter='all', **generator_kwargs)¶
Return a
ListingGeneratorfor top items.- Parameters:
time_filter (
str) – Can be one of:"all","day","hour","month","week", or"year "``(default: ``"all").generator_kwargs (Unpack[ListingGeneratorKwargs])
- Raises:
ValueErroriftime_filteris invalid.- Return type:
Additional keyword arguments are passed in the initialization of
ListingGenerator.This method can be used like:
reddit.domain("imgur.com").top(time_filter="week") multireddit = await reddit.multireddit(redditor="samuraisam", name="programming") multireddit.top(time_filter="day") redditor = await reddit.redditor("spez") redditor.top(time_filter="month") redditor = await reddit.redditor("spez") redditor.comments.top(time_filter="year") redditor = await reddit.redditor("spez") redditor.submissions.top(time_filter="all") subreddit = await reddit.subreddit("all") subreddit.top(time_filter="hour")
- await update(**updated_settings)¶
Update this multireddit.
Keyword arguments are passed for settings that should be updated. They can any of:
- Parameters:
display_name – The display name for this multireddit. Must be no longer than 50 characters.
subreddits – Subreddits for this multireddit.
description_md – Description for this multireddit, formatted in Markdown.
icon_name – Can be one of:
"art and design","ask","books","business","cars","comics","cute animals","diy","entertainment","food and drink","funny","games","grooming","health","life advice","military","models pinup","music","news","philosophy","pictures and gifs","science","shopping","sports","style","tech","travel","unusual stories","video", orNone.key_color – RGB hex color code of the form
"#FFFFFF".visibility – Can be one of:
"hidden","private", or"public".weighting_scheme – Can be one of:
"classic"or"fresh".updated_settings (str | list[str | Subreddit | dict[str, str]])
- Return type:
For example, to rename multireddit
"bboe/test"to"bboe/testing":multireddit = await reddit.multireddit(redditor="bboe", name="test") await multireddit.update(display_name="testing")