Unix/Linux Go Back    


Shell Programming and Scripting BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

Need Help Please ! Curl + KODI agent ?

Shell Programming and Scripting


Reply    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 1 Week Ago
alielkamel alielkamel is offline
Registered User
 
Join Date: Jul 2017
Last Activity: 19 July 2017, 1:48 PM EDT
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Need Help Please ! Curl + KODI agent ?

Hi ,
Please i need your help ,
I wrote a script that allows me to use CURL to have information on streaming links. I managed to write the script for the streaming links that are hosted in the streaming website, and I was able to get the information from the servers (the links are: URL/File.mp4 , Also I use the command WGET when I want to download the link.
My problem is: how to use CURL to get a response that the link exists and it is valid in the server like this link: ( i got the links from KODI )
****URL/B4U_Music/B4U_Music.m3u8
I mean that i want to use CURL with kodi links to get information from the server

Last edited by alielkamel; 1 Week Ago at 02:54 PM..
Sponsored Links
    #2  
Old Unix and Linux 1 Week Ago
migurus migurus is offline
Registered User
 
Join Date: Sep 2008
Last Activity: 18 July 2017, 6:17 PM EDT
Location: US
Posts: 292
Thanks: 56
Thanked 33 Times in 31 Posts
I see that you use wget, so consider
Code:
--spider

option.

you can say

Code:
 wget -q --spider your-url-to-check-here
 echo $?

0 means file exists, 1 means file does not exist
The Following User Says Thank You to migurus For This Useful Post:
alielkamel (1 Week Ago)
Sponsored Links
    #3  
Old Unix and Linux 1 Week Ago
alielkamel alielkamel is offline
Registered User
 
Join Date: Jul 2017
Last Activity: 19 July 2017, 1:48 PM EDT
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
thank you very much .
i used it and i have a 8 in return code .
The purpose of the request is how to prove that the link exists. With the curl command, I have a forbidden return 403 while the link is functional via kodi. Here is my script and example of a link for example :

*URL -->http:// dittotv.live-s.cdn.bitgravity .com /cdn-live/_definst_/dittotv/ secure/zee_cinema_hd_Web.smil/ playlist.m3u8

Script :

Code:
#!/bin/bash
declare ans2=Y;
while [ $ans2 = "Y" ];
do
read -p "URL to check: " url
if curl -v -i --output /dev/null --silent --fail "$url"; then
  printf  "$url --> The link exist !!:"
else
  printf "$url --> The link does not exist !!"
fi
printf 'Want you show the cURL information from the Streaming Link? (Y/N/Q):'
read -p " Your Answer :" ans
if [ $ans = "Q" ]; then 
exit 
fi
if [ $ans = "Y" ]; then curl -v -i "$url"
else printf 'OK ! No Prob ! -->  Next Question:' 
fi
printf 'Want You download the streaming video from the streaming server? (Y/N/Q):'
read -p "(Y/N/Q):" ans3
if [ $ans3 = "Q" ]; then 
exit 
fi
while [ $ans3 = "Y" ]
do
if curl --output /dev/null --silent --head --fail "$url"; then
wget "$url"
else 
printf "$red" 'The link is Down ! No file to download'
fi
exit
done
if [ $ans3 = "N" ]; then
printf 'OK ! No Prob ! -->  Next Question:'
fi
printf 'Want You check another URL ? (Y/N):'
read -p "(Y/N):" ans2
if [ $ans2 = "N" ] ; then 
printf "$red" "Good Bye - Thank you !!"
fi
done


Last edited by alielkamel; 1 Week Ago at 01:48 PM..
Sponsored Links
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
vcs agent sunshine12 UNIX for Dummies Questions & Answers 1 11-11-2009 03:41 PM
SNMP agent linuxbegginer IP Networking 0 03-30-2006 03:46 AM
Solaris agent Carmen123 UNIX for Dummies Questions & Answers 0 08-26-2005 11:56 AM



All times are GMT -4. The time now is 02:51 PM.