Grab an Internetfile every 10 secs to save it locally

Today someone asked the question if the OBS software would be able to use an online text file instead of a local one. It should also check this file for changes and update accordingly.
Now my main concern is that downloading an internetfile can always go wrong for some strange reason and could maybe lead to a crash or hang of an application because it waits for the result. So I made a short batch script using CURL to circumvent this. It just runs in the background, saves the internet file to a local file which can then be used in OBS or another Streaming program for example, like any other txt source.

curl –url -o textfile.txt
ping -n 1 -w 10000 > nul
goto loop

Explanation: The curl command grabs the text.txt of my webpage and writes it to textfile.txt in the curl folder. You can change the output folder of course by adding its path to the command. Now for a simple PAUSE before curl tries to download the file again, I use a simple ping to a local computer which is non existent. Only one ping is sent (-n 1) and the wait time is 10 seconds (-w 10000)

Just grab CURL at and change your url and output file as you want it.
Curl has a lot more options available which are documented on the page as well. SSL, HTTP or HTTPS, ascii transfer, etc etc. The manpage has all info:

The end result will look like this:

The command prompt can run in the background and the other Windows can be closed of course (just a showcase screenshot)Now in OBS simply add a Text source and select the local textfile.

If you have questions, just post them below!
Greetings Jack

You may also like...