source: titan/plugins/tithek/vivo.h @ 41939

Last change on this file since 41939 was 36083, checked in by obi, 8 years ago

fix

File size: 3.4 KB
Line 
1#ifndef VIVO_H
2#define VIVO_H
3
4char* vivo(char* link)
5{
6        debug(99, "link: %s", link);
7        int debuglevel = getconfigint("debuglevel", NULL);
8        char* tmplink = NULL, *tmpstr = NULL, *streamlink = NULL, *timestamp = NULL, *hash = NULL, *post = NULL;
9
10        if(link == NULL) return NULL;
11
12        unlink("/tmp/vivo1_get");
13        unlink("/tmp/vivo2_streamlink");
14/////////////
15
16        tmplink = ostrcat(link, NULL, 0, 0);
17
18        if(ostrstr(link, "/Out/?s=") != NULL)
19        {
20                tmplink = string_replace("/Out/?s=", "", tmplink, 1);
21                debug(99, "remove out string: %s", tmplink);
22        }
23
24/*
25http://vivo.me/5942ab22ad
26'GET /5942ab22ad HTTP/1.1\r\nHost: vivo.sx\r\nUser-Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.99 Safari/535.1\r\nReferer: http://vivo.sx/5942ab22ad\r\nConnection: close\r\nAccept-Encoding: gzip\r\n\r\n'
27'POST /5942ab22ad HTTP/1.1\r\nContent-Length: 58\r\nAccept-Encoding: gzip\r\nHost: vivo.sx\r\nUser-Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.99 Safari/535.1\r\nConnection: close\r\nReferer: http://vivo.sx/5942ab22ad\r\nX-Requested-With: XMLHttpRequest\r\nContent-Type: application/x-www-form-urlencoded\r\n\r\ntimestamp=1446560163&hash=22e41c3d978979656dfcd945fb285214'
28'GET /get/0000106725?e=1446588963&s=300&m=video/mp4&h=wW_uIfK-PToRvLcAqacScg HTTP/1.1\r\nAccept-Encoding: identity\r\nHost: bella.storage.vivo.sx:8080\r\nConnection: close\r\nUser-Agent: Python-urllib/2.7\r\n\r\n'
29http://bella.storage.vivo.sx:8080/get/0000106725?e=1446588963&s=300&m=video/mp4&h=wW_uIfK-PToRvLcAqacScg
30*/
31
32        debug(99, "link: %s", tmplink);
33        tmpstr = gethttps(tmplink, NULL, NULL, NULL, NULL, NULL, 1);
34        titheklog(debuglevel, "/tmp/vivo1_get", NULL, NULL, NULL, tmpstr);     
35
36        if(tmpstr == NULL)
37        {
38                textbox(_("Message"), _("The page is temporarily unavailable") , _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 200, 0, 0);
39                goto end;
40        }
41
42        if(ostrstr(tmpstr, "404 Not Found") != NULL)
43        {
44                textbox(_("Message"), _("The video no longer exists") , _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 200, 0, 0);
45                goto end;
46        }
47
48        timestamp = string_resub("name=\"timestamp\" value=\"", "\"", tmpstr, 0);
49        hash = string_resub("name=\"hash\" value=\"", "\"", tmpstr, 0);
50
51        post = ostrcat("timestamp=", timestamp, 0, 0);
52        post = ostrcat(post, "&hash=", 1, 0);
53        post = ostrcat(post, hash, 1, 0);
54        debug(99, "post: %s", post);
55
56        tmpstr = gethttps(tmplink, NULL, post, NULL, NULL, NULL, 1);
57        titheklog(debuglevel, "/tmp/vivo2_post", NULL, NULL, NULL, tmpstr);     
58
59        if(tmpstr == NULL)
60        {
61                textbox(_("Message"), _("The page is temporarily unavailable") , _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 200, 0, 0);
62                goto end;
63        }
64
65        if(ostrstr(tmpstr, "404 Not Found") != NULL)
66        {
67                textbox(_("Message"), _("The video no longer exists") , _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 200, 0, 0);
68                goto end;
69        }
70
71        streamlink = string_resub("data-url=\"", "\"", tmpstr, 0);
72
73        tmpstr = gethttps(tmplink, NULL, NULL, NULL, NULL, NULL, 1);
74        titheklog(debuglevel, "/tmp/vivo3_get", NULL, NULL, NULL, tmpstr);     
75
76        titheklog(debuglevel, "/tmp/vivo1_streamlink", NULL, NULL, NULL, streamlink);
77
78end:
79        free(tmplink); tmplink = NULL;
80        free(tmpstr); tmpstr = NULL;
81
82        return streamlink;
83}
84
85#endif
Note: See TracBrowser for help on using the repository browser.