I am wondering if this problem can be solved using Lazarus-FPC-Indy?
Background:
I am using ffmpeg to download streaming news video from the Internet for later viewing.
In order to do that the download function needs the m3u8 URL of the video stream and on some websites I can get that easily by playing the video in the browser and then use the F12 debug function to inspect the network traffic. Here one can find the m3u8 url and copy it for use in the download script.
This works fine for many such streaming videos, but not all.
The problem is when they change over time, so I want to automate the extraction of the URL so it can be refreshed into a file which is then used by the ffmpeg command.
So here is an example for a site that has an m3u8 URL that has a limited lifetime of 4 hours and for which I use the following manual procedure to retrieve the URL:
1) Open url http://www.freeintertv.com/view/id-2565 to the site in [b]Firefox[/b]
2) Right-click the player now shown on screen
3) Select: This Frame -> View frame source
4) Search for 'playlist.m3u8' and find this line:
var hls_src='https://h3.ustvgo.la/MSNBC/myStream/playlist.m3u8?wmsAuthSign=c2VydmVyX3RpbWU9MS8xNC8yMDIzIDI6Mzk6NDAgUE0maGFzaF92YWx1ZT1OYzZGdGJkaUJBWlYyZWpPcEJET2J3PT0mdmFsaWRtaW51dGVzPTI0MA==';
The item following var hls_src= is the searched for URL. It has a lifetime of 240 minutes.
How can I do this in a stand-alone FPC console program such that it extracts the long URL and saves it to a file?
The code to do this will be executed inside a command line program that can be run from cron in Linux (Ubuntu Server 20)
Any suggestions?