Skip to content

Commit

Permalink
updated API url
Browse files Browse the repository at this point in the history
  • Loading branch information
podviaznikov committed Dec 25, 2010
1 parent 3b33094 commit fc4ab19
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .settings.xml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<settings version="0.0.2" ><auto><configurations debug="0" ><config path="runner.js" name="runner" args="" /></configurations><panel>{"ext/editors/editors":{"parent":{"visible":2,"flex":1,"state":0},"visible":2,"flex":1,"state":0},"ext/tree/tree":{"parent":{"visible":2,"width":"200","state":0},"visible":true,"flex":3,"state":"normal"},"ext/console/console":{"parent":{"visible":2,"height":"42","state":0},"visible":false,"flex":1,"state":0}}</panel><tree>["folder[1]","folder[1]/folder[1]","folder[1]/folder[1]/file[1]"]</tree><files active="/workspace/tests/tests.js"><file path="/workspace/README" type="file" size="0" name="README" contenttype="application/octet-stream" creationdate="" lockable="false" hidden="false" executable="false" scriptname="/home/podviaznikov/node-projects/node-torrent-search/README"/><file path="/workspace/torrent.js" type="file" size="893" name="torrent.js" contenttype="application/javascript; charset=utf-8" creationdate="" lockable="false" hidden="false" executable="false" scriptname="/home/podviaznikov/node-projects/node-torrent-search/torrent.js"/><file path="/workspace/tests/tests.js" type="file" size="226" name="tests.js" contenttype="application/javascript; charset=utf-8" creationdate="" lockable="false" hidden="false" executable="false" scriptname="/home/podviaznikov/node-projects/node-torrent-search/tests/tests.js"/></files></auto><general name="General" page="pgSettingsGeneral" saveallbeforerun="true"/><editors name="Editor" page="pgSettingsEditors"><code name="Code Editor" overwrite="false" selectstyle="line" activeline="true" showinvisibles="false" showprintmargin="true" printmargincolumn="80" softtabs="true" tabsize="4" scrollspeed="2"/></editors></settings>
<settings version="0.0.2" ><auto><configurations debug="0" ><config path="runner.js" name="runner" args="" /><config path="tests/tests.js" name="tests" args="" /></configurations><panel>{"ext/editors/editors":{"parent":{"visible":2,"flex":1,"state":0},"visible":2,"flex":1,"state":0},"ext/tree/tree":{"parent":{"visible":2,"width":"200","state":0},"visible":true,"flex":3,"state":"normal"},"ext/console/console":{"parent":{"visible":2,"height":200,"state":0},"visible":true,"flex":1,"state":0}}</panel><tree>["folder[1]","folder[1]/folder[1]","folder[1]/folder[1]/file[1]","folder[1]/file[1]"]</tree><files active="/workspace/torrent.js"><file path="/workspace/README" type="file" size="0" name="README" contenttype="application/octet-stream" creationdate="" lockable="false" hidden="false" executable="false" scriptname="/home/podviaznikov/node-projects/node-torrent-search/README"/><file path="/workspace/torrent.js" type="file" size="893" name="torrent.js" contenttype="application/javascript; charset=utf-8" creationdate="" lockable="false" hidden="false" executable="false" scriptname="/home/podviaznikov/node-projects/node-torrent-search/torrent.js"/><file path="/workspace/tests/tests.js" type="file" size="226" name="tests.js" contenttype="application/javascript; charset=utf-8" creationdate="" lockable="false" hidden="false" executable="false" scriptname="/home/podviaznikov/node-projects/node-torrent-search/tests/tests.js"/></files></auto><general name="General" page="pgSettingsGeneral" saveallbeforerun="true"/><editors name="Editor" page="pgSettingsEditors"><code name="Code Editor" overwrite="false" selectstyle="line" activeline="true" showinvisibles="false" showprintmargin="true" printmargincolumn="80" softtabs="true" tabsize="4" scrollspeed="2"/></editors></settings>
3 changes: 1 addition & 2 deletions tests/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,4 @@ exports.testFindFirstMovieItem = function(assert)
var movieItem = data.items.list[0];
assert.match(movieItem.title,/Inception/)
});
};

};
9 changes: 7 additions & 2 deletions torrent.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var sys = require('sys'),
*/
var Torrent = function()
{
this.client = http.createClient(80, 'isohunt.com');
this.client = http.createClient(80, 'ca.isohunt.com');
this.headers = {'Host': this.client.host};
this.path = '/js/json.php';
};
Expand Down Expand Up @@ -38,8 +38,9 @@ Torrent.prototype.find = function(query,callback,errorCallback)
var request = this.client.request('GET', path, this.headers);
request.on('response', function (response)
{
if(response.statusCode ==200)
if(response.statusCode==200)
{

var buffer = '';
response.setEncoding('utf8');
response.on('data', function (chunk)
Expand All @@ -55,6 +56,10 @@ Torrent.prototype.find = function(query,callback,errorCallback)
else if(errorCallback)
{
errorCallback(response.statusCode);
}
else
{
sys.log('Failed to handle respeonse with code'+response.statusCode);
}
});
request.end();
Expand Down

0 comments on commit fc4ab19

Please sign in to comment.