new to this forum. I am trying to pull off a weird script, but I am been stuck for some days now.
I have two text files.
Input.txt Contains a number that is generated randomly every 4 hours.
Playlist.txt Contains M3u links.
#EXTINF:-1 tvg-id="" tvg-name="CHAN 1" tvg-logo="" group-title="FTA",CHAN 1 http://xxxxx.com:25461/live/**010707**/11/11594.ts# EXTINF:-1 tvg-id="" tvg-name="CHAN " tvg-logo="" group-title="FTA",CHAN 2 http://xxxxx.com:25461/live/**010707**/11/11594.ts
So I want to find and replace all the ocurrences of 010707 and replace them with the number inside the Input.txt file in this case 083107 then save a copy of the Playlist.txt file, and every 4 hours replace that number again with the one inside the Input.txt file and so on.
I already have put together a very ugly but working script that uses grep and wget to download some files of the internet and generate that Input.txt file.
Thank you for your time.
Every day I download a M3uPlaylist file "Playlist.m3u" from some site, lets call it example.com.
But, the page "example.com" generates a new user every 4 hours and I need to replace it in the m3u file manually using find (Old user number) and replace (new user number).
/live/**010707**/11/11594.ts to /live/**083107**/11/11594.ts
This is what I came up with:
I point wget to example.com and download only the part of the website containing the user.
wget -qO- 19X.71.5X.252 | grep -oP 'User:.*' > User.txt
User: 083107 Password: 11
Then I use grep to generate a "cleaner" file.
grep 'User' User.txt | grep -o '[0-9]*' > Numbers.txt
083107 11 2
After that I use the "head" command to make a file containing the user name only.
head -1 Numbers.txt > input.txt
What i want to acomplish is to automatically update the Playlist.txt (or M3u) file with the new user number example.com is generating every 4 hours. Using the input.txt file for that.
This is the part of example.com source code that contains the user.
<!--You need to visit this site every 4 hours in order to get a new user--> <div id="domainSearch" class="domain-search--section bg--overlay-color bg--overlay-opacity-95 pd--80-0 text-center" data-bg-img="img/domain-search-img/bg.jpg"> <div class="container"> <!-- Domain Search Title Start --> <div class="domain-search--title"> <h2 class="h3">Whatsapp: +52 </h3> <h2 class="h2">User: 083107 Password: 11</h2>