has officially started hosting with WebFaction and found it awesome! http://t.co/BQPYCI1I

Follow me

FilesTube API

Yesterday I received this small project to fix a Rapidshare searcher script. They were using an X-request from their server to FilesTube search form, then got the HTML result in a string and explode()‘ed it. Yes, you can tell it was once working like a charm, but not stable at all, since just one small change in FilesTube’s layout can break the code. And it did, really.

Lucky me (and my client), when changing the layout, the nice guys at FilesTube built an API also, as thoroughly technically described here. There’s an example too, and although it looks like a bunch of unmaintained code, it works out of the box. Actually, it does if your server meets these requirements (which I couldn’t find anywhere on FilesTube’s website):

  • It runs PHP 5, which is now the standard PHP version. I believe however, that you can use PHP 4 to achieve the exact result.
  • It has cURL enabled. This is, again, not a problem, since almost every hosting provider has it by default. Yours doesn’t? Well, it’s time to move dude. Being a conservative? You may try file_get_contents() instead.


The way it works is, just send a search phrase along with a uinique (and free!) API key to http://api.filestube.com/ (there are some other options available: related, sort, page, and extension), and receive back an XML string. Something like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<answer>
    <hasResults>1</hasResults>
    <results>
        <hitsTotal>603</hitsTotal>
        <pageNumber>2</pageNumber>
        <hitsForThisPage>10</hitsForThisPage>
        <hitsid="11">
            <name>I_am_a_good_daughter_-_Britney.part1.rar</name>
            <extension>rar</extension>
            <size>98MB</size>
            <description>No description saved</description>
            <address>http://www.filestube.com/91539aa90c9c531d03e9/go.html</address>
            <details>http://www.filestube.com/91539aa90c9c531d03e9/details.html</details>
            <tags>good|daughter|britney</tags>
            <rate>0.00</rate>
            <added>2007-09-1700:44:16</added>
            <related>14f84a6dab7f39c603e9</related>
            <password/>
        </hits>
        <hitsid="12">
            ...
        </hits>
            ...
        <hitsid="20">
            ...
        </hits>
    </results>
</answer>

As you can see, everything’s there. Now use a DOMDocument object to parse the XML string. Piece of cake.

The (running well) result can be seen here. No, I’m not associated with this website in anyway.


  • thank you about info :(

  • Hey ! all the parameters work except “extension”. Could you please describe me how it gets work?

  • Hi,
    Are you working on the search engine for files project? I would like to host  something like filestube.com or rapidlibrary.com. Do you know where can  I get a good PHP script?

You can follow any responses to this entry through the RSS 2.0 feed.