0

I use a python script to download a file from a website periodically. I want to move this process to my virtual server. How do I do this?

This is the code I use

import webbrowser
url = 'https://www.djppr.kemenkeu.go.id/page/loadViewer?idViewer=9369&action=download'
chrome_path = 'C:/Program Files/Google/Chrome/Application/chrome.exe %s' #Windows
webbrowser.get(chrome_path).open(url)

Visiting the link results in the file being automatically downloaded onto my PC. The issue is that there is no "chrome browser" on my virtual server. I also don't know whether it will save the file as it does on my PC.

absk
  • 53
  • 1
  • 9

1 Answers1

0
  1. install Chrome headless on server (Ubuntu, CentOS)
  2. use python + selenium to run chrome headless in background
  3. profit

Or just use requests or urllib python libraries if you don't need javascript support on client side.

In other way you may use PhatomJS instead of Chrome browser

rzlvmp
  • 7,512
  • 5
  • 16
  • 45