reddit.live¶
- class praw.models.LiveHelper(reddit: praw.Reddit, _data: Optional[Dict[str, Any]])¶
Provide a set of functions to interact with LiveThreads.
- __call__(id: str) praw.models.LiveThread ¶
Return a new lazy instance of
LiveThread
.This method is intended to be used as:
livethread = reddit.live("ukaeu1ik4sw5")
- Parameters
id – A live thread ID, e.g.,
ukaeu1ik4sw5
.
- __init__(reddit: praw.Reddit, _data: Optional[Dict[str, Any]])¶
Initialize a PRAWModel instance.
- Parameters
reddit – An instance of
Reddit
.
- create(title: str, description: Optional[str] = None, nsfw: bool = False, resources: str = None) praw.models.LiveThread ¶
Create a new LiveThread.
- Parameters
title – The title of the new LiveThread.
description – (Optional) The new LiveThread’s description.
nsfw – (boolean) Indicate whether this thread is not safe for work (default: False).
resources – (Optional) Markdown formatted information that is useful for the LiveThread.
- Returns
The new LiveThread object.
- info(ids: List[str]) Generator[praw.models.LiveThread, None, None] ¶
Fetch information about each live thread in
ids
.- Parameters
ids – A list of IDs for a live thread.
- Returns
A generator that yields
LiveThread
instances.
Live threads that cannot be matched will not be generated. Requests will be issued in batches for each 100 IDs.
Warning
Unlike
Reddit.info()
, the output of this method may not reflect the order of input.Usage:
ids = ["3rgnbke2rai6hen7ciytwcxadi", "sw7bubeycai6hey4ciytwamw3a", "t8jnufucss07"] for thread in reddit.live.info(ids): print(thread.title)
- now() Optional[praw.models.LiveThread] ¶
Get the currently featured live thread.
- Returns
The
LiveThread
object, orNone
if there is no currently featured live thread.
Usage:
thread = reddit.live.now() # LiveThread object or None
- classmethod parse(data: Dict[str, Any], reddit: praw.Reddit) Any ¶
Return an instance of
cls
fromdata
.- Parameters
data – The structured data.
reddit – An instance of
Reddit
.