🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.internet.web
5 messages
5 total messages Started by Jesper Fri, 27 Jan 2006 18:37
Parsing
#874
Author: Jesper
Date: Fri, 27 Jan 2006 18:37
13 lines
1361 bytes
Hi

I have a question. Is it possible to "intercept" the information sent back 
from a server?

I mean, when I search for torrents at MiniNova (http://www.mininova.com) the 
information that gets sent back to the webpage is organized to a webpage. Is 
it possible to get the "raw data" and create a webpage with the links 
yourself. I think it's called Parsing.

Hopfull for answers

/J 
Re: Parsing
#875
Author: Remy Lebeau (TeamB)
Date: Fri, 27 Jan 2006 19:04
12 lines
1243 bytes
"Jesper" <jesper@safholm.com> wrote in message
news:43da67c1@newsgroups.borland.com...

> Is it possible to "intercept" the information sent back from a server?

Yes.  But how you do it depends on how you are transferring the data to
begin with.  Please provide more details.  What components/classes are you
using?  What does the code look like?


Gambit
Re: Parsing
#876
Author: Jesper
Date: Fri, 27 Jan 2006 19:30
32 lines
2099 bytes
Thanx for your quic answer! :-)

I havn't written anything yet, still just playing with some ideas.
I just found this site that does it, Orb's Torrent Site Status 
(http://www.orbdesign.net/bt/). They make you search a whole bunch of 
torrent sites and then the answer will be presented in a new webpage. Is it 
possible, using Indy or some other component, to do the exact same thing?
They must send some info to the server and then get it back. I guess they 
use PHP and in that case can you transfer the idea to BCB.

I'm using BCB6 btw.

Cheerz
/J


"Remy Lebeau (TeamB)" <no.spam@no.spam.com> skrev i meddelandet 
news:43da6e73@newsgroups.borland.com...
>
> "Jesper" <jesper@safholm.com> wrote in message
> news:43da67c1@newsgroups.borland.com...
>
>> Is it possible to "intercept" the information sent back from a server?
>
> Yes.  But how you do it depends on how you are transferring the data to
> begin with.  Please provide more details.  What components/classes are you
> using?  What does the code look like?
>
>
> Gambit
>
> 
Re. Parsing
#877
Author: Elmar Baumann
Date: Fri, 27 Jan 2006 19:39
142 lines
4184 bytes
>Jesper wrote in Article <43da67c1@newsgroups.borland.com>
>with Subject: Parsing, on 27.01.2006 19:37:50
>
>
>Hi
>
>I have a question. Is it possible to "intercept" the information sent back 
>from a server?
>
>I mean, when I search for torrents at MiniNova (http://www.mininova.com) the 
>information that gets sent back to the webpage is organized to a webpage. Is 
>it possible to get the "raw data" and create a webpage with the links 
>yourself. I think it's called Parsing.

Hi,
i have wrote an irc-bot function that can be interesting for you,
here is the snippet:


void __fastcall TForm1::Torrentz(AnsiString Content) //Content == Searchstring
{
 int pos,begin,end;
 AnsiString TorrentSearch,line,buff,Str,Kategorie,Name,Link,url,txt,link,html;

 torrentz_work = true; // global boolean 

 TMetaClass *cl;
 TIdURI *uri;

 
 TorrentSearch = Content.SubString(10,Content.Length()-9); // get the searchstring of "!torrentz xxxxx"

 txt = TorrentSearch.Trim();

 do
 {
  pos = txt.Pos(" ");

  if(pos > 0)
  {
   txt.Delete(pos,1);
   txt.Insert("+",pos);
  }
 }
 while(txt.Pos(" ") > 0);


 url = uri->URLEncode(cl,"http://www.mininova.org/search/?search="+txt);

 try
 {
  if(txt.Length() > 0)
  {

   html = IdHTTP1->Get(url);

   if(html.Pos("No torrents found") == 0)
   {
    begin = html.Pos("Leechers");
    buff =  html.SubString(begin,html.Length()-begin);

    if(buff.Pos("cat/") > 0)
    {
     begin = buff.Pos("cat/");
     end = buff.Pos("</a>");
     Str = buff.SubString(begin+7,end-4);
    }

    Kategorie = Str.Trim();

    Str = buff.SubString(begin,250);
    line = Str;

    begin = Str.Pos("/tor");
    buff =  Str.SubString(begin,100);

    end = buff.Pos(">");
    buff = Str.SubString(begin,end-2);

    Link = "http://www.mininova.org"+buff;

    begin = line.Pos(buff);
    buff = line.SubString(begin,100);

    begin = buff.Pos(">");
    end = buff.Pos("</");

    line = buff.SubString(begin+1,end-2);

    begin = line.Pos("</a>");
    line = line.SubString(1,begin-1);

    Name = line;

    link =  "1st Mininova Result for "+txt+": �["+Kategorie+"]� "+Name+" - "+Kategorie+" - "+Link;


    if(link.Length() > 0)
    {
     TorrentResult = Link.Trim();

    }
    else
    {
     TorrentResult = "Mininova Torrent SearchEngine - No Torrents found for "+txt;
    }
   }
   else
   {
    TorrentResult = "Mininova SearchEngine - No Torrents for "+txt;
   }
  }
 }
 catch (Exception &exception)
 {
  TorrentResult = exception.Message;
 }

 torrentz_work = false;
}


The String Link contents the Hyperlink for the searched Torrent when found. In a separate
IdHTTP-Get(Link); - you could get the html. 

(Note - html-parsing does not work for all times, if mininova change it's html-outputs, you
have to adjust the code)



Regards

Elmar Baumann



------------------------------------------------------------------------------
Indy9 NNTP Internet News Reader/Writer, E. Baumann Software 2005

Portions of this Software are Copyright (c) 1993 - 2005, 
Chad Z. Hower (Kudzu) and the Indy Pit Crew 
<http://www.IndyProject.org/>
Re: Re. Parsing
#878
Author: Jesper
Date: Fri, 27 Jan 2006 19:51
167 lines
5001 bytes
Big thanx!!

Now there is just one big problem, I've just started with thias type of 
programming so I don't even know half of what you wrote.
I would be most greatfull if you could create an example and send it to me. 
I'm just starting to understand all the functions.
That would do my night!
My mail is: jesper (at) safholm (dot) com

Best regards
Jesper


"Elmar Baumann" <elmar-nospam@anywhere.net> skrev i meddelandet 
news:43da7656$1@newsgroups.borland.com...
> >Jesper wrote in Article <43da67c1@newsgroups.borland.com>
>>with Subject: Parsing, on 27.01.2006 19:37:50
>>
>>
>>Hi
>>
>>I have a question. Is it possible to "intercept" the information sent back
>>from a server?
>>
>>I mean, when I search for torrents at MiniNova (http://www.mininova.com) 
>>the
>>information that gets sent back to the webpage is organized to a webpage. 
>>Is
>>it possible to get the "raw data" and create a webpage with the links
>>yourself. I think it's called Parsing.
>
> Hi,
> i have wrote an irc-bot function that can be interesting for you,
> here is the snippet:
>
>
> void __fastcall TForm1::Torrentz(AnsiString Content) //Content == 
> Searchstring
> {
> int pos,begin,end;
> AnsiString 
> TorrentSearch,line,buff,Str,Kategorie,Name,Link,url,txt,link,html;
>
> torrentz_work = true; // global boolean
>
> TMetaClass *cl;
> TIdURI *uri;
>
>
> TorrentSearch = Content.SubString(10,Content.Length()-9); // get the 
> searchstring of "!torrentz xxxxx"
>
> txt = TorrentSearch.Trim();
>
> do
> {
>  pos = txt.Pos(" ");
>
>  if(pos > 0)
>  {
>   txt.Delete(pos,1);
>   txt.Insert("+",pos);
>  }
> }
> while(txt.Pos(" ") > 0);
>
>
> url = uri->URLEncode(cl,"http://www.mininova.org/search/?search="+txt);
>
> try
> {
>  if(txt.Length() > 0)
>  {
>
>   html = IdHTTP1->Get(url);
>
>   if(html.Pos("No torrents found") == 0)
>   {
>    begin = html.Pos("Leechers");
>    buff =  html.SubString(begin,html.Length()-begin);
>
>    if(buff.Pos("cat/") > 0)
>    {
>     begin = buff.Pos("cat/");
>     end = buff.Pos("</a>");
>     Str = buff.SubString(begin+7,end-4);
>    }
>
>    Kategorie = Str.Trim();
>
>    Str = buff.SubString(begin,250);
>    line = Str;
>
>    begin = Str.Pos("/tor");
>    buff =  Str.SubString(begin,100);
>
>    end = buff.Pos(">");
>    buff = Str.SubString(begin,end-2);
>
>    Link = "http://www.mininova.org"+buff;
>
>    begin = line.Pos(buff);
>    buff = line.SubString(begin,100);
>
>    begin = buff.Pos(">");
>    end = buff.Pos("</");
>
>    line = buff.SubString(begin+1,end-2);
>
>    begin = line.Pos("</a>");
>    line = line.SubString(1,begin-1);
>
>    Name = line;
>
>    link =  "1st Mininova Result for "+txt+": �["+Kategorie+"]� "+Name+" - 
> "+Kategorie+" - "+Link;
>
>
>    if(link.Length() > 0)
>    {
>     TorrentResult = Link.Trim();
>
>    }
>    else
>    {
>     TorrentResult = "Mininova Torrent SearchEngine - No Torrents found for 
> "+txt;
>    }
>   }
>   else
>   {
>    TorrentResult = "Mininova SearchEngine - No Torrents for "+txt;
>   }
>  }
> }
> catch (Exception &exception)
> {
>  TorrentResult = exception.Message;
> }
>
> torrentz_work = false;
> }
>
>
> The String Link contents the Hyperlink for the searched Torrent when 
> found. In a separate
> IdHTTP-Get(Link); - you could get the html.
>
> (Note - html-parsing does not work for all times, if mininova change it's 
> html-outputs, you
> have to adjust the code)
>
>
>
> Regards
>
> Elmar Baumann
>
>
>
> ------------------------------------------------------------------------------
> Indy9 NNTP Internet News Reader/Writer, E. Baumann Software 2005
>
> Portions of this Software are Copyright (c) 1993 - 2005,
> Chad Z. Hower (Kudzu) and the Indy Pit Crew
> <http://www.IndyProject.org/>
> 
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads