Linux Bash Script of Automated m3u8 URL extractor and Playlist Creator from a Live IPTV Server

 


This is a Linux Bash Script that will automatically extract hidden m3u8 url from Live TV server  and Updated the extracted m3u Playlist and uploaded to Github in every 50 minutes by cronjob.

Live Updated Playlist : https://www.shawonruet.com/2020/09/free-iptv-m3u-playlist-2020-hourly.html

Github Repository Link: https://github.com/shawon100/M3u8-URL-Extractor-from-Live-Server

Bash Script

#!/bin/bash
cd ~/scripts
httrack -i http://mathanosto.top/tv/
cd mathanosto.top/tv
echo "" > IPTV.m3u
echo "#EXTM3U" >> IPTV.m3u
i=1
for x in [player]*.html; do
  var=$(cat $x | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*.[0-9]" | sort -u | head -1; echo "\n")
  echo "#EXTINF:-1, Channel $i" >> IPTV.m3u
  echo $var >> IPTV.m3u
  i=$((i+1))
done

cp IPTV.m3u ../../
cp IPTV.m3u ~/Development/Github/M3u8-URL-Extractor-from-Live-Server
cd ~/Development/Github/M3u8-URL-Extractor-from-Live-Server

git add .
git commit -m "Added Updated IPTV.m3u"
git push origin master

Create a scripts folder under Home of Linux and save the bash script as extractor.sh . 

Then install httrack by running this command

sudo apt install httrack

Then Run the shell script

sh extract.sh

A m3u Playlist named IPTV.m3u will be generated in the same folder.

Cronjob

*/50 * * * * sh ~/scripts/extract.sh

If you want to push the m3u file to github after every 50 minutes then you need a create a github repository also and replace your repository path by mine in bash script


Live Updated Free IPTV Server Playlist : https://www.shawonruet.com/p/free-iptv-m3u-playlist-2020-every-50.html

Playlist Setup Video:



Share on Google Plus

About Ashadullah Shawon

I am Ashadullah Shawon. I am a Software Engineer. I studied Computer Science and Engineering (CSE) at RUET. I Like To Share Knowledge. Learn More: Click Here
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment