@@ -37,7 +37,7 @@ def _apikey(self) -> str:
3737 """
3838 return self .__api_key
3939
40- def _request (self , url : str ) -> dict :
40+ def _request (self , url : str , format : Format = Format . JSON ) -> dict :
4141 """Get the request.
4242
4343 Args:
@@ -47,6 +47,8 @@ def _request(self, url: str) -> dict:
4747 dict: The request.
4848 """
4949 request = requests .get (url )
50+ if format == Format .XML :
51+ return request .text
5052 return request .json ()
5153
5254 def _set_page_size (self , page_size : int ) -> int :
@@ -366,7 +368,7 @@ def matcher_lyrics_get(
366368 return data
367369
368370 def matcher_track_get (
369- self , q_track : str , q_artist : str , q_album : Optional [str ] = None
371+ self , q_track : str , q_artist : str , q_album : Optional [str ] = ""
370372 ) -> dict :
371373 """Match your song against our database.
372374
@@ -401,12 +403,11 @@ def matcher_track_get(
401403
402404 def matcher_subtitle_get (
403405 self ,
404- q_track ,
405- q_artist ,
406- f_subtitle_length ,
407- f_subtitle_length_max_deviation ,
408- track_isrc = None ,
409- _format = "json" ,
406+ q_track : str ,
407+ q_artist : str ,
408+ f_subtitle_length : int ,
409+ f_subtitle_length_max_deviation : int ,
410+ track_isrc : Optional [str ] = "" ,
410411 ):
411412 """Get the subtitles for a song given his title,artist and duration.
412413
@@ -415,14 +416,13 @@ def matcher_subtitle_get(
415416
416417 Parameters:
417418
418- q_track - The song title.
419- q_artist - The song artist.
420- f_subtitle_length - Filter by subtitle length in seconds.
421- f_subtitle_length_max_deviation - Max deviation for a subtitle
419+ q_track (str): The song title.
420+ q_artist (str): The song artist.
421+ f_subtitle_length (int): Filter by subtitle length in seconds.
422+ f_subtitle_length_max_deviation (int): Max deviation for a subtitle
422423 length in seconds.
423- track_isrc - If you have an available isrc id in your catalogue
424+ track_isrc (str): If you have an available isrc id in your catalogue
424425 you can query using this id only (optional).
425- format - Decide the output type json or xml (default json).
426426
427427 Note: This method requires a commercial plan.
428428 """
@@ -431,15 +431,15 @@ def matcher_subtitle_get(
431431 "matcher.subtitle.get?q_track={}"
432432 "&q_artist={}&f_subtitle_length={}"
433433 "&f_subtitle_length_max_deviation={}"
434- "&track_isrc={}&format={} " .format (
434+ "&track_isrc={}" .format (
435435 q_track ,
436436 q_artist ,
437437 f_subtitle_length ,
438438 f_subtitle_length_max_deviation ,
439439 track_isrc ,
440- _format ,
441440 ),
442441 ),
442+ format = Format .XML ,
443443 )
444444 return data
445445
0 commit comments