/tradingview-script-downloader

This Python script automates the extraction of PineScript codes from the most popular strategies on TradingView, using Selenium for web navigation and BeautifulSoup for data scraping.

Primary LanguagePython

Project Title

TradingView PineScript Downloader

Description

A concurrent web scraper written in Python using Selenium and aiohttp to download PineScripts from TradingView, a popular online community of traders.

Features

  • Concurrent Page Downloading: I built this to take advantage of multi-core processors by downloading multiple pages concurrently.
  • PineScript Code Extraction: One cool feature is the ability to extract and save PineScript code from TradingView's script pages, which can then be used for backtesting or other purposes.
  • Headless Browsing: I configured Firefox to run in headless mode using geckodriver, making it possible to scrape content without displaying any browser windows.
  • Directory Management: The project creates a designated directory for storing downloaded PineScripts and checks if files already exist before saving them again.

Installation

Before running the script, make sure you have:

  1. Python installed on your machine (python --version)
  2. geckodriver executable in your system's PATH (download from here)
  3. Required libraries:
    • selenium
    • aiohttp
    • BeautifulSoup4

You can install them using pip:

pip install -r requirements.txt

Usage

Run the script with Python, and it will start downloading PineScripts from TradingView in a concurrent manner. You can adjust the number of concurrent pages by modifying the num_concurrent_pages variable.

python main.py

Contributing

If you'd like to contribute or report any issues, feel free to open a pull request on GitHub: TradingView PineScript Downloader

License

This project is licensed under the MIT License. See LICENSE file for details.

Tags/Keywords

  • TradingView
  • PineScript
  • Web Scraping
  • Selenium
  • Aiohttp
  • Concurrent Downloading