alashow / datmusic

Search and download free music from VK.
https://datmusic.xyz
MIT License
231 stars 58 forks source link

Error: Flood control: too much captcha requests and pretty url #8

Closed dogusozdemir closed 8 years ago

dogusozdemir commented 8 years ago

demo site error : Error: Flood control: too much captcha requests

and My Host dont have nginx rewrite , i want off pretty url because not working for change app.js prettiy url : false

sorry bad language

alashow commented 8 years ago

Hello.

Flood control error - is worst error in vk api. It blocks all tokens from all user applications (so they now blocked my fake user, for a while). For now, i fixed demo site. I used different user to get token.

Just checked to be sure that disabling prettyUrl mode is working, yes it's working. Just set config.prettyDownloadUrlMode to false.

In addition, I will try to translate rewrite code to apache format.

dogusozdemir commented 8 years ago

Thanks for demo site

App.js and app.min.js prettyDownloadUrlMode : false but download link is showing sample.com/asdfghj:asdfghjk and 404 not found

I found problem issue ;

App.js //little hard code edit

I delete if else and convert normal code

Like this :

aid = msg.response[i].aid;
 //little hard code :)
                    if (config.prettyDownloadUrlMode) {
                        streamUrl += "stream/";
                        //vk ownerId for groups is negative number, shit. invers it.
                        if (ownerId < 0) {
                            ownerId *= -1;
                            downloadUrl += "-";
                            streamUrl += "-";
                        }
                        prettyId = encode(ownerId) + ":" + encode(aid)
                        downloadUrl += prettyId;
                        streamUrl += prettyId;
                    } else {
                        downloadUrl += "download.php?audio_id=" + ownerId + "_" + aid;
                        streamUrl += "download.php?stream=true&audio_id=" + ownerId + "_" + aid;
                    }

                    audioTitle = msg.response[i].artist + ' - ' + msg.response[i].title;

convert this (delete if-else) :

  aid = msg.response[i].aid;
            downloadUrl = "download.php?audio_id=" + ownerId + "_" + aid;
            streamUrl = "download.php?stream=true&audio_id=" + ownerId + "_" + aid;
            audioTitle = msg.response[i].artist + ' - ' + msg.response[i].title;


Problem Solve but android app is error because app write for pretty link 

I want use pretty link but my host not supported. I cant use nginx rewrite. Maybe http rewrite .htaccess  solve this ?
alashow commented 8 years ago

Like I said, there is no error with disabling prettyDownloadUrlMode.

.htaccess file example:

RewriteEngine On
RewriteRule "^(-?\w{0,20}:\w{0,20})$" /download.php?id=$1 [L]
RewriteRule "^stream/(-?\w{0,20}:\w{0,20})$" /download.php?stream=true&id=$1 [L]

Couldn't test, but it should work.