File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -243,14 +243,21 @@ module.exports = {
243243 * @function getIndicator
244244 * @param {string } id Indicator ID (Like: PUB;XXXXXXXXXXXXXXXXXXXXX)
245245 * @param {'last' | string } [version] Wanted version of the indicator
246+ * @param {string } [session] User 'sessionid' cookie
247+ * @param {string } [signature] User 'sessionid_sign' cookie
246248 * @returns {Promise<PineIndicator> } Indicator
247249 */
248- async getIndicator ( id , version = 'last' ) {
250+ async getIndicator ( id , version = 'last' , session = '' , signature = '' ) {
249251 const indicID = id . replace ( / | % / g, '%25' ) ;
250252
251253 const { data } = await axios . get (
252254 `https://pine-facade.tradingview.com/pine-facade/translate/${ indicID } /${ version } ` ,
253- { validateStatus } ,
255+ {
256+ validateStatus,
257+ headers : {
258+ cookie : `${ session ? `sessionid=${ session } ;` : '' } ${ signature ? `sessionid_sign=${ signature } ;` : '' } ` ,
259+ } ,
260+ } ,
254261 ) ;
255262
256263 if ( ! data . success || ! data . result . metaInfo || ! data . result . metaInfo . inputs ) {
@@ -455,7 +462,12 @@ module.exports = {
455462 source : ind . scriptSource ,
456463 type : ( ind . extra && ind . extra . kind ) ? ind . extra . kind : 'study' ,
457464 get ( ) {
458- return module . exports . getIndicator ( ind . scriptIdPart , ind . version ) ;
465+ return module . exports . getIndicator (
466+ ind . scriptIdPart ,
467+ ind . version ,
468+ session ,
469+ signature ,
470+ ) ;
459471 } ,
460472 } ) ) ;
461473 } ,
You can’t perform that action at this time.
0 commit comments