2

I'm trying to setup a recipe to download a torrent file automatically to my Dropbox. Pretty much like this one but with another RSS source.

This recipe works fine if the entryUrl is a direct download link. But if the entryUrl is using redirection it only downloads a strange binary file. The extension is good but the added file is corrupted and can't be used.

Is anyone getting such a behaviour and knows a workaround?

  • The behavior you're seeing doesn't surprise me. I mean, the IFTTT http client can only be so intelligent. I wouldn't let it follow redirects, either. Who knows where they might lead? (Not to mention the potential for infinite loops.) I'm afraid I don't have a solution for you. You're going to need to find something else which can resolve redirects. – ale Oct 2 '14 at 0:02
  • "Who knows where they might lead?" : Users know what they are doing, no? ( ok, don't trust users I know... XD ) Infinite loop can be stoped by adding a limit to redirections number. It doesn't seem like a huge matter to me. Anyway I'm working on something that might help. I'll let you know. – Guian Oct 2 '14 at 6:40
2

Ok here is what I've done :

(solution for developpers. Needs a php server.)

I've writen a PHP script that get the file through redirection (using cURL) and return it. It's another kind of redirection, but it works well with ifttt.

<?PHP
    //get url parameter
    $url = $_GET['url'];



    // send the right headers
    header('Content-Description: File Transfer');
    header('Content-Type: application/octet-stream');
    header('Content-Transfer-Encoding: binary');
    header('Connection: Keep-Alive');
    header('Expires: 0');
    header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
    header('Pragma: public');
    header('Content-Length: ' . filesize($file));
    header('Content-Disposition: attachment; filename="toDownload.torrent"');


    //then download the new file using curl to follow redirection :
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_ENCODING, "gzip"); // Important 
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($ch, CURLOPT_TIMEOUT, 50);

    $st = curl_exec($ch);
    curl_close($ch);

    exit;
?>

Then I've used Yahoo pipes to modify the torrent RSS feed so each link becomes :

http:// [my.server.url]/thisscript.php?url=http:// the.redirect.url/324pfokT5

it makes ifttt believe its not a redirection and download the good file ! :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.