@@ -89,27 +89,27 @@ export default class ExternalApiManager {
8989 if ( ! entry ?. arl || typeof entry . arl !== 'string' ) continue
9090 if ( ! entry ?. api_key || typeof entry . api_key !== 'string' ) continue
9191
92- // check if license is string or json string with "license_token" field
92+ // check if license is a JSON string containing "license_token" (possibly nested)
9393 if ( entry ?. license && typeof entry . license === 'string' && entry . license . startsWith ( '{' ) ) {
9494 try {
95- const parsed = JSON . parse ( entry . license ) ;
96- if ( parsed . license_token ) {
97- entry . license = parsed . license_token ;
95+ const parsed = JSON . parse ( entry . license )
96+ const token = parsed . license_token || parsed . LICENCE ?. OPTIONS ?. license_token
97+
98+ if ( token ) {
99+ entry . license = token
98100 } else {
99101 logger ( 'warn' , 'ExternalAPI' , `Deezer ARL entry has invalid license format, missing "license_token" field: ${ entry . arl . slice ( 0 , 8 ) } ...` )
100- logger ( 'debug' , 'ExternalAPI' , `Full license content: ${ entry . license } ` )
101102 continue
102103 }
103104 } catch ( e ) {
104105 logger ( 'warn' , 'ExternalAPI' , `Deezer ARL entry has invalid license format, not a valid JSON: ${ entry . arl . slice ( 0 , 8 ) } ...` )
105- logger ( 'debug' , 'ExternalAPI' , `Full license content: ${ entry . license } ` )
106106 continue
107107 }
108108 }
109109
110110 if ( ! entry ?. license || typeof entry . license !== 'string' ) {
111111 if ( this . nodelink . options . sources . deezer . decryptionKey ) {
112- entry . license = this . nodelink . options . sources . deezer . decryptionKey ;
112+ entry . license = this . nodelink . options . sources . deezer . decryptionKey
113113 } else {
114114 continue
115115 }
0 commit comments