CONTENTS:
__init__(self, data: Dict[str, Union[str, int]], uid: int, is_logged_in: bool, session)
like(timeout: int = 10) -> bool
unlike(timeout: int = 10) -> bool
delete(timeout: int = 10) -> bool
report(timeout: int = 10) -> bool
reply_to_comment(body: str, timeout: int = 10) -> bool
get_replies(timeout: int = 10) -> Union[Dict[str, Union[str, int]], bool]
The Comment class represents a comment on an Aparat video and provides methods to interact with the comment, such as liking, unliking, deleting, reporting, replying, and retrieving replies.
Comment
id (str): Comment ID.
id
body (str): Content of the comment.
body
reply (str): Reply content if the comment is a reply to another comment.
reply
sdate (str): Submission date of the comment.
sdate
sdate_timediff (str): Time difference since the comment was submitted.
sdate_timediff
sdate_gregorian (str): Gregorian submission date of the comment.
sdate_gregorian
replyAction (str): Action link to reply to the comment.
replyAction
replyDelete (str): Action link to delete a reply to the comment.
replyDelete
text (str): Text content of the comment.
text
type (str): Type of the comment.
type
approve_link_text (str): Text of the approval link.
approve_link_text
approve_link_href (str): Href of the approval link.
approve_link_href
approved (str): Approval status of the comment.
approved
approve_raw (str): Raw approval status of the comment.
approve_raw
isYours (bool): Indicates if the comment is made by the logged-in user.
isYours
deleted (bool): Indicates if the comment is deleted.
deleted
like_cnt (int): Number of likes for the comment.
like_cnt
reply_cnt (int): Number of replies to the comment.
reply_cnt
mentioned_user_id (str): ID of the mentioned user in the comment.
mentioned_user_id
mentioned_name (str): Name of the mentioned user in the comment.
mentioned_name
need_approve (bool): Indicates if the comment needs approval.
need_approve
spam (bool): Indicates if the comment is marked as spam.
spam
is_pinned (bool): Indicates if the comment is pinned.
is_pinned
Initialize a Comment object.
data: Dictionary containing comment data.
data
uid: UID of the associated video.
uid
is_logged_in: Boolean indicating whether the user is logged in.
is_logged_in
session: Session object for making HTTP requests.
session
Like the comment.
timeout: Timeout for the HTTP request (default is 10 seconds).
timeout
Returns: True if the comment is successfully liked, False otherwise.
Unlike the comment.
Returns: True if the comment is successfully unliked, False otherwise.
Delete the comment.
Returns: True if the comment is successfully deleted, False otherwise.
Raises:
LoginRequiredError: If the user is not logged in.
LoginRequiredError
ValueError: If the comment does not have a delete URL.
ValueError
Report the comment.
Returns: True if the comment is successfully reported, False otherwise.
Raises: ValueError if the comment does not have a report URL.
Reply to the comment.
body: The content of the reply.
Returns: True if the reply is successfully posted, False otherwise.
Get replies to the comment.
Returns: A dictionary containing reply data if replies exist, an empty list if there are no replies, or False if an error occurs.
Comment Interactions
The
Commentclass represents a comment on an Aparat video and provides methods to interact with the comment, such as liking, unliking, deleting, reporting, replying, and retrieving replies.Attributes
id(str): Comment ID.body(str): Content of the comment.reply(str): Reply content if the comment is a reply to another comment.sdate(str): Submission date of the comment.sdate_timediff(str): Time difference since the comment was submitted.sdate_gregorian(str): Gregorian submission date of the comment.replyAction(str): Action link to reply to the comment.replyDelete(str): Action link to delete a reply to the comment.text(str): Text content of the comment.type(str): Type of the comment.approve_link_text(str): Text of the approval link.approve_link_href(str): Href of the approval link.approved(str): Approval status of the comment.approve_raw(str): Raw approval status of the comment.isYours(bool): Indicates if the comment is made by the logged-in user.deleted(bool): Indicates if the comment is deleted.like_cnt(int): Number of likes for the comment.reply_cnt(int): Number of replies to the comment.mentioned_user_id(str): ID of the mentioned user in the comment.mentioned_name(str): Name of the mentioned user in the comment.need_approve(bool): Indicates if the comment needs approval.spam(bool): Indicates if the comment is marked as spam.is_pinned(bool): Indicates if the comment is pinned.Methods
__init__(self, data: Dict[str, Union[str, int]], uid: int, is_logged_in: bool, session)Initialize a Comment object.
data: Dictionary containing comment data.uid: UID of the associated video.is_logged_in: Boolean indicating whether the user is logged in.session: Session object for making HTTP requests.like(timeout: int = 10) -> boolLike the comment.
timeout: Timeout for the HTTP request (default is 10 seconds).Returns: True if the comment is successfully liked, False otherwise.
unlike(timeout: int = 10) -> boolUnlike the comment.
timeout: Timeout for the HTTP request (default is 10 seconds).Returns: True if the comment is successfully unliked, False otherwise.
delete(timeout: int = 10) -> boolDelete the comment.
timeout: Timeout for the HTTP request (default is 10 seconds).Returns: True if the comment is successfully deleted, False otherwise.
Raises:
LoginRequiredError: If the user is not logged in.ValueError: If the comment does not have a delete URL.report(timeout: int = 10) -> boolReport the comment.
timeout: Timeout for the HTTP request (default is 10 seconds).Returns: True if the comment is successfully reported, False otherwise.
Raises:
ValueErrorif the comment does not have a report URL.get_replies(timeout: int = 10) -> Union[Dict[str, Union[str, int]], bool]Get replies to the comment.
timeout: Timeout for the HTTP request (default is 10 seconds).Returns: A dictionary containing reply data if replies exist, an empty list if there are no replies, or False if an error occurs.