[FFmpeg-user] How can I extract m3u8 URL for use with ffmpeg on this site?

Reino Wijnsma rwijnsma at xs4all.nl
Sat Apr 9 14:14:18 EEST 2022


Hello Bo,

On 2022-04-07T18:48:06+0200, Bo Berglund <bo.berglund at gmail.com> wrote:
> I want to get hold of the m3u8 URL on this site

You do realize this is the FFmpeg mailinglist, right? This question has nothing to do with FFmpeg.
If you want more answers, then this is the wrong place to ask.

> Another example page on the same site going through the same procedure:
> http://www.freeintertv.com/view/id-2565

By looking at the network-traffic you can see (or at least I can) this POST request:

$ curl --data-raw "chname=bXNuYmNfbGl2ZQ%3D%3D&ch=http%3A%2F%2Fwww.freeintertv.com%2Fexternals%2Ftv-russia%2Fsmotret-tv3-online&html5=11" \
    "http://www.freeintertv.com/myAjax/get_item_m3u8/"

This can be replicated/automated with the HTML/XML/JSON parser Xidel, which I've showed you earlier.

The value to be used for "chname":

$ xidel -s "http://www.freeintertv.com/view/id-2565" -e 'extract(//meta[@property="og:image"]/@content,"([a-z_]+)\.jpg",1)'
msnbc_live

"chname" base64 encoded:

$ xidel -s "http://www.freeintertv.com/view/id-2565" -e '
  string-to-base64Binary(
    extract(//meta[@property="og:image"]/@content,"([a-z_]+)\.jpg",1)
  )
'
bXNuYmNfbGl2ZQ==

The string to POST:

$ xidel -s "http://www.freeintertv.com/view/id-2565" -e '
  {
    "chname":string-to-base64Binary(
      extract(//meta[@property="og:image"]/@content,"([a-z_]+)\.jpg",1)
    ),
    "ch":"http://www.freeintertv.com/externals/tv-russia/smotret-tv3-online",
    "html5":"11"
  }
'
{
  "chname": "bXNuYmNfbGl2ZQ==",
  "ch": "http://www.freeintertv.com/externals/tv-russia/smotret-tv3-online",
  "html5": "11"
}

$ xidel -s "http://www.freeintertv.com/view/id-2565" -e '
  request-combine(
    (),
    {
      "chname":string-to-base64Binary(
        extract(//meta[@property="og:image"]/@content,"([a-z_]+)\.jpg",1)
      ),
      "ch":"http://www.freeintertv.com/externals/tv-russia/smotret-tv3-online",
      "html5":"11"
    }
  )/substring(url,2)
'
chname=bXNuYmNfbGl2ZQ%3D%3D&ch=http%3A%2F%2Fwww.freeintertv.com%2Fexternals%2Ftv-russia%2Fsmotret-tv3-online&html5=11

And the actual POST-request:

$ xidel -s "http://www.freeintertv.com/view/id-2565" -e '
  x:request({
    "post":request-combine(
      (),
      {
        "chname":string-to-base64Binary(
          extract(//meta[@property="og:image"]/@content,"([a-z_]+)\.jpg",1)
        ),
        "ch":"http://www.freeintertv.com/externals/tv-russia/smotret-tv3-online",
        "html5":"11"
      }
    )/substring(url,2),
    "url":"http://www.freeintertv.com/myAjax/get_item_m3u8/"
  })/raw
'
playlist[0]['file']='http://1128480543.rsc.cdn77.org/SlTNwu1CSVEq9yA3i_J9Zg==,1649504141/1128480543/index.m3u8'; get_item.showPlayer();

Extract the m3u8-url:

$ xidel -s "http://www.freeintertv.com/view/id-2565" -e '
  x:request({
    "post":request-combine(
      (),
      {
        "chname":string-to-base64Binary(
          extract(//meta[@property="og:image"]/@content,"([a-z_]+)\.jpg",1)
        ),
        "ch":"http://www.freeintertv.com/externals/tv-russia/smotret-tv3-online",
        "html5":"11"
      }
    )/substring(url,2),
    "url":"http://www.freeintertv.com/myAjax/get_item_m3u8/"
  })/extract(raw,"http.+m3u8")
'
http://1128480543.rsc.cdn77.org/SlTNwu1CSVEq9yA3i_J9Zg==,1649504141/1128480543/index.m3u8

> http://www.freeintertv.com/view/id-2308

This one doesn't work in my browser, but appears to work the same way:

$ xidel -s "http://www.freeintertv.com/view/id-2308" -e 'x:request({"post":request-combine((),{"chname":string-to-base64Binary(extract(//meta[@property="og:image"]/@content,"([a-z_]+)\.jpg",1)),"ch":"http://www.freeintertv.com/externals/tv-russia/smotret-tv3-online","html5":"11"})/substring(url,2),"url":"http://www.freeintertv.com/myAjax/get_item_m3u8/"})/extract(raw,"http.+m3u8")'
http://livedoc.cgtn.com/500d/prog_index.m3u8

-- 
Reino



More information about the ffmpeg-user mailing list