Screencap¶
- class compuglobal.Screencap(api, json: dict)
Represents a screencap of a TVShow/Movie/Skit generated using an instance of CompuGlobalAPI.
- Parameters
api (CompuGlobalAPI) – The CompuGlobalAPI object that was used to generate the screencap.
json (dict) – The json response from the API for the screencap.
- Variables
frame (Frame) – The representative frame of the screencap.
id (int) – The screencap ID.
key (str) – The episode key (S01E01) of the screencap’s representative frame.
timestamp (int) – The timestamp of the screencap’s represenative frame.
episode (int) – The episode number of the screencap.
season (int) – The season number of the screencap.
title (str) – The title of the episode.
director (str) – The director(s) of the episode.
writer (str) – The writer(s) of the episode.
air_date (str) – The original air date of the episode.
wiki_url (str) – Url to the wiki of the episode.
caption (str) – The caption/subtitles during the screencap.
gif_url (str) – The gif url format for the screencap embedded with a caption.
mp4_url (str) – The mp4 url format for the screencap embedded with a caption.
- get_real_timestamp()¶
Gets a readable timestamp for the frame in format “mm:ss”
- Returns
A readable timestamp for the frame in format mm:ss.
- Return type
str
- get_image_url()¶
Returns the direct image url for the screencap without any caption.
- Returns
The image url for the screencap without any caption.
- Return type
str
- get_meme_url(caption=None)¶
Encodes the caption with base64 and then returns the meme url for the screencap with an embedded caption.
- Parameters
caption (str, optional) – The caption to embed in the image, if it is None, it will use the screencaps original caption.
- Returns
The meme url for the screencap with an embedded caption.
- Return type
str
- get_gif_url(caption=None, before=3000, after=4000)¶
Gets the timestamps of the frames before and after the timestamp of the screencap using the frames endpoint for the screencap’s API and returns the url for the gif with an embedded caption.
- Parameters
caption (str, optional) – The caption to embed in the gif, if it is None, it will use the screencaps original caption.
before (int, optional) – The number of milliseconds before the screencap’s timestamp to begin the gif, defaults to 3 seconds (3000ms).
after (int, optional) – The number of milliseconds after the screencap’s timestamp to begin the gif, defaults to 4 seconds (4000ms).
- Returns
The gif url for the screencap with an embedded caption.
- Return type
str
Note
Defaults gif duration to ~7 seconds (7000ms).
- get_mp4_url(caption=None, before=3000, after=4000)¶
Gets the timestamps of the frames before and after the timestamp of the screencap using the frames endpoint for the screencap’s API and returns the url for the mp4 with an embedded caption.
- Parameters
caption (str, optional) – The caption to embed in the mp4, if it is None, it will use the screencaps original caption.
before (int, optional) – The number of milliseconds before the screencap’s timestamp to begin the mp4, defaults to 3 seconds (3000ms).
after (int, optional) – The number of milliseconds after the screencap’s timestamp to begin the mp4, defaults to 4 seconds (4000ms).
- Returns
The mp4 url for the screencap with an embedded caption.
- Return type
str
Note
Defaults mp4 duration to ~7 seconds (7000ms).