tradingview-scraper icon indicating copy to clipboard operation
tradingview-scraper copied to clipboard

Which parameters should we pass for authenticated user session?

Open hakangs opened this issue 5 years ago • 2 comments

Which parameters should we update/pass for using the application as a signed-in user? So that we can get real-time data for some symbols (instead of delayed_streaming_900, I have subscribed to necessary data feeds for them).

hakangs avatar Jun 02 '20 11:06 hakangs

It looks like the library doesn't support this, but I was working on something similar for my own lib (Kotlin) and I found out how you can connect as authenticated user and it shouldn't be that hard to implement that in this lib.

  1. Do a POST request to https://br.tradingview.com/quote_token/ with a sessionid Cookie, you can get your Session ID by looking at any connection that you do to TradingView
  2. Get the string from the request (but don't forget to remove the "!), that's the WebSocket token
  3. Use the token on the set_auth_token packet
  4. Have fun!

MrPowerGamerBR avatar Jul 28 '20 13:07 MrPowerGamerBR

Update: The https://br.tradingview.com/quote_token/ endpoint was removed, so here's what you need to do:

  1. Do a GET request to https://br.tradingview.com/chart/ with a sessionid Cookie, you can get your Session ID by looking at any connection that you do to TradingView
  2. Get the JSON in the var user = JsonPayloadHere; JavaScript variable
  3. Within the JSON, there's a auth_token field, that's the WebSocket token
  4. Use the token on the set_auth_token packet
  5. Have fun!

MrPowerGamerBR avatar Jul 03 '23 13:07 MrPowerGamerBR