0

One of my first posts on this site was regarding a down-loader program that I wanted to write for a website... This I have accomplished, after that, they encoded the links I was using with base32 ( or something like that ) after which I decoded the links, and made my program work again...

Now, they have some sort of checker running before you access the site for the first time ( which creates a session key or something of the sorts that expires after x hours )

The site in question is Kissanime

On to my question, how can I make my current solution bypass this check? , It says that the process takes 5 seconds to complete, and I have made my program wait 10 seconds to be safe, to no avail ( didn't think it'd be that easy though )

I'm on my phone currently but will add my current code as soon as I get to my PC

What I have gathered from looking through the page in question with chrome's development tools, is that this "check" is most likely created for the sole purpose of blocking programs from accessing it, but I have seen other programs using the site to pull data from so there has to be a way...

In conclusion, I am quite inexperienced with using Delphi's Indy components to interface with websites in general, so this is all new ground for me ( Note : This is solely for the purpose of learning, I do not intend to do illegal activities by doing this )

EDIT : Adding Code

procedure TForm1.btnParseClick(Sender: TObject);      // Clicking on the POST login info button
var
  Params : TStringList;
  UserName , Password : string;
begin
  Username := edtUsername.Text;       // Save the username
  Password := edtPassword.Text;       // Save the password
  IdHTTP := TIdHTTP.Create(self);     // Create HTTP component
  IdHTTP.Request.UserAgent := 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20100101 Firefox/12.0';       // Set user agent
  IdHTTP.HandleRedirects := True;     // Set flag to automatically handle any redirects

  IdHTTP.Get('http://kissanime.com/Login');       // Get the login page
  Sleep(1200);
  // now submit the webform...
  Params := TStringList.Create;         // Create a stringlist
  try
    Params.Add('username=' + UserName);     // add username
    Params.Add('password=' + Password);     // add password
    Params.Add('btnSubmit=');               // add simulation of "btnSubmit" click
    Params.Add('redirect=');                // Redirection

    IdHTTP.Post('http://kissanime.com/login', Params);        // Post information
  finally
    Params.Free;          // Free parameter stringlist
    mmoOutputTest.Lines.Add('Login Sucessfull');      // output
    mmoOutputTest.Lines.Add('--------------------------');
    mmoOutputTest.Lines.Add('Step Two : Enter the Anime Episode List Link');
    mmoOutputTest.Lines.Add('--------------------------')
  end;
end;

When running my program , i get the following error : HTTP/1.1 503 Service Temporarily Unavailable.

pnuts
  • 58,317
  • 11
  • 87
  • 139
Kazuto Kirigaya
  • 93
  • 1
  • 3
  • 13
  • *Note : This is solely for the purpose of learning, I do not intend to do illegal activities by doing this.* Yes, that sounds very plausible. – David Heffernan Sep 21 '15 at 11:04
  • Lol really I promise! I just want to learn about interfacing with websites and all of that... Besides, the anime is freely download able from the Site, I just want to make a program to automate the process for the sake of convenience – Kazuto Kirigaya Sep 21 '15 at 11:22
  • Please explain the downvote ? I see no reason for that to happen? – Kazuto Kirigaya Sep 21 '15 at 11:43
  • A quick look on the page shows that the javascript part is probably the problem. It's that part that is enforcing both the timeout and the "refresh" (it's actually a form submission). You could of course "decode" this java script and hard code it on your delphi program to bypass it. And you need to enable cookies. – GabrielF Sep 21 '15 at 12:38
  • Thanks for the reply! I will try to decode the JS however I'm not quite sure if I have that proficiency just yet, as I'm still in school, we are limited by only learning Delphi... However, I will attempt it and get back to you guys – Kazuto Kirigaya Sep 21 '15 at 13:05
  • Could you perhaps tell me what this form is submitting? Can't I just give it the needed values to successfully submit and let met pass? – Kazuto Kirigaya Sep 21 '15 at 13:06
  • Well, to know what to submit, you would need to execute the javascript. And I just figured it's a dynamic one, so it changes with each request. I guess the way to beat it is to actually parse the javascript (I know for sure that chrome's and firefox's engines are open source, so you could use them) searching on google for the name of one of the variables (`jschl-answer`) it seems to be a cloud-fare security protection that changes frequently. [Here's](https://github.com/Anorov/cloudflare-scrape) a Python code ready to bypass it. – GabrielF Sep 21 '15 at 19:34
  • So, if you're really into beating this challenge, there's a lot to learn. It's not too difficult, though, but it's a bunch of work. Start executing javascript from your Delphi client: http://stackoverflow.com/questions/4424117/how-can-i-execute-javascript-in-my-delphi-program-without-twebbrowser (and be aware that cloud-fare will probably update this protection frequently, so you'll only have a temporarily working code) – GabrielF Sep 21 '15 at 19:40
  • I appreciate your helpful insight into the matter greatly, thanks! I'm quite determined to beat this so I'll get to work!! – Kazuto Kirigaya Sep 22 '15 at 04:26

0 Answers0