Grab Internetfile every 10 sec for use in the Textplugin

Jack0r

The Helping Squad
Hey, today someone asked the question if OBS 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 like any other txt source.

Code:
:loop
curl --url http://url.de/Test.txt -o textfile.txt 
ping 192.168.5.2 -n 1 -w 10000 > nul
goto loop

Explanation: The curl command grabs the text.txt of my url.de 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 http://curl.haxx.se/ 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: http://curl.haxx.se/docs/manpage.html

The end result will look like this:
igLpdRGvA3g60.PNG

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
iH1Ey5dLQQiYf.PNG


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

Enlightening

New Member
Great job, was looking exactly for this featured! Hope I can see on OBS directly this option without using third-party software.
 

Jack0r

The Helping Squad
"You could use Timeout instead of ping, the ping work-around is older and not needed anymore"

Oh thank you sir for this friendly and kind advice.
 
Top