source: titan/plugins/tithek/beeg.h @ 19884

Last change on this file since 19884 was 19884, checked in by obi, 11 years ago

[titan] update download stuff step1

File size: 869 bytes
Line 
1#ifndef BEEG_H
2#define BEEG_H
3
4char* beeg(char* link)
5{
6        debug(99, "link %s", link);
7        char* ip = NULL, *pos = NULL, *path = NULL, *streamurl = NULL, *tmpstr = NULL;
8       
9        ip = string_replace("http://", "", (char*)link, 0);
10
11        if(ip != NULL)
12                pos = strchr(ip, '/');
13        if(pos != NULL)
14        {
15                pos[0] = '\0';
16                path = pos + 1;
17        }
18
19        tmpstr = gethttp(ip, path, 80, NULL, NULL, 10000, NULL, 0);
20        if(getconfigint("debuglevel", NULL) == 99)
21                writesys("/tmp/beeg1_tmpstr", tmpstr, 0);
22
23        if(tmpstr != NULL)
24        {
25                streamurl = string_resub("'file': '","',",tmpstr,0);
26        }
27
28        free(tmpstr); tmpstr = NULL;
29        free(ip), ip = NULL;
30
31        if(getconfigint("debuglevel", NULL) == 99)
32                writesys("/tmp/beeg2_streamurl", streamurl, 0);
33
34// segfault munmap_chunk(): invalid pointer
35//      free(pos), pos = NULL;
36//      free(path), path = NULL;
37
38        debug(99, "streamurl: %s", streamurl); 
39        return streamurl;
40}
41
42#endif
Note: See TracBrowser for help on using the repository browser.