0

I have tried to download several CSVs from a website using R and Python, but it doesn't work due to DDOS Cloudflare and 503 Error. Does someone know how to do it?

Python

from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager

browser = webdriver.Chrome(ChromeDriverManager().install())

browser.get('https://spotifycharts.com/regional/br/daily/2020-07-02')

botao = browser.find_element_by_xpath('//a[@class="header-csv"]')
botao.click()

R

my_file <- read_csv("https://spotifycharts.com/regional/br/daily/2020-07-02/download", skip = 1)
polo
  • 185
  • 1
  • 3
  • 11

1 Answers1

0

This may cause such blocking. https://support.cloudflare.com/hc/en-us/articles/200170086-Understanding-the-Cloudflare-Browser-Integrity-Check

You can set user-agent to eliminate this possibility

kyouhei
  • 54
  • 1
  • 1
  • 6
  • How to set an user-agent that is able to download the CSV? – polo Jul 07 '21 at 16:33
  • This may help? [python - Way to change Google Chrome user agent in Selenium? - Stack Overflow](https://stackoverflow.com/questions/49565042/way-to-change-google-chrome-user-agent-in-selenium) – kyouhei Jul 07 '21 at 16:38
  • It still doesn't work with user-agent. New message https://ibb.co/Cnh5Gfs – polo Jul 07 '21 at 22:16