homicidalmaggot / gotube

Automatically exported from code.google.com/p/gotube
0 stars 0 forks source link

Trying create scripts, but epic fail... #54

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hi, im trying to create a two script´s for gotube, but i fail, i tried to 
follow the tutorial in the home page, but as you can see, my scripts dont 
work...

Here the scripts...

1 (a try for making a stupidvideos script)

var stupidvideo = new Object();
stupidvideo.rev        = beta;
stupidvideo.SearchDesc =
stupidvideo.Name       = "stupidvideo";
stupidvideo.Search     = function (keyword, page){
var result = new Object();
result.bypage    = 15;
result.start     = (page-1)*result.bypage+1;
c=GetContents('http://www.stupidvideos.com/search/'+escape(keyword)+'/'+page);
result.total     = -1;
result.VideoInfo = new Array();
while(p=c.indexOf("<item>",p)+1){
video = new Object();
video.attr          = 3;
video.Title         = ext("<title>");
video.SaveFilename  = video.Title+'.flv';
video.URL           = 
'unescape(GetContents("http://stupidvideos.com/videos/just_plain_stupid/'+video.
id+'").match(\'"video", "(.*?)"\')[1])';
result.VideoInfo.push(video);
}
result.end       = result.start-1+result.VideoInfo.length;
return result;
}
SiteList.push(Stupidvideos);

(im dont have any idea about coding, but i try to learn...)

Script 2 (videolandia)

var videolandia = new Object();
videolandia.rev        = 1;
videolandia.SearchDesc =
videolandia.Name       = "videolandia";
videolandia.Search     = function (keyword, page){
var result = new Object();
result.bypage    = 10;
result.start     = (page-1)*result.bypage+1;
c=GetContents('http://www.videolandia.com/v/search.php?joker='+escape(keyword)+'
&from='+page);
result.total     = -1;
result.VideoInfo = new Array();
while(p=c.indexOf("<item>",p)+1){
video = new Object();
video.attr          = 3;
video.Title         = ext("<title>");
video.SaveFilename  = video.Title+'.flv';
video.URL           = 
'unescape(GetContents("http://www.videolandia.com/v/video/'+video.id+'").match(\
'"video", "(.*?)"\')[1])';
result.VideoInfo.push(video);
}
result.end       = result.start-1+result.VideoInfo.length;
return result;
}
SiteList.push(videolandia);

The first script is a fatal error, gotube says ''imposible to load script'' 
when i learn a little bit more, i discovered the problem,
and try to make a second script (videolandia) and this is accepted by gotube, 
but, it dont give search results... (posibly i dont give it usable url.... or i 
am  really a trashboy..)

But, ok, i make a try...

mmmm, i will continue making try's...
I want to code for gotube...
BUt good, if someone can help me, (to learn how..) i will be so much gratefull.

Thank´s for all.

PD: sorry for the bad english...

Original issue reported on code.google.com by pspa...@gmail.com on 31 May 2011 at 7:28

GoogleCodeExporter commented 8 years ago
on stupidvideo, i thinks its :
while(p=c.indexOf('<div class="video_box">',p)+1){
and use this to get the title :
ext('title="');
and about the script error , i suspect the video.URL line

and videolandia is not a good site ... only 2 result by page O_o ?!!

at least you tried ... a lot of ppl don't

Original comment by biscotte...@gmail.com on 31 May 2011 at 7:41

GoogleCodeExporter commented 8 years ago
ok, thanks, i´m correcting stupidvideos....

mmmm, i make another try (T_T fail again)

Here the script...

var xvideos = new Object();
xvideos.rev        = 1;
xvideos.SearchDesc =
xvideos.Name       = "xvideos";
xvideos.Search     = function (keyword, page){
var result = new Object();
result.bypage    = 36;
result.start     = (page-1)*result.bypage+1;
c=GetContents('http://www.xvideos.com/?k='+escape(keyword)+'&p='+page);
result.total     = -1;
result.VideoInfo = new Array();
video.SaveFilename  = video.Title+'.flv';
video.URL           = 
'unescape(GetContents("http://www.xvideos.com/'+video.id+'").match(\'"video", 
"(.*?)"\')[1])';
result.VideoInfo.push(video);
}
result.end       = result.start-1+result.VideoInfo.length;
}
SiteList.push(xvideos);

Its form Xvideos.... (i have a troble in the video url... when 
http://www.xvideos.com/video-HERE THE PROBLEM, a number appears, how i will say 
the url if all vids have diferent number...-/-the name of the vid normal...-

This script says me error again.... (lol) any help???

Original comment by pspa...@gmail.com on 31 May 2011 at 9:30

GoogleCodeExporter commented 8 years ago
there is a missing opening bracket "{"
maybe because you remove the while line ...

Original comment by biscotte...@gmail.com on 31 May 2011 at 9:38

GoogleCodeExporter commented 8 years ago
yes the while line, i can´t found the appropiate string in xvideos.... 
(really... i searched in the code of the page..)

''I´m the disciple, you´re the master...''

Original comment by pspa...@gmail.com on 31 May 2011 at 9:42

GoogleCodeExporter commented 8 years ago
mmmmm i can´t repare stupidvideos (i accept it, im trash, really trash..) 

It´s still saying me ''can´t load script...''

(i repared the stuff you´re saying me... my problem is the video.URL line...)

Thanks!!!

Original comment by pspa...@gmail.com on 31 May 2011 at 9:52

GoogleCodeExporter commented 8 years ago
before making a script for Xvideo , you should verify that the videos can be 
played by the PSP
download on of them with your pc (using a firefox plugin or whatever)
copy to the MS /VIDEO/
play it from GoTube's "favorites" tab and see if it's correctly played ;)

Original comment by biscotte...@gmail.com on 31 May 2011 at 9:58

GoogleCodeExporter commented 8 years ago
yes! it plays perfectly without problems (original speed, good resolution, etc) 
                 ok, and now?

Original comment by pspa...@gmail.com on 31 May 2011 at 10:57

GoogleCodeExporter commented 8 years ago
now, try to understand, (no more copy pasta from example)
at least for the search part (don't work on the video.URL part ATM)

Original comment by biscotte...@gmail.com on 31 May 2011 at 11:14

GoogleCodeExporter commented 8 years ago
mmmm, any example? (really this its to difficult for me) and maybe you can 
explain the video.URL part...                                                   

Sorry for my rare english u.u

Original comment by pspa...@gmail.com on 1 Jun 2011 at 11:48

GoogleCodeExporter commented 8 years ago
if you need some example, check my repository :
http://code.google.com/p/gotube/source/browse/#svn%2Ftrunk%2Fbiscotte

i'll do the URL part if you succeed with the search part (title,desc,thumbnail) 
:3

Original comment by biscotte...@gmail.com on 1 Jun 2011 at 4:12

GoogleCodeExporter commented 8 years ago
ok, its good for me....

i will post my progress, ok

Thanks!!!

Original comment by pspa...@gmail.com on 1 Jun 2011 at 8:26

GoogleCodeExporter commented 8 years ago
unction XVideos_CheckURL( url, option )
{
    if (url.match("http://www.xvideos.com/") == "http://www.xvideos.com/"){
        return 1;
    } else{
        return 0;
    }
}

/*
 Get a XVideos URL
*/
function XVideos_GetURL( url, option )
{
    var contents = GetContents(url);
    if(contents == null){return null; /* error getting page */}
    var video_url = contents.match(/&flv_url\=(.*?)&/);
    var video_url = video_url[1];
    return video_url;
}

function XVideos_Search( keyword, start_index, length, option )
{
    var result = new Object();
        result.keyword   = keyword; // Search
    result.VideoInfo = new Array(); // Results in sequence
    result.start     = start_index; // Index of first result
    result.end       = 0;
    result.total     = -1;
    var perpage = 36;

    result.start = (((result.start - 1) / 10) * perpage) + 1;

    if(result.start < perpage){
    var contents = GetContents("http://www.xvideos.com/?k=" + keyword.replace(/ /g, "+"));
    } else{
    var num = (result.start - 1) / perpage;
    var contents = GetContents("http://www.xvideos.com/?k=" + keyword.replace(/ /g, "+") + "&p=" + num);
    }
    if(contents == null){return null; /* failed to get page */}

    result.total = 10000;

    while(1){
    pos = contents.indexOf("<td width=\"183\"><a href=\"");

    if(pos != -1){
        //Get URL
        contents = contents.substring(pos + 25, contents.length);
        pos = contents.indexOf("\" class=\"miniature\"><img src=\"");
        var url = contents.substring(0, pos);
        //Get Thumbnail
        contents = contents.substring(pos + 30, contents.length);
        pos = contents.indexOf("\" onMouseOver=");
        var thumb_url = contents.substring(0, pos);
        //Title
        pos = contents.indexOf("<span class=\"red\" style=\"text-decoration:underline;\">");
        contents = contents.substring(pos + 53, contents.length);
        pos = contents.indexOf("</span>");
        var title = ImproveText(contents.substring(0, pos));
        //Length
        pos = contents.indexOf("<strong>");
        contents = contents.substring(pos + 8, contents.length);
        pos = contents.indexOf(")</strong> ");
        var length = contents.substring(0, pos);
        var mins = length.match(/\((.*?) min/);
        if(mins != null){
            var seconds = length.match(/min (.*?) sec/);
            var length = parseInt(mins[1]) * 60;
        } else{
            var seconds = length.match(/\((.*?) sec/);
            var length = 0;
        }
        if(seconds != null){length += parseInt(seconds[1]);}
        //Description
        contents = contents.substring(pos + 11, contents.length);
        pos = contents.indexOf(" </td>");
        var description = splitTo2Lines(ImproveText(contents.substring(0, pos)), 60);

        info = new Object();
        info.URL = url;
        info.ThumbnailURL = thumb_url;
        info.Title = title;
        info.LengthSeconds = length;
        info.Description = description;
        info.attr = 7;
        result.VideoInfo.push( info );
        if(result.VideoInfo.length == perpage){break;}
        if(result.start + (result.VideoInfo.length - 1) == result.total){break;}
    } else{
        break;
    }
    }

    if(result.VideoInfo.length) {
        result.end   = result.start + (result.VideoInfo.length - 1);
    } else {
        result.total = 0;   // no results.
    }

    if(result.VideoInfo.length != perpage){result.total = result.end;}

    return result;
}

MMMMM, what about this???

Is trash again???
or can be simplified for gotube?

(trust me, i don´t understand so much about javascript..)

Original comment by pspa...@gmail.com on 1 Jun 2011 at 10:51

GoogleCodeExporter commented 8 years ago
according to all non-optimized function it's a ultimate psptube script ...
of cours it can be simplified to gotube

Original comment by biscotte...@gmail.com on 1 Jun 2011 at 11:03

GoogleCodeExporter commented 8 years ago
yes (it´s a rare thing founded here 
http://www.maxconsole.net/showthread.php?129699-HOW-TO-Create-your-own-PSPTube-s
cript-files&s=d78af642f1ce4c6aa572bf6a301f53ec)

n_n i try to follow the tutorial.... now it´s time to see if i make a good 
work (a tutoirial of psptube)

(and because y found in the web non-simplified tutorials about 
javascripting...) and comparing files....

Ok(maybe you can teach me how to port it to gotube...)

Thanks!!!

Original comment by pspa...@gmail.com on 1 Jun 2011 at 11:18

GoogleCodeExporter commented 8 years ago
its better to start than adapt from an outdated
what you dont understand ?

Original comment by biscotte...@gmail.com on 2 Jun 2011 at 10:01

GoogleCodeExporter commented 8 years ago
mmm, i think it´s the video.URL part, (really) i loss i pages that does things 
like this 
(http://freaky.com/videos/video326566495495/freak-gets-really-stupid-xD) in the 
part that´s say ''video541685'' i dont understand how to say to gotube it 
(because all vids have diferent codes..) that's if you´re talking about this...

If you don´t, ... (i´m really trash...) 

Ok...

Thanks for the support!
And, maybe i dont have the necesary javascript skills

Original comment by pspa...@gmail.com on 3 Jun 2011 at 2:19