Skip to content

result

Result is a class that contains all the information about a result from search performed by audio provider.

Result(source, url, verified, name, duration, author, result_id, isrc_search=None, search_query=None, artists=None, views=None, explicit=None, album=None, year=None, track_number=None, genre=None, lyrics=None) dataclass ¤

Result is a class that contains all the information about a result from search perfoermed by audio provider.

json: Dict[str, Any] property ¤

Returns a dictionary of the song's data.

Returns¤
  • The dictionary.

from_data_dump(data) classmethod ¤

Create a Result object from a data dump.

Arguments¤
  • data: The data dump.
Returns¤
  • The Song object.
Source code in spotdl/types/result.py
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
@classmethod
def from_data_dump(cls, data: str) -> "Result":
    """
    Create a Result object from a data dump.

    ### Arguments
    - data: The data dump.

    ### Returns
    - The Song object.
    """

    # Create dict from json string
    data_dict = json.loads(data)

    # Return product object
    return cls(**data_dict)

from_dict(data) classmethod ¤

Create a Song object from a dictionary.

Arguments¤
  • data: The dictionary.
Returns¤
  • The Song object.
Source code in spotdl/types/result.py
63
64
65
66
67
68
69
70
71
72
73
74
75
76
@classmethod
def from_dict(cls, data: Dict[str, Any]) -> "Result":
    """
    Create a Song object from a dictionary.

    ### Arguments
    - data: The dictionary.

    ### Returns
    - The Song object.
    """

    # Return product object
    return cls(**data)