I created additional Class with function inside - Second.class.php.
Then I add in the beginning of index.php:
PHP Code:
// Instantiate second class
include 'Second.class.php';
$secondclass = new Second();
Then I need to call a function out of the class, but with following conditions:
1. It can be called only when mp3 file is already decoded and placed in mp3 folder.
2. It has parameter $filename, where the $filename is obviously the name of the file (like 'Beatles_-_Let_it_be.mp3')
If you have PHP code that needs to be executed after a completed conversion, then you need to put that code in ffmpeg_progress.php, inside the following existing condition:
PHP Code:
if (is_file(realpath(Config::_SONGFILEDIR . $mp3File)))
{
$conversionSuccess = 1;
}
If you are using another class, then you will have to instantiate it at the top of ffmpeg_progress.php. And if you need certain conversion data that you don't already have in ffmpeg_progress.php, then you will have to pass the data as additional parameters to the AJAX call in index.php.
DO NOT USE THE ZIP DISTRIBUTION LOCATED AT THE ABOVE LINKED PAGE. USE ONLY THE ZIP FILE ATTACHED TO THE BOTTOM OF THIS POST.
New in this release:
1) Fixed a bug in which errors could possibly occur when two users simultaneously convert the same YouTube video. This has been addressed with an additional constant "_ENABLE_CONCURRENCY_CONTROL" in the config class, which toggles this feature on and off. The only code to change is in YouTubeToMp3Converter.class.php and config.class.php.
I will soon be updating the paid-for version of the app as well, and I will email an updated (free) copy to all those who have already purchased the script. (Updates will be sent to your Tradebit email addresses only.)
As always, please let me know if you have any questions/concerns regarding the above and/or the code.
New problem. I think that if i download too many videos from youtube, it active a protect.
Sorry for the interruption. We have been receiving a large volume of requests from your network. To continue with your YouTube experience, please enter the verification code below
As promised, I have just finished updating the paid-for version of my software. New in this version:
1) Fixed a bug in which errors could possibly occur when two users simultaneously convert the same YouTube or Dailymotion video. This has been addressed with an additional constant "_ENABLE_CONCURRENCY_CONTROL" in the config class, which toggles this feature on and off. The code to change is in VideoConverter.class.php and config.class.php.
2) New concurrency control feature also prevents similar errors from occurring during ringtone creation
3) You can now prohibit conversions of videos that are longer than X number of seconds. This setting can be configured differently for each converted file type in the config class.
4) Expanded schedule.php (script that runs as daily task on server) so that it also deletes temporary video files and log files that were not automatically deleted due to conversion abandonment
All previous customers who have purchased the paid-for version of my app are receiving this new, updated version via the e-mail addresses that you provided at Tradebit.com.
Please report any issues with either the paid-for version or the free version in this forum thread.
New problem. I think that if i download too many videos from youtube, it active a protect.
Sorry for the interruption. We have been receiving a large volume of requests from your network. To continue with your YouTube experience, please enter the verification code below
This is the second time someone has reported this problem, and I'm now officially convinced that this is an issue worth addressing. I also have a good idea of how to fix this. So, the next time I release a new version of the software, you can expect that I will do exactly that.
In the meantime, how many requests to YouTube are you making to get that CAPTCHA? Thousands? Tens of thousands? More? And in what time frame? Per day? Per hour? Some other duration?
Per a previous, quick brainstorming session about this very issue, I came up with the following plan to combat this CAPTCHA:
Quote:
1) In YouTubeToMp3Converter:ownloadVideo, replace file_get_contents with cURL request to video URL (enable cookies/"keep-alive" for the curl session)
2) return HTML source of cURL request to PHP variable (DO NOT close cURL connection)
3) If captcha image is found in html source, continue to step #4. Otherwise stop and proceed with conversion script normally.
4) print and flush new markup to page that creates a modal window (on top of existing content) displaying captcha image ripped from HTMl in PHP variable. Include a text field in modal window for user to type captcha phrase. Include a submit button. When the submit button is pressed (input type = button), after user types code, have the button trigger some AJAx that sends the user's unique id and typed captcha phrase to PHP script on server. The PHP script receives this data and adds a node to an XML file on the server. Also, after button is pressed, a message displays inside modal window that says the form is processing and to please wait.
5) In the meantime, directly after the print and flush of markup at the begining of step #4, initiate a while loop that checks the XML file for the user's unique ID and captcha phrase. If a matching XML node is not found, the script sleeps for X number of seconds, and then tries again. This loop continues until the node is found or some arbitrary time limit is reached.
6) When and if the XML node is found, more markup is printed and flushed that removes the modal window. Using the original, open cURL handle, send a subsequent request to the page that the YouTube captcha form submits to, sending corresponding user provided captcha phrase found in XML as POST variable. Go to step #1.
7) If the XML node is not found after time limit expires, more markup is printed and flushed that removes the modal window. the original conversion form submits, and an error message tells user that he/she took too long to enter the captcha, and to please try the conversion again (and, that, of course, the conversion failed).
Again, this is a very rough approach to how I might handle the issue. You are free to try to implement this approach yourself, or implement some other approach, until I have a chance to address the issue in the next version of the app.
I try something interesting. I try get content of youtube page from other machine and correct function DownloadVideo($youTubeUrl) to:
$file_contents = file_get_contents("http://othersite/youtube.php?video=$youTubeUrl);
and get the content but the script don't work.
I try something interesting. I try get content of youtube page from other machine and correct function DownloadVideo($youTubeUrl) to:
$file_contents = file_get_contents("http://othersite/youtube.php?video=$youTubeUrl);
and get the content but the script don't work.
Any ideas ?
Because my script is running pattern matching that only matches the source of a YouTube.com page.
I have no idea what the source code of http://othersite/youtube.php is, but it clearly is different from the source of a regular YouTube.com video page.
Give me a valid URL to the page (http://othersite/youtube.php?video=h...?v=ccUskHHfJ9M) or paste the source code of that page here...Then i will tell you with certainty why you are having problems with that approach...