How I webscraped 1 minute stock data from tradingview
After a long die-hard trying I managed to get 1 minute stock data for free. My previous tries were using selenium and beautifulsoup modules in python. But the data is highly obfuscated so I was not able to find the exact HTML element to scrape. If you manage to do this using selenium please comment below.
Probably the data is being loaded up as SVG which is why it isn’t being seen in html inspect element.
But…
After a look into Network section I found something interesting.
websockets !!!
After observing the Headers
And Messages
I tried to send the same messages using websockets in python and it worked :) .
Code at https://github.com/rushic24/tradingview-scraper.
Limitations
We can only get previous 5000 ticks of data.