OwenStOnge commited on
Commit
e5e2e02
·
verified ·
1 Parent(s): 2323474

Update app.R

Browse files
Files changed (1) hide show
  1. app.R +8 -8
app.R CHANGED
@@ -2374,17 +2374,17 @@ removeModal()
2374
 
2375
  # Scrape button
2376
  observeEvent(input$scrape_btn, {
2377
- scrape_status_msg("Testing FTP connection...")
2378
 
2379
  result <- tryCatch({
2380
- ftp_url <- paste0("ftp://", Sys.getenv("FTP_USERNAME"), ":",
2381
- Sys.getenv("FTP_PASSWORD"),
2382
- "@ftp.trackmanbaseball.com/v3/2025/04/01/CSV/")
2383
- file_list <- RCurl::getURL(ftp_url, ftp.use.epsv = FALSE,
2384
- dirlistonly = TRUE, connecttimeout = 10)
2385
- paste("Connected! Files found:", nchar(file_list), "chars")
2386
  }, error = function(e) {
2387
- paste("FTP failed:", e$message)
2388
  })
2389
 
2390
  scrape_status_msg(result)
 
2374
 
2375
  # Scrape button
2376
  observeEvent(input$scrape_btn, {
2377
+ scrape_status_msg("Testing curl FTP...")
2378
 
2379
  result <- tryCatch({
2380
+ h <- curl::new_handle()
2381
+ curl::handle_setopt(h, userpwd = paste0(Sys.getenv("FTP_USERNAME"), ":", Sys.getenv("FTP_PASSWORD")))
2382
+ con <- curl::curl("ftp://ftp.trackmanbaseball.com/v3/2025/04/01/CSV/", handle = h)
2383
+ lines <- readLines(con)
2384
+ close(con)
2385
+ paste("Connected! Found:", length(lines), "files")
2386
  }, error = function(e) {
2387
+ paste("curl FTP failed:", e$message)
2388
  })
2389
 
2390
  scrape_status_msg(result)