Comments (131)
With the Chrome Dev Tools, you can see the WebSocket traffic coming to and going from your browser at https://www.tradingview.com/chart/xxx_your_chart_xxx/ during adding indicator (RSI for example)
m636m{"m":"create_study","p":["cs_Your_session_name","st1","st1","sds_1","Script@tv-scripting-101!",{"text":"SwpjA8ZvTfm3QzYV4SHlGQ==_fBphOqdJtCV9RSOZQgTZR26ciPAXfb4AyW7Aw9xpSMMXHfUD9LkZNZd2XNEdiXtEA+iiy/2T83TWfyL4ik8Zehob/gN+KrG1pgARlwFeY3qCBYCfB/iHWS1S/n3ascBswxEtQkVz89w58exKoK9sm6ZZXYN3h3xRpgCOduqjTZctqkqpskurbUQWaCol6fWKHwo68SaLKFQf8CyFc1tDaX8Icp89p1k0VFQtHm1NYdIdEGLETcaTlyWz2Gl6yaazMCZrU3nFLWgqktLUSpUpL+nVTQ5NtusEODMPPWzmjtCfCcdPZBAn7KI4YCwWC+YhCCTh05t/w7T1la6NcEHXorpi","pineId":"STD;RSI","pineVersion":"20.0","in_2":{"v":"","f":true,"t":"resolution"},"in_0":{"v":14,"f":true,"t":"integer"},"in_1":{"v":"close","f":true,"t":"source"}}]}
or
You can get indicator text value with xpath at https://www.tradingview.com/chart/xxx_your_chart_xxx/
"//script[contains(.,"initData.content")]/text()"
tttt = xpath_script_value.split("initData.content = ")[-1].split("initData.defSymbol")[0].replace("}]};","}]}")
t=json.loads(tttt)
print(t['charts'][0]['panes'][3]['sources'][0]['state']['inputs']['text'])
from tradingview-scraper.
pine code source translation for create_study somewhere here:
https://www.tradingview.com/static/bundles/main_chart.[unique file name?].js
...
c.PINE_FACADE_URL=function(){return window.PINE_URL}
...
return c._pineFacadeAjax("POST","/convert/",i).done((function(e,i,n){e.error?
...
(u+=l),c._pineFacadeAjax("GET",u,void 0,n).done((function(e,n,r){if(c._translateScriptAsyncDone(i,e)
...
from tradingview-scraper.
first steps questions not equal stupid questions
from tradingview-scraper.
SuperTrend by KivancOzbilgic
m1483m{"m":"create_study","p":["cs_fIIsHMXKVz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NF3WFBeJ5xCm4ja/joeW0Db8kDoBtFbqHPStO5pMr0OQ==","pineId":"PUB;VfOPXWDHDPhORvJYRTcuHOyeqpOcRR45","pineVersion":"2.0","in_0":{"v":10,"f":true,"t":"integer"},"in_1":{"v":"hl2","f":true,"t":"source"},"in_2":{"v":3,"f":true,"t":"float"},"in_3":{"v":true,"f":true,"t":"bool"},"in_4":{"v":true,"f":true,"t":"bool"},"in_5":{"v":true,"f":true,"t":"bool"}}]}
from tradingview-scraper.
can you help me , it is not working
from tradingview-scraper.
sendMessage(ws, "create_study", [chart_session,"st4","st1","s1","Script@tv-scripting-101!",{"text":"WEVWraRmbLWZptpn+HpmoA==_ARZ8r6dJpu7GqgGZTjfBss4kMzcGjsQ3xIdIMxHCEd3BKY8jQVVBkmdbDJfGouR/o8yF2rNRLtmdT1ZIrZDlhcmEYl1vkoE68qTsX7+Nv5El6A7TR20M+CsG6C6Lpx5n0l3v6HSN3Enfeys2xVskaIPWt6Go2ni7miDFUIbneX/4dZCYKxQkx+p6xF56+Jm7MCwOfmSCi6BCGUzDKTU0oyxlwVCotvRAvdRhdNHsz7VsCGu4SEgnxdiHLIlZEOCsSoW8edwj8leclzAtciLylDR1YeVGOsZkpDCCqeJBtXaiMwCAMIso4R1HuIhMwEFUIW4M9LhFO3IS9QBqQ+aPBGXROuQhc3gK2vltU/S7dzjGr0n3x51GFtjPdcblnjmX9naEAa1taJ226oKnPWyfFE8Sv8pVyEJfRetv2rUD6Wi4NZ6mLnr0hYc+FrxjGZW7A5+7PXyNUzjvBOfBlLqdXHKU/luzZeSE/iBDilZMgH/LHcs/igQV8uljoIw8elf9z6XFEMT6l8wbGs4FCIrbJ6tPza1Mq3IzI7/9WBLlKa5AARPakyAcVXd019Scj+kdGhpopuhXnIC0TbXXbUGK3VKsPu/S9UpvqBglsMXGl2SCoLMrTZftbwEUZbJDq8s4vt7EOJp69asIz4fGgY7SqULh9ZH+jwTcIwqaqHTwHmivdRlSTFWPJK4VF3f7xkO02+Z1lgNOPozo7Lo2jRkmZBzRn0pwZZ9g5JVDdUGevoOQrmQO+v5YobSd5V83yY0eIPERjdQa/rHQ6VI44AcJZVFGD3qaIOj1zsYZv0dnRtLitc1SokfjlLIeh8iaX/JUsgnW2KwXoCEn/CE1cNVDGBXGcDmH2+CKbGmLzKHWLEP3PEceA7S+daYfb3d1rWx9hNQjqPY/GvFmJdhWkucGPHQT3n8ulY+MwD7CJYogIiAsThkTJL2hjJmwOLftUm5bLOTnd5vBeiQMhMwMyLZB+UTbixOsqMM7HdpS58HEU9lT8TlHhaXyFiNF3WFBeJ5xCm4ja/joeW0Db8kDoBtFbqHPStO5pMr0OQ==","pineId":"PUB;VfOPXWDHDPhORvJYRTcuHOyeqpOcRR45","pineId":"PUB;VfOPXWDHDPhORvJYRTcuHOyeqpOcRR45","pineVersion":"2.0","in_0":{"v":10,"f":true,"t":"integer"},"in_1":{"v":"hl2","f":true,"t":"source"},"in_2":{"v":3,"f":true,"t":"float"},"in_3":{"v":true,"f":true,"t":"bool"},"in_4":{"v":true,"f":true,"t":"bool"},"in_5":{"v":true,"f":true,"t":"bool"}}])
from tradingview-scraper.
hola como se puede extraer el rsi de una accion o ticker ?
from tradingview-scraper.
RSI
sendMessage(ws, "create_study", [chart_session,"st1","st1","s1","Script@tv-scripting-101!",{"text":"1f0fkZ72S0de2geyaUhXXw==_xwY73vljRXeew69Rl27RumLDs6aJ9NLsTYN9Xrht254BTb8uSOgccpLDt/cdRWopwJPNZx40m19yEFwJFswkSi62X4guNJYpXe4A6S9iq2n+OXM6mqWeWzDbjTl0lYmEf1ujbg7i3FvUdV/zCSrqd+iwnvvZSV+O2acpfNLpUlDdB6PZX4Y9y8tlQLWA2PiF8CVJng7DF1LPeecWC4fv+lNg+s5OXU46AjIhc+TFu8DOwiuKjNh7wWz6EZ7gpQS3","pineId":"STD;RSI","pineVersion":"12.0","in_2":{"v":"","f":True,"t":"resolution"},"in_0":{"v":14,"f":True,"t":"integer"},"in_1":{"v":"close","f":True,"t":"source"}}])
from tradingview-scraper.
@euvgub, Thanks for the last reply, it works very well. Is the text
param a hardcoded value or is there a way to dynamically generate that value?
from tradingview-scraper.
Thanks euvgub, I understand that text param was grabbed from monitoring the WebSocket traffic. I was wondering if there was a dynamic way to re-create that value, similar to how this repository generates the chart session ID, instead of copying the hardcoded values?
from tradingview-scraper.
start point to re-create that value
https://pine-facade.tradingview.com/pine-facade/get/STD%3BRSI/20.0
https://pine-facade.tradingview.com/pine-facade/translate/STD%3BRSI/20.0/
from tradingview-scraper.
trying to find pine script - > create_study "text" attribute translation method in
https://www.tradingview.com/static/bundles/ js files xxxxxxxx.js
from tradingview-scraper.
hi
how can get more data ?
i use this
sendMessage(ws, "request_more_data", [chart_session, "sds_2", 500])
but not worked
from tradingview-scraper.
hi, try to debug in browser dev tools-websocket what`s Your variable name instead of "sds_2" at 'create_series' step
for example 'm76m{"m":"create_series","p":["cs_A81hNsYTGtqz","s1","s1","symbol_1","5",10000]}'
here variable name is "s1"
from tradingview-scraper.
thank you ,
I solve it .
from tradingview-scraper.
Hi,
I tried getting the data of RSI through create_study method but the server responded with "Study not allowed in this connection" error. Does anyone know how to fix it?
Thanks
from tradingview-scraper.
just change this line in client
from
wss://${server}.tradingview.com/socket.io/websocket
to
wss://${server}.tradingview.com/socket.io/websocket?&type=chart
source Mathieu2301/TradingView-API#182
from tradingview-scraper.
@slukin1 Thank you so much. It worked! :)
from tradingview-scraper.
Could someone please explain why these strings work because the messages that I am sending on my browser are different and there is an error when I try sending the same message through code that the browser is sending.
Also, can anyone tell me how to get other indicators or like sub parts of indicators (like data of K-line of RSI).
Thanks
from tradingview-scraper.
study processing logic in js files https://static.tradingview.com/static/bundles/xxx.yyyyy.js
from tradingview-scraper.
The link is showing "This isn't the page you're looking for" :(
from tradingview-scraper.
xxx.yyyy different for every user. browser - developer tools - reload - tab Network - js files.
Add other indicators - tab Network - websocket - search websocket message with study string.
Or save all as har file and search for study string
from tradingview-scraper.
Okay. Thank you once again. :)
And sorry for such stupid questions, I am very new to this. :/
from tradingview-scraper.
@slukin1 I copied the study string from websocket and ran the code and it showed cannot parse pine error. Any idea why this is happening?
from tradingview-scraper.
sendMessage(ws, "create_study", [chart_session,"xxx","yyy","zz","Script@tv-scripting-101!",{"text":"yoursudystring","pineId":"PUB;youdata","pineId":"PUB;yourdata2","pineVersion":"2.0","in_0":{"v":10,"f":true,"t":"integer"},"in_1":{"v":"hl2","f":true,"t":"source"},"in_2":{"v":3,"f":true,"t":"float"},"in_3":{"v":true,"f":true,"t":"bool"},"in_4":{"v":true,"f":true,"t":"bool"},"in_5":{"v":true,"f":true,"t":"bool"}}])
copy exact message from websocket and past all data of study including study parameters like in_1, in_2,in_3 (your keys`ll be different)
from tradingview-scraper.
example of message in websocket
m1880m{"m":"create_study","p":["cs_q7qq7EXZjvcI","st7","st1","sds_1","Script@tv-scripting-101!",{"text":"bmI9Ks46_i0/H8fJm/OvjhXV1u68/kg==_42Foz2xVJWH1U9Kcf4Pt2KMghlpyA7KxkxEbOWwZeDcRzi9qVOFMCqXut7MrmwaE+clvDynY/fuMZS9OLPhTWB/j9e6aXIE7MoUf03Fev5PU/ESLpWLhny/gdby+78zLduWvuKnFLWbLbVh1AboV5j7ZhQxBfhHQWTmtNu5hSSyHUGEkBd6i3mHQo+1lCAuw1kDmVeEmnc0/WxcgcOyr6y0hOvx2+kChpwjE9pA72FATdn3+7nC6TpyDXtaMVlNs/ECHetIp4dLUSShM3K4zgwFXc+J8mYgb8+JnCBoTjBPZ08T8mB3Ni8ZnZjBqxvuC4IGnFtNv5zRlrksr35gH5/1nbAZmFgfJ6754NxE9aIGXvZtOnILH4B1rtwRGdIAwAH9KdZBKtacJLsKyPHS4VVTmIg6BilaifKKQIa7NoZWTV8VzR4pya4ku1VEy/Tz/EIDOxl9lKc9Ewr0cPzIfE1zMcbHBX+83Ppj84N/BFuXaM1Ohc9rmsfPl2rm27NQbUn3UVVy3DIqiaLIp4ZBi4Ku4Rqmsgw5UZmGe8PygI/eiEcBn7QZUm2zWsyU8wDE+MIyRdiI2MpsdONednuCiqY49tJno3jOMdsDDQwnPeqjVASbTZ0CthCZbxfLmfte8eXFK3iv09pbQjs45xd0WH7Ycye5O+Q+r0Z7jtRS7wkcaxzashdW+fCyyF9KIVdEkffv3YghSqF+Yfn3kqYwXh0CgN/eZ77SGmxAu/FuwwbyFifTK9EAthNSXEy+H8cZD3yubAuLEtzOaPF2EX5zaxZYQMZRddZar6QpRfKuKXF7Ha65URb1JZCGDXlbGxbkzAKDxY1PjdOFN9HD8YlTr4TOESV1sNykzd4IDx1hK2chU2VUgn99vQbFN/RV767Rc3ZH8J1Tm2Z8ogCfiQnvmZZtnSryHeERVlSnAyyBbO83IYTv0zBiK6wnq9JvrMcW1qG1xx5aeUDZ/3i6tZTUG09QouUbYVry3kahS5Pu3wnlE4d0ERboj/T+WtAmTwO++YsUV0o3RoO7dpSgfkhIdEtZqWOPY2Wpu7P+3+ebhAdlAzcWGqWFLd7dttF9bvZN1y+YzpuxAkZtr3zYvmzvpM6SjFIQs9ijfDfKXIqvRSQOiGsipR7aNjRMeD0enC6bUHy+wR//KF/hIBAP804/Zyf0Ur31u9t6WOeU3nurlr651k4hMIIXET/faFAsTkpkUPNCmqgcAQyJI5Fr3eUdV8ZkxipNPQjjVgfuzPqPCRwDYnU3QCRbO3f23NPf8i0L+KCVx17HezeUiTNXIxqZiy7W8mG0bpnf8A+s=","pineId":"PUB;40","pineVersion":"-1.0","in_0":{"v":true,"f":true,"t":"bool"},"in_1":{"v":"60","f":true,"t":"resolution"},"in_2":{"v":true,"f":true,"t":"bool"},"in_3":{"v":true,"f":true,"t":"bool"},"in_4":{"v":true,"f":true,"t":"bool"},"in_5":{"v":true,"f":true,"t":"bool"},"in_6":{"v":true,"f":true,"t":"bool"},"in_7":{"v":12,"f":true,"t":"integer"},"in_8":{"v":26,"f":true,"t":"integer"},"in_9":{"v":9,"f":true,"t":"integer"}}]}
example what to send from this websocket message:
sendMessage(ws, "create_study",["cs_q7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3kahS5Pu3wnlE4d0ERboj/T+WtAmTwO++YsUV0o3RoO7dpSgfkhIdEtZqWOPY2Wpu7P+3+ebhAdlAzcWGqWFLd7dttF9bvZN1y+YzpuxAkZtr3zYvmzvpM6SjFIQs9ijfDfKXIqvRSQOiGsipR7aNjRMeD0enC6bUHy+wR//KF/hIBAP804/Zyf0Ur31u9t6WOeU3nurlr651k4hMIIXET/faFAsTkpkUPNCmqgcAQyJI5Fr3eUdV8ZkxipNPQjjVgfuzPqPCRwDYnU3QCRbO3f23NPf8i0L+KCVx17HezeUiTNXIxqZiy7W8mG0bpnf8A+s=","pineId":"PUB;40","pineVersion":"-1.0","in_0":{"v":true,"f":true,"t":"bool"},"in_1":{"v":"60","f":true,"t":"resolution"},"in_2":{"v":true,"f":true,"t":"bool"},"in_3":{"v":true,"f":true,"t":"bool"},"in_4":{"v":true,"f":true,"t":"bool"},"in_5":{"v":true,"f":true,"t":"bool"},"in_6":{"v":true,"f":true,"t":"bool"},"in_7":{"v":12,"f":true,"t":"integer"},"in_8":{"v":26,"f":true,"t":"integer"},"in_9":{"v":9,"f":true,"t":"integer"}}]})
from tradingview-scraper.
@slukin1 That's exactly what I did. Is it working for you??
from tradingview-scraper.
cannot parse pine error - probably check unclosed [or { or } etc., [{},{},...{}]
from tradingview-scraper.
rsi, your values "st5","st1","sds_1" will be different
sendMessage(ws, "create_study", [chart_session,"st5","st1","sds_1","Script@tv-scripting-101!",{"text":"bmI9Ks46_GDXU32aIsC0JJYVxCztrYw==_lFuvP6Rua1E9Z4DGGhWENnCFtZtuQzhGv5h1sv6iIKS6m+8nbjXP1Y5hZI3bkb8ffxCpA9k1WG50+7QCUplyOQ93Q1j0/i/7u4BLqJmwFaNEPRgH7k7hOB+7WhgDaw3OUFF/V2AUEkKsUiBTliW9a/VdtZjQeGfZRB+B6nxWz8u5uFhWnG4h++lzufuJwYQBOdNBBy/Dd+9gQL3jz9NOswUN0NLaAz0oQyUr8r/UtTV9Hjybc7J5/x7jttiVjV7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cNCugtjKxO2g5XrosN5AT1LwP4WEdE/3gjS2QPQAJ7FfENRiZyp17KH8K71XZ6mehC2ZNF0k1V82SAF/YcyPhp1F76D6paeA8SGO8/11boyoShTtzG/zgU+dlOaFB/946ED0t/vPNmwSkEVda4JJU4Nbcp0rCYcS9+cyiLykcU9kkvB2ZlwqPOVSX4WdANLrijTka8uxoQO1o+n1yE1NXm9QD5PG7NfCn4RrZPywn8M140jGw4hjrdDVolMvwcCleJbKDKmzctdvxPkDI23XugjIVET+0FB2D8oOX9v2ZCPib5qX3nEqaZQyliTF1caatg==","pineId":"STD;RSI","pineVersion":"34.0","pineFeatures":{"v":"{"indicator":1,"plot":1,"ta":1,"math":1,"alertcondition":1}","f":True,"t":"text"},"in_0":{"v":14,"f":True,"t":"integer"},"in_1":{"v":"close","f":True,"t":"source"},"in_2":{"v":"SMA","f":True,"t":"text"},"in_3":{"v":14,"f":True,"t":"integer"},"in_4":{"v":2,"f":True,"t":"float"},"in_5":{"v":False,"f":True,"t":"bool"},"in_6":{"v":"","f":True,"t":"resolution"},"in_7":{"v":True,"f":True,"t":"bool"}}])
from tradingview-scraper.
@slukin1 I checked for commas and even tried this message, but didn't work. :(
But thanks a lot for all the input and help. :)
from tradingview-scraper.
Indicators data also available by selenium parsing window Object tree - Data window
from tradingview-scraper.
rsi, your values "st5","st1","sds_1" will be different
sendMessage(ws, "create_study", [chart_session,"st5","st1","sds_1","Script@tv-scripting-101!",{"text":"bmI9Ks46_GDXU32aIsC0JJYVxCztrYw==_lFuvP6Rua1E9Z4DGGhWENnCFtZtuQzhGv5h1sv6iIKS6m+8nbjXP1Y5hZI3bkb8ffxCpA9k1WG50+7QCUplyOQ93Q1j0/i/7u4BLqJmwFaNEPRgH7k7hOB+7WhgDaw3OUFF/V2AUEkKsUiBTliW9a/VdtZjQeGfZRB+B6nxWz8u5uFhWnG4h++lzufuJwYQBOdNBBy/Dd+9gQL3jz9NOswUN0NLaAz0oQyUr8r/UtTV9Hjybc7J5/x7jtt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xeDD/cNCugtjKxO2g5XrosN5AT1LwP4WEdE/3gjS2QPQAJ7FfENRiZyp17KH8K71XZ6mehC2ZNF0k1V82SAF/YcyPhp1F76D6paeA8SGO8/11boyoShTtzG/zgU+dlOaFB/946ED0t/vPNmwSkEVda4JJU4Nbcp0rCYcS9+cyiLykcU9kkvB2ZlwqPOVSX4WdANLrijTka8uxoQO1o+n1yE1NXm9QD5PG7NfCn4RrZPywn8M140jGw4hjrdDVolMvwcCleJbKDKmzctdvxPkDI23XugjIVET+0FB2D8oOX9v2ZCPib5qX3nEqaZQyliTF1caatg==","pineId":"STD;RSI","pineVersion":"34.0","pineFeatures":{"v":"{"indicator":1,"plot":1,"ta":1,"math":1,"alertcondition":1}","f":True,"t":"text"},"in_0":{"v":14,"f":True,"t":"integer"},"in_1":{"v":"close","f":True,"t":"source"},"in_2":{"v":"SMA","f":True,"t":"text"},"in_3":{"v":14,"f":True,"t":"integer"},"in_4":{"v":2,"f":True,"t":"float"},"in_5":{"v":False,"f":True,"t":"bool"},"in_6":{"v":"","f":True,"t":"resolution"},"in_7":{"v":True,"f":True,"t":"bool"}}])
@slukin1 Is this working for you??
from tradingview-scraper.
m98m{"m":"study_completed","p":["cs_UzgA87OuYCzF",....
from tradingview-scraper.
m158m{"m":"study_error","p":["cs_dgvstwayrbsh","st5","s1_st1","Can't parse pine","sin1-charts-24-webchart-11@sin1-compute-24"],"t":1699606103,"t_ms":1699606103531}
This is what I am getting
from tradingview-scraper.
Could you please share your code on mail so I can figure out where am I going wrong.
Thanks :)
from tradingview-scraper.
these codes with adding one more line
sendMessage(ws, "create_study", [chart_session,"st5","st1","sds_1","Script@tv-scripting-101!",....
https://raw.githubusercontent.com/0xrushi/tradingview-scraper/master/main.py
https://raw.githubusercontent.com/0xrushi/tradingview-scraper/master/livestreamtest.py
from tradingview-scraper.
That is the line I wanted to check. Rest of the code works for me.
from tradingview-scraper.
copy-paste from working code isnt good solution for first steps. better to find error in not working code. Could You show Your code with deleted login password, I
ll test it with my login password
from tradingview-scraper.
Yea sure.
test.txt
from tradingview-scraper.
Error reason is:
unauthorized_user_token
Indicators not allowed without authorisation.
Log in with free subscription and code will work. With free subscription You can add 2 indicators
https://github.com/0xrushi/tradingview-scraper
def get_auth_token():
sign_in_url = 'https://www.tradingview.com/accounts/signin/'
username = 'username'
password = 'password'
data = {"username": username, "password": password, "remember": "on"}
headers = {
'Referer': 'https://www.tradingview.com'
}
response = requests.post(url=sign_in_url, data=data, headers=headers)
auth_token = response.json()['user']['auth_token']
return auth_token
Then send a message through the tunnel sendMessage(ws, "set_auth_token", ["auth_token"])
from tradingview-scraper.
I was doing this earlier, this stated showing me some error which was due to recaptcha verification failure. But the cannot parse pine error was still there even when the verification worked. Th RSI string that is there in the discussion (given by euvgub) does work so I don't think authentication is the problem. :(
from tradingview-scraper.
That is why I was asking for the code so I could see my error.
from tradingview-scraper.
Indicators not allowed without authorisation
What was recaptcha verification failure error?
from tradingview-scraper.
use full headers from browser for log in to avoid recaptcha error.
from tradingview-scraper.
I got the following error after using all the headers: -
m45m{"m":"protocol_error","p":["bad auth token"]}
from tradingview-scraper.
login form changed
change [here_other_string] to yours from browser without [ ] and without " "
change [your_login] to yours from browser without [ ] and without " "
change [your_password] to yours from browser without [ ] and without " "
response will contain "auth_token":"eyJh......"
import requests
s=requests.session()
headers = {
'sec-ch-ua': '"Google Chrome";v="119", "Chromium";v="119", "Not?A_Brand";v="24"',
'x-language': 'en',
'sec-ch-ua-mobile': '?0',
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36',
'Content-Type': 'multipart/form-data; boundary=----WebKitFormBoundary[here_other_string]',
'Referer': 'https://www.tradingview.com/',
'x-requested-with': 'XMLHttpRequest',
'sec-ch-ua-platform': '"Linux"',
}
data = '------WebKitFormBoundary[here_other_string]\r\nContent-Disposition: form-data; name="username"\r\n\r\n[your_login]\r\n------WebKitFormBoundary[here_other_string]\r\nContent-Disposition: form-data; name="password"\r\n\r\n[your_password]\r\n------WebKitFormBoundary[here_other_string]--\r\n'
response = s.post('https://www.tradingview.com/accounts/signin/', headers=headers, data=data)
print(response.text)
print(response.headers)
from tradingview-scraper.
Where are these headers? The headers that I have on my websockets are different. (They are already in the headers list in the code)
from tradingview-scraper.
first we need to log in. but we got recaptcha_required. probably we can use cookies from browser.
code refactoring in progress
from tradingview-scraper.
first idea log in with selenium, manually solve recaptcha and pass cookies and auth_token to requests
def get_auth_token():
#from selenium import webdriver
#from selenium.webdriver.chrome.service import Service as ChromeService
#from webdriver_manager.chrome import ChromeDriverManager
#from selenium.webdriver.chrome.options import Options
#from selenium.webdriver.common.keys import Keys
#from selenium.webdriver.common.action_chains import ActionChains
#from selenium.webdriver.support.wait import WebDriverWait
#from selenium.webdriver.support import expected_conditions as EC
#from selenium.webdriver.common.by import By
#import requests
chrome_options = Options()
chrome_options.add_experimental_option("detach",True)
driver = webdriver.Chrome(service=ChromeService(ChromeDriverManager().install()), options=chrome_options)
driver.get('https://www.tradingview.com/accounts/signin')
driver.find_element(By.XPATH,'//button[@name="Email"]').click()
driver.find_element(By.XPATH,'//input[@id="id_username"]').send_keys('your_login')
driver.find_element(By.XPATH,'//input[@id="id_password"]').send_keys('your_password')
#driver.find_element(By.XPATH,'//input[@type="checkbox"]').click()
driver.find_element(By.XPATH,'//button[contains(@class,"submitButton")]').click()
### here come recaptcha
### after solving it manually we authorizied and have auth_token and cookies to pass to requests session
html_source = driver.page_source
#f = open("page_after_login_auth_token_here.html", "w")
#f.write(html_source)
#f.close()
auth_token=html_source.split('"auth_token":"')[1].split('",')[0]
cookies_selenium = driver.get_cookies()
s = requests.Session()
c = [s.cookies.set(c['name'], c['value']) for c in cookies_selenium]
driver.close()
return auth_token
.....
.....sendMessage(ws, "set_auth_token", ["auth_token"])
.....
from tradingview-scraper.
It seems that the paranoid mode against automation in the browser version is activated. I'll try the android version
Your computer or network may be sending automated queries. To protect our users, we can't process your request right now.
from tradingview-scraper.
temporary solution until recaptcha bypass ideas
to make sure the code create_study rsi runs without errors
Manually without automation open https://www.tradingview.com/accounts/signin log in with recaptcha, get auth_token from html page source (ctrl+F auth_token) copy value, run code with create_study with rsi data - paste auth_token to input
def get_auth_token(): auth_token = input('Enter auth_token:') return auth_token
And we got in websocket received messages:
{"m":"study_loading","p":[......}
{"m":"study_completed","p":["cs_bzxzakpvcpaf"...}
...
and then messages with rsi indicator values (create_study rsi here was from Your txt file)
{"m":"du","p":["cs_bzxzakpvcpaf",{".....
We can try bypass recaptcha by Audio Recognition Challenge like here How to bypass Recaptcha with Python?
https://ohyicong.medium.com/how-to-bypass-recaptcha-with-python-1d77a87a00d7
from tradingview-scraper.
temporary solution until recaptcha bypass ideas to make sure the code create_study rsi runs without errors Manually without automation open https://www.tradingview.com/accounts/signin log in with recaptcha, get auth_token from html page source (ctrl+F auth_token) copy value, run code with create_study with rsi data - paste auth_token to input
def get_auth_token(): auth_token = input('Enter auth_token:') return auth_token
And we got in websocket received messages: {"m":"study_loading","p":[......} {"m":"study_completed","p":["cs_bzxzakpvcpaf"...} ... and then messages with rsi indicator values (create_study rsi here was from Your txt file) {"m":"du","p":["cs_bzxzakpvcpaf",{".....We can try bypass recaptcha by Audio Recognition Challenge like here How to bypass Recaptcha with Python? https://ohyicong.medium.com/how-to-bypass-recaptcha-with-python-1d77a87a00d7
Does this work? I tried it earlier and it gave bad auth error
from tradingview-scraper.
Also, I believe the error is because of the RSI string that is being sent.
from tradingview-scraper.
this was sent and result: study_completed
{"m":"create_study","p":["cs_09DGIOpkH7uV","st1","st1","sds_1","Script@tv-scripting-101!",{"text":"bmI9Ks46_GDXU32aIsC0JJYVxCztrYw==_lFuvP6Rua1E9Z4DGGhWENnCFtZtuQzhGv5h1sv6iIKS6m+8nbjXP1Y5hZI3bkb8ffxCpA9k1WG50+7QCUplyOQ93Q1j0/i/7u4BLqJmwFaNEPRgH7k7hOB+7WhgDaw3OUFF/V2AUEkKsUiBTliW9a/VdtZj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P2MYq00DjY+sXMd+3134boI1VHDo9f6pFOtQsmRvNg5AwYVQBvK4/bgDZHmZLv2D65HpjhMrrdXdfX7QqiJ4rtzvU0exs4TfBxeDD/cNCugtjKxO2g5XrosN5AT1LwP4WEdE/3gjS2QPQAJ7FfENRiZyp17KH8K71XZ6mehC2ZNF0k1V82SAF/YcyPhp1F76D6paeA8SGO8/11boyoShTtzG/zgU+dlOaFB/946ED0t/vPNmwSkEVda4JJU4Nbcp0rCYcS9+cyiLykcU9kkvB2ZlwqPOVSX4WdANLrijTka8uxoQO1o+n1yE1NXm9QD5PG7NfCn4RrZPywn8M140jGw4hjrdDVolMvwcCleJbKDKmzctdvxPkDI23XugjIVET+0FB2D8oOX9v2ZCPib5qX3nEqaZQyliTF1caatg==","pineId":"STD;RSI","pineVersion":"34.0","pineFeatures":{"v":"{"indicator":1,"plot":1,"ta":1,"math":1,"alertcondition":1}","f":true,"t":"text"},"in_0":{"v":14,"f":true,"t":"integer"},"in_1":{"v":"close","f":true,"t":"source"},"in_2":{"v":"SMA","f":true,"t":"text"},"in_3":{"v":14,"f":true,"t":"integer"},"in_4":{"v":2,"f":true,"t":"float"},"in_5":{"v":false,"f":true,"t":"bool"},"in_6":{"v":"","f":true,"t":"resolution"},"in_7":{"v":true,"f":true,"t":"bool"}}]}
from tradingview-scraper.
sendMessage(ws, "set_auth_token", ["unauthorized_user_token"])
changed to?
sendMessage(ws, "set_auth_token", [auth_token])
and
def get_auth_token():
# current code
return auth_token
changed to?
def get_auth_token():
auth_token = input('Enter auth_token:')
return auth_token
from tradingview-scraper.
I actually just copied the auth token from the browser in a string and used that
from tradingview-scraper.
Could You try
{"text":"bmI9Ks46_GDXU32aIsC0JJYVxCztrYw==_lFuvP6Rua1E9Z4DGGhWENnCFtZtuQzhGv5h1sv6iIKS6m+8nbjXP1Y5hZI3bkb8ffxCpA9k1WG50+7QCUplyOQ93Q1j0/i/7u4BLqJmwFaNEPRgH7k7hOB+7WhgDaw3OUFF/V2AUEkKs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Vfl9FhbNM/65oFHP2MYq00DjY+sXMd+3134boI1VHDo9f6pFOtQsmRvNg5AwYVQBvK4/bgDZHmZLv2D65HpjhMrrdXdfX7QqiJ4rtzvU0exs4TfBxeDD/cNCugtjKxO2g5XrosN5AT1LwP4WEdE/3gjS2QPQAJ7FfENRiZyp17KH8K71XZ6mehC2ZNF0k1V82SAF/YcyPhp1F76D6paeA8SGO8/11boyoShTtzG/zgU+dlOaFB/946ED0t/vPNmwSkEVda4JJU4Nbcp0rCYcS9+cyiLykcU9kkvB2ZlwqPOVSX4WdANLrijTka8uxoQO1o+n1yE1NXm9QD5PG7NfCn4RrZPywn8M140jGw4hjrdDVolMvwcCleJbKDKmzctdvxPkDI23XugjIVET+0FB2D8oOX9v2ZCPib5qX3nEqaZQyliTF1caatg==","pineId":"STD;RSI","pineVersion":"34.0","pineFeatures":{"v":"{"indicator":1,"plot":1,"ta":1,"math":1,"alertcondition":1}","f":true,"t":"text"},"in_0":{"v":14,"f":true,"t":"integer"},"in_1":{"v":"close","f":true,"t":"source"},"in_2":{"v":"SMA","f":true,"t":"text"},"in_3":{"v":14,"f":true,"t":"integer"},"in_4":{"v":2,"f":true,"t":"float"},"in_5":{"v":false,"f":true,"t":"bool"},"in_6":{"v":"","f":true,"t":"resolution"},"in_7":{"v":true,"f":true,"t":"bool"}}
from tradingview-scraper.
How are you sending this message?
I am using backslashes before the quotes of v: parameters of pineFeatures and also using capital T and F for true and false.
from tradingview-scraper.
Are you sending them as they are??
from tradingview-scraper.
test compare found differences
3TPVyMExQN2bvLyzuBfqkTSSnYZKG3hkwUVal8RKut+/uUAT86q5r+/scyqDHasgJ7fxf9hoChbSIQ797qFCBVTPVyMExQN2bvLyzuBfqkTSSnYZKG3hkwUV
(in test.txt)
3TQNpDsGcFtsxHEasbWDm5zNnJVDzwKBCGMal8RKut+/uUAT86q5r+/scyqDHasgJ7fxf9hoChbSIQ797qFCBVT82dwqcOsq4iPilf9RvvCBAceW2rZF4Yp8
code above
def sendMessage(ws, func, args):
yes sends with backslashes and True, False using capital T and F
sendMessage(ws, "create_study", [chart_session,"st5","st1","sds_1","Script@tv-scripting-101!",{"text":"bmI9Ks46_GDXU32aIsC0JJYVxCztrYw==_lFuvP6Rua1E9Z4DGGhWENnCFtZtuQzhGv5h1sv6iIKS6m+8nbjXP1Y5hZI3bkb8ffxCpA9k1WG50+7QCUplyOQ93Q1j0/i/7u4BLqJmwFaNEPRgH7k7hOB+7WhgDaw3OUFF/V2AUEkKsUiBTliW9a/VdtZjQeGfZRB+B6nxWz8u5uFhWnG4h++lzufuJwYQBOdNBBy/Dd+9gQL3jz9NOswUN0NLaAz0oQyUr8r/UtTV9Hjybc7J5/x7jttiVjV7rUOWkL2kVU3CdQ/WXQ2l/SCilAjwlEOFpHNzUtK6utvEknLnV4u2gDmfIgQzoLOil09qKUFXwLGz+9DgG6QE3P/mgOBaOjnyNcxcaqvDdwayKFz9HBymxGXnHX+MXYBA+505o53A9CH2beLQpm9fhKkFGOFjhuvDVXFN5MeY39vJ7uOPkKxk+r5FiISlRzT3s5WnJOiF5cfO2mM8H+ssq9bce6IvOg/1UUJJWHPmlro/MQ7RvvGVPA3KDjuV6iZpXFD/dEjCNrYcY7CQ9AMBG24GxsYZyRa2JV9NWDFFaPFgXprVi69/Ba4FOp9urbe5BkzfpkQaHWZVGsKotUeFh5Tl2z4ai5Fpf12/OMDeOpOrwVfOqJ8Im5tCcOLCQ26kgL1+TRYoaGX5UXeoYsrcAsNE1NtzKGNr+wXXDnDo/GtqVzkqhIs9OV9R82QG5z3TQNpDsGcFtsxHEasbWDm5zNnJVDzwKBCGMal8RKut+/uUAT86q5r+/scyqDHasgJ7fxf9hoChbSIQ797qFCBVT82dwqcOsq4iPilf9RvvCBAceW2rZF4Yp8M1vDSyFXwNG6VemzhAfmAmlXGdnpP/ydA0prg+66/ZBl8O7JAO9bKrNwp4tJSPG9rI0EV4na25yzT6a7WLIYUpWZmlnv7sag/K9Kt7cxPted6h0ltz4npiNw0qF5mtIE0QD23HLoQEeZfEcgg/ZEtFFyArp1d26K/0fMEsGYzC2UzVt1qzeibZD9zwC6LBpTUT00paFZBS0r3o0b0RnhD4eB1RmLBtqYYcc+tArCQHj0JFUe0qtDo/u6SzXfrd8p0PJPMWhTzClx8U0p0OtcoVMRRK825svFaVMfpyIti4oCjIpMWQbd/7WvimP/Xus5qDXAd64UTWT+X9u9vnNFaFsb0gL7MGiCPCXhG7L3/0dj1YzfpZVUtiPmKkauqS/5J3MLTUVfl9FhbNM/65oFHP2MYq00DjY+sXMd+3134boI1VHDo9f6pFOtQsmRvNg5AwYVQBvK4/bgDZHmZLv2D65HpjhMrrdXdfX7QqiJ4rtzvU0exs4TfBxeDD/cNCugtjKxO2g5XrosN5AT1LwP4WEdE/3gjS2QPQAJ7FfENRiZyp17KH8K71XZ6mehC2ZNF0k1V82SAF/YcyPhp1F76D6paeA8SGO8/11boyoShTtzG/zgU+dlOaFB/946ED0t/vPNmwSkEVda4JJU4Nbcp0rCYcS9+cyiLykcU9kkvB2ZlwqPOVSX4WdANLrijTka8uxoQO1o+n1yE1NXm9QD5PG7NfCn4RrZPywn8M140jGw4hjrdDVolMvwcCleJbKDKmzctdvxPkDI23XugjIVET+0FB2D8oOX9v2ZCPib5qX3nEqaZQyliTF1caatg==","pineId":"STD;RSI","pineVersion":"34.0","pineFeatures":{"v":"{"indicator":1,"plot":1,"ta":1,"math":1,"alertcondition":1}","f":True,"t":"text"},"in_0":{"v":14,"f":True,"t":"integer"},"in_1":{"v":"close","f":True,"t":"source"},"in_2":{"v":"SMA","f":True,"t":"text"},"in_3":{"v":14,"f":True,"t":"integer"},"in_4":{"v":2,"f":True,"t":"float"},"in_5":{"v":False,"f":True,"t":"bool"},"in_6":{"v":"","f":True,"t":"resolution"},"in_7":{"v":True,"f":True,"t":"bool"}}])
from tradingview-scraper.
github deleted here backslashes on paste
from tradingview-scraper.
Tried it, didn't work :(
from tradingview-scraper.
Is it working for you??
from tradingview-scraper.
yes. create_study working. and messages with indicator data come in ws.recv()
from tradingview-scraper.
now which error in your received messages about study?
from tradingview-scraper.
m157m{"m":"study_error","p":["cs_zzuhwuveszjf","st5","s1_st1","Can't parse pine","sin1-charts-26-webchart-4@sin1-compute-26"],"t":1699713888,"t_ms":1699713888926}
from tradingview-scraper.
https://datalore.jetbrains.com/notebook/KL0xPQrNLCcuBgGkHWKo00/nf3RSqgXXf2JMqrigXvYIP
from tradingview-scraper.
Share this notebook with someone by email
I don`t know email
from tradingview-scraper.
How are you getting the auth_token??
I am using the string from set_auth_token message from the browser but it is giving bad_auth_token error
from tradingview-scraper.
Manually without automation open https://www.tradingview.com/accounts/signin log in with recaptcha, get auth_token from html page source (ctrl+F auth_token) copy value
from tradingview-scraper.
Manually without automation open https://www.tradingview.com/accounts/signin log in with recaptcha, get auth_token from html page source (ctrl+F auth_token) copy value
This is value that you are referring to (the value stored in p:[]), right??
from tradingview-scraper.
Manually without automation open https://www.tradingview.com/accounts/signin log in with recaptcha, get auth_token from html page source (ctrl+F auth_token) copy value and paste value to input. IPython will show Enter auth_token: in bottom, paste auth_token value and press enter
from tradingview-scraper.
Run iPython. It wil ask in bottom Enter auth_token:
from tradingview-scraper.
I did that all of that but I am still getting bad auth_token. :(
from tradingview-scraper.
open https://www.tradingview.com/accounts/signin
Sign in
after signed
right mouse View page source
ctrl+f auth_token
found "auth_token":"eyJhbGciOiJSUzUxMiI...."
copy eyJhbGciOiJSUzUxMiI....
paste it to Enter auth_token: after Run iPython. It wil ask in bottom Enter auth_token:
press enter
from tradingview-scraper.
I am doing it. It is still giving me bad auth_token error. Are you not getting this error??
Also could you confirm if your auth_token has 639 characters?
from tradingview-scraper.
m95m{"m":"series_loading","p":["cs_qbqcbweadbna","sds_1","s1"],"t":1699718688,"t_ms":1699718688217}m96m{"m":"study_loading","p":["cs_qbqcbweadbna","st5","s1_st1"],"t":1699718688,"t_ms":1699718688217}
...
m98m{"m":"study_completed","p":["cs_qbqcbweadbna","st5","s1_st1"],"t":1699718688,"t_ms":1699718688795}
yes len(auth_token) has 639 characters
from tradingview-scraper.
I think create new account for tradingview will solve bad auth_token
from tradingview-scraper.
create new account for tradingview and log in to new account to get auth_token
from tradingview-scraper.
seems current account blacklisted by tradingview as dangerous hacker who wants to take all the money from the exchange
from tradingview-scraper.
Did that just now. Did not work.
from tradingview-scraper.
added print('#auth_token#',auth_token)
compare auth_token in html page source and printed
from tradingview-scraper.
They are the same, just compared.
from tradingview-scraper.
no reason for bad auth token
from tradingview-scraper.
Which IDE are you using??
from tradingview-scraper.
I shared for You. Try here
https://datalore.jetbrains.com/notebook/KL0xPQrNLCcuBgGkHWKo00/nf3RSqgXXf2JMqrigXvYIP
from tradingview-scraper.
Still didn't work. :(
I am trying on a new system.
from tradingview-scraper.
TradingView activation link
pressed? after account creation
from tradingview-scraper.
Yes. Activated the account.
from tradingview-scraper.
2-factor authentication disabled?
https://www.tradingview.com/u/your_account/#security
from tradingview-scraper.
Yes, it is disabled.
from tradingview-scraper.
past here auth_code for new account
from tradingview-scraper.
we`ll delete it in 3 min
from tradingview-scraper.
Wait. Let me try it the other system first.
from tradingview-scraper.
decode auth_token here https://jwt.io/
result for payload data like this?:
{
"user_id": 22xxxxx7,
"exp": 1699737166,
"iat": 1699722766,
"plan": "",
"ext_hours": 1,
"perm": "",
"study_perm": "",
"max_studies": 2,
"max_fundamentals": 0,
"max_charts": 1,
"max_active_alerts": 1,
"max_study_on_study": 1,
"max_overall_alerts": 2000,
"max_active_primitive_alerts": 5,
"max_active_complex_alerts": 1,
"max_connections": 2
}
from tradingview-scraper.
The data in characters from iat data to hours is not loading. Rest is same
from tradingview-scraper.
The site is also showing invalid signature. Is it showing valid signature for you??
from tradingview-scraper.
"iat" (Issued At) Claim The "iat" (issued at) claim identifies the time at which the JWT was issued.
from tradingview-scraper.
invalid signature - yes it`s ok without public and private keys
from tradingview-scraper.
public and private keys to VERIFY SIGNATURE here https://token.dev/
from tradingview-scraper.
Related Issues (20)
- Date range
- name 'outfilename' is not defined HOT 2
- Error: `AttributeError: 'NoneType' object has no attribute 'group'` HOT 2
- Is there any way to scrape study (indicator/oscillator) values?
- Why the socket is often interrupted
- Date Range data
- OHLC DATA HOT 6
- Index data
- Create study
- Get Drawings
- Login captcha HOT 2
- How can I scrape data 24/7? I found such a solution, but it did not seem reliable.
- Error : Not working !!! HOT 2
- auth_token HOT 10
- NameError: name 'datetime' is not defined HOT 1
- Hourly/daily HOT 2
- Chart series - multiple symbols HOT 1
- Unable to fetch "MCX:GOLD1!"
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tradingview-scraper.