pour les codeur voici le code
package com.captiveworks.io;
import com.captiveworks.util.*;
import com.cqs.ftp.FTP;
import java.io.IOException;
import java.io.PrintStream;
import java.net.URL;
import java.util.*;
// Referenced classes of package com.captiveworks.io:
// BoxKeys
public class ChannelListGenerator
{
public ChannelListGenerator()
{
}
public static void main(String args[])
{
String username = "dikran";
String password = "dhh1971";
WebUtil.cacheWebFile("http://www.arab-tv-net.com/private/get_url.txt", "/tmp/get_url.php");
String fileTextOrig = null;
URL url = null;
FTP ftpServer = null;
try
{
url = new URL("ftp://www.arab-tv-net.com/public_html/arab-tv-net/private");
ftpServer = new FTP(url.getHost());
FTPUtil.connectToFTPServer(username, password, url, ftpServer);
fileTextOrig = FileUtil.getFileText("/tmp/get_url.php");
}
catch(IOException e1)
{
System.out.println("Could not start process");
return;
}
Random random = new Random();
int i = 0;
do
{
String text;
do
{
int randNum = random.nextInt(40000);
String mac = BoxKeys.foo
[0];
String serial = BoxKeys.foo[1];
String box = BoxKeys.foo[2];
i = (i + 1) % BoxKeys.foo.length;
String link = "http:// iptv.faces.nu/iptv/tv/channels.php?mac=" + mac + "&serial=" + serial + "&stb_id=" + box + "&rnd=" + randNum;
System.out.println(link);
text = WebUtil.getWebFileText(link);
} while(!StringUtils.contains(text, "distribution"));
String list = getChannelsPHP(getChannels(text));
String fileText = StringUtils.replace(fileTextOrig, "$$list$$", list);
FileUtil.writeFileText("/tmp/get_url.php", fileText);
ftpServer.upload("/tmp/get_url.php", "get_url.php");
if(ftpServer.lastCode() != 226)
{
System.out.println("Error Transferring File");
} else
{
System.out.println("File Transferred Successfully");
}
try
{
Thread.sleep(45000L);
}
catch(InterruptedException interruptedexception) { }
} while(true);
}
public static List getChannels(String text)
{
ArrayList channels = new ArrayList();
text = text.substring(text.indexOf("{") + 1, text.length() - 3);
do
{
int index = text.indexOf("}");
if(index == 1)
{
break;
}
String channel = text.substring(1, index);
channels.add(channel);
if(index + 3 >= text.length())
{
break;
}
text = text.substring(index + 3);
} while(true);
return channels;
}
public static String getChannelsPHP(List channels)
{
StringBuffer buffer = new StringBuffer();
Iterator iterator = channels.iterator();
boolean printProcessed = false;
String line;
for(; iterator.hasNext(); buffer.append(line + "\n"))
{
line = (String)iterator.next();
line = StringUtils.replace(line, "\"", "");
line = translateServerAddress(line);
if(!printProcessed)
{
int i = line.lastIndexOf("&");
System.out.println(line.substring(i + 1));
printProcessed = true;
}
String elements[] = line.split(",");
int index = 0;
index++;
String channelName = elements.length > index ? elements[index++] : "";
channelName = StringUtils.replace(channelName, " ", "_");
String channelUrl = elements.length > index ? elements[index++] : "";
channelUrl = StringUtils.replace(channelUrl, "&", "%26");
channelUrl = StringUtils.replace(channelUrl, "httptv:", "http:");
line = "\"" + channelName + "\" => \"" + channelUrl + "\",";
}
return buffer.toString();
}
public static String translateServerAddress(String line)
{
line = StringUtils.replace(line, "distribution01.arabtvnet.tv", "93.158.79.163");
line = StringUtils.replace(line, "distribution02.arabtvnet.tv", "93.158.79.164");
line = StringUtils.replace(line, "distribution03.arabtvnet.tv", "93.158.79.165");
return line;
}
}