/
mycurl.php
692 lines (626 loc) · 24.8 KB
/
mycurl.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
<?php
/**
* Library for curl outside website. based on ???
*
* @uses wordpress core 3.0.x
* @category Options
* @package Options
* @subpackage Option
* @example
*
* @version 0.0.1 19desc2010
*
* @access public
* @todo test and perfecting operation save of html file
* @todo simplefied curl operation in home.php and transfer all of its
* messaging mechanism into this class
* @todo otomatic download --> make this class able to download file without user have to click the link and
* save it via browser. if possible, let's the class do it for yoou
* @todo if otomatic download berhasil maka tambahkan cronjob. kemampuan mengeksekusi cron
* sehingga bisa melakukan download sesuai interval yg telah ditentukan sebelumnya
* @todo tambahkan kemampuan mendownload video/ebook dari berbagai layanan website populer
* 1. youtube
* 2. youporn
* 3. kazeemovie
* 4. komik
* @todo hoto handle : "SSL certificate problem, verify that the CA cert is OK.
* Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed"
* @author uwiuw
* @copyright 2010 uwiuw
*/
class mycurl{
var $myurl;
var $token;
var $title = '<h1>My Curl Library</h1>';
var $message = array();
public function mycurl(){
$this->myurl = '';
}
public function set_title($title) {
$this->title = $title;
}
public function get_title() {
return $this->title;
}
/**
* set/adding messages
*
* @param <type> $message
* @param <type> $message_key
*/
public function set_AddMessage($message, $message_key) {
$message_arr = $this->get_messages();
$message_arr[$message_key] = $message;
$this->message = $message_arr;
}
public function get_messages() {
return $this->message;
}
/**
* set saving operation of a web page
*/
public function set_saveWebPage(){
if ($this->myurl != '') {
$ch = curl_init($this->myurl);
$fp = fopen("example_homepage.txt", "w");
$args = array (
CURLOPT_FILE => $fp,
CURLOPT_HEADER => 0,
);
curl_setopt($ch, $args, $fp);
curl_exec($ch);
curl_close($ch);
fclose($fp);
}
}
/**
* get the size of the page that curled
*
* @param <type> $url
* @return float ukuran content file
*/
public function get_webPageFileSize($url =''){
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);
$data = curl_exec($ch);
curl_close($ch);
if ($data === false)
return false;
if (preg_match('/Content-Length: (\d+)/', $data, $matches))
return (float) $matches[1];
}
function get_webPageFileSizeformat($size) {
if ($size != '') {
$units = array(' B', ' KB', ' MB', ' GB', ' TB');
for ($i = 0; $size >= 1024 && $i < 4; $i++) $size /= 1024;
return round($size, 2).$units[$i];
}
}
public function get_token($token) {
if (empty($token)) {
$token = $this->token;
} else {
$this->token = $token;
}
return rawurldecode ($token);
}
/**
* get list of urls from a webpage
*/
public function get_urlsFromHtml( $text ){
$match_elements = array( // HTML
array('element' => 'a', 'attribute' => 'href'), // 2.0
array('element' => 'a', 'attribute' => 'urn'), // 2.0
array('element' => 'base', 'attribute' => 'href'), // 2.0
array('element' => 'form', 'attribute' => 'action'), // 2.0
array('element' => 'img', 'attribute' => 'src'), // 2.0
array('element' => 'link', 'attribute' => 'href'), // 2.0
array('element' => 'applet', 'attribute' => 'code'), // 3.2
array('element' => 'applet', 'attribute' => 'codebase'), // 3.2
array('element' => 'area', 'attribute' => 'href'), // 3.2
array('element' => 'body', 'attribute' => 'background'), // 3.2
array('element' => 'img', 'attribute' => 'usemap'), // 3.2
array('element' => 'input', 'attribute' => 'src'), // 3.2
array('element' => 'applet', 'attribute' => 'archive'), // 4.01
array('element' => 'applet', 'attribute' => 'object'), // 4.01
array('element' => 'blockquote', 'attribute' => 'cite'), // 4.01
array('element' => 'del', 'attribute' => 'cite'), // 4.01
array('element' => 'frame', 'attribute' => 'longdesc'), // 4.01
array('element' => 'frame', 'attribute' => 'src'), // 4.01
array('element' => 'head', 'attribute' => 'profile'), // 4.01
array('element' => 'iframe', 'attribute' => 'longdesc'), // 4.01
array('element' => 'iframe', 'attribute' => 'src'), // 4.01
array('element' => 'img', 'attribute' => 'longdesc'), // 4.01
array('element' => 'input', 'attribute' => 'usemap'), // 4.01
array('element' => 'ins', 'attribute' => 'cite'), // 4.01
array('element' => 'object', 'attribute' => 'archive'), // 4.01
array('element' => 'object', 'attribute' => 'classid'), // 4.01
array('element' => 'object', 'attribute' => 'codebase'), // 4.01
array('element' => 'object', 'attribute' => 'data'), // 4.01
array('element' => 'object', 'attribute' => 'usemap'), // 4.01
array('element' => 'q', 'attribute' => 'cite'), // 4.01
array('element' => 'script', 'attribute' => 'src'), // 4.01
array('element' => 'audio', 'attribute' => 'src'), // 5.0
array('element' => 'command', 'attribute' => 'icon'), // 5.0
array('element' => 'embed', 'attribute' => 'src'), // 5.0
array('element' => 'event-source', 'attribute' => 'src'), // 5.0
array('element' => 'html', 'attribute' => 'manifest'), // 5.0
array('element' => 'source', 'attribute' => 'src'), // 5.0
array('element' => 'video', 'attribute' => 'src'), // 5.0
array('element' => 'video', 'attribute' => 'poster'), // 5.0
array('element' => 'bgsound', 'attribute' => 'src'), // Extension
array('element' => 'body', 'attribute' => 'credits'), // Extension
array('element' => 'body', 'attribute' => 'instructions'), //Extension
array('element' => 'body', 'attribute' => 'logo'), // Extension
array('element' => 'div', 'attribute' => 'href'), // Extension
array('element' => 'div', 'attribute' => 'src'), // Extension
array('element' => 'embed', 'attribute' => 'code'), // Extension
array('element' => 'embed', 'attribute' => 'pluginspage'), // Extension
array('element' => 'html', 'attribute' => 'background'), // Extension
array('element' => 'ilayer', 'attribute' => 'src'), // Extension
array('element' => 'img', 'attribute' => 'dynsrc'), // Extension
array('element' => 'img', 'attribute' => 'lowsrc'), // Extension
array('element' => 'input', 'attribute' => 'dynsrc'), // Extension
array('element' => 'input', 'attribute' => 'lowsrc'), // Extension
array('element' => 'table', 'attribute' => 'background'), // Extension
array('element' => 'td', 'attribute' => 'background'), // Extension
array('element' => 'th', 'attribute' => 'background'), // Extension
array('element' => 'layer', 'attribute' => 'src'), // Extension
array('element' => 'xml', 'attribute' => 'src'), // Extension
array('element' => 'button', 'attribute' => 'action'), // Forms 2.0
array('element' => 'datalist', 'attribute' => 'data'), // Forms 2.0
array('element' => 'form', 'attribute' => 'data'), // Forms 2.0
array('element' => 'input', 'attribute' => 'action'), // Forms 2.0
array('element' => 'select', 'attribute' => 'data'), // Forms 2.0
// XHTML
array('element' => 'html', 'attribute' => 'xmlns'),
// WML
array('element' => 'access', 'attribute' => 'path'), // 1.3
array('element' => 'card', 'attribute' => 'onenterforward'), // 1.3
array('element' => 'card', 'attribute' => 'onenterbackward'), // 1.3
array('element' => 'card', 'attribute' => 'ontimer'), // 1.3
array('element' => 'go', 'attribute' => 'href'), // 1.3
array('element' => 'option', 'attribute' => 'onpick'), // 1.3
array('element' => 'template', 'attribute' => 'onenterforward'), // 1.3
array('element' => 'template', 'attribute' => 'onenterbackward'), // 1.3
array('element' => 'template', 'attribute' => 'ontimer'), // 1.3
array('element' => 'wml', 'attribute' => 'xmlns'), // 2.0
);
$match_metas = array(
'content-base',
'content-location',
'referer',
'location',
'refresh',
);
/**
* Extract all elements
*/
if (!preg_match_all('/<([a-z][^>]*)>/iu', $text, $matches)) {
return array();
}
$elements = $matches[1];
$value_pattern = '=(("([^"]*)")|([^\s]*))';
// Match elements and attributes
foreach ($match_elements as $match_element) {
$name = $match_element['element'];
$attr = $match_element['attribute'];
$pattern = '/^' . $name . '\s.*' . $attr . $value_pattern . '/iu';
if ($name == 'object')
$split_pattern = '/\s*/u'; // Space-separated URL list
else if ($name == 'archive')
$split_pattern = '/,\s*/u'; // Comma-separated URL list
else
unset($split_pattern); // Single URL
foreach ($elements as $element) {
if (!preg_match($pattern, $element, $match))
continue;
$m = empty($match[3]) ? $match[4] : $match[3];
if (!isset($split_pattern))
$urls[$name][$attr][] = $m;
else {
$msplit = preg_split($split_pattern, $m);
foreach ($msplit as $ms)
$urls[$name][$attr][] = $ms;
}
}
}
/*
* Match meta http-equiv elements
*/
foreach ($match_metas as $match_meta) {
$attr_pattern = '/http-equiv="?' . $match_meta . '"?/iu';
$content_pattern = '/content' . $value_pattern . '/iu';
$refresh_pattern = '/\d*;\s*(url=)?(.*)$/iu';
foreach ($elements as $element) {
if (!preg_match('/^meta/iu', $element) ||
!preg_match($attr_pattern, $element) ||
!preg_match($content_pattern, $element, $match))
continue;
$m = empty($match[3]) ? $match[4] : $match[3];
if ($match_meta != 'refresh')
$urls['meta']['http-equiv'][] = $m;
else if (preg_match($refresh_pattern, $m, $match))
$urls['meta']['http-equiv'][] = $match[2];
}
}
/*
* Match style attributes
*/
$urls['style'] = array();
$style_pattern = '/style' . $value_pattern . '/iu';
foreach ($elements as $element) {
if (!preg_match($style_pattern, $element, $match))
continue;
$m = empty($match[3]) ? $match[4] : $match[3];
$style_urls = $this->get_urlsFromCss($m);
if (!empty($style_urls))
$urls['style'] = array_merge_recursive($urls['style'], $style_urls);
}
/*
* Match style bodies
*/
if (preg_match_all('/<style[^>]*>(.*?)<\/style>/siu', $text, $style_bodies)) {
foreach ($style_bodies[1] as $style_body) {
$style_urls = $this->get_urlsFromCss($style_body);
if (!empty($style_urls))
$urls['style'] = array_merge_recursive(
$urls['style'], $style_urls);
}
}
if (empty($urls['style']))
unset($urls['style']);
return $urls;
}
/**
* Extract URLs from CSS text.
*/
public function get_urlsFromCss($text) {
$urls = array();
$url_pattern = '(([^\\\\\'", \(\)]*(\\\\.)?)+)';
$urlfunc_pattern = 'url\(\s*[\'"]?' . $url_pattern . '[\'"]?\s*\)';
$pattern = '/(' .
'(@import\s*[\'"]' . $url_pattern . '[\'"])' .
'|(@import\s*' . $urlfunc_pattern . ')' .
'|(' . $urlfunc_pattern . ')' . ')/iu';
if (!preg_match_all($pattern, $text, $matches))
return $urls;
// @import '...'
// @import "..."
foreach ($matches[3] as $match)
if (!empty($match))
$urls['import'][] =
preg_replace('/\\\\(.)/u', '\\1', $match);
// @import url(...)
// @import url('...')
// @import url("...")
foreach ($matches[7] as $match)
if (!empty($match))
$urls['import'][] =
preg_replace('/\\\\(.)/u', '\\1', $match);
// url(...)
// url('...')
// url("...")
foreach ($matches[11] as $match)
if (!empty($match))
$urls['property'][] =
preg_replace('/\\\\(.)/u', '\\1', $match);
return $urls;
}
/**
* Get a web file (HTML, XHTML, XML, image, etc.) from a URL. Return an
* array containing the HTTP server response header fields and content.
* @return boolean
*/
function get_webPage($url ='') {
if (!empty($this->myurl) || !empty($url)) {
if (!$url) {
$url = $this->myurl;
}
$options = array(
CURLOPT_RETURNTRANSFER => true, // return web page
CURLOPT_HEADER => false, // don't return headers
CURLOPT_FOLLOWLOCATION => true, // follow redirects
CURLOPT_ENCODING => "", // handle all encodings
CURLOPT_USERAGENT => "spider", // who am i
CURLOPT_AUTOREFERER => true, // set referer on redirect
CURLOPT_CONNECTTIMEOUT => 120, // timeout on connect
CURLOPT_TIMEOUT => 120, // timeout on response
CURLOPT_MAXREDIRS => 10, // stop after 10 redirects
);
$ch = curl_init($url);
curl_setopt_array($ch, $options);
$content = curl_exec($ch);
$err = curl_errno($ch);
$errmsg = curl_error($ch);
$header = curl_getinfo($ch);
curl_close($ch);
$header['errno'] = $err;
$header['errmsg'] = $errmsg;
$header['content'] = $content;
/**
* Error Checking
*/
if ( $header['errno'] != 0 ) {
$error[] = 'error: bad url, timeout, redirect loop';
$message_key = "error err_$err";
$this->set_AddMessage($errmsg, $message_key);
}
if ( $header['http_code'] != 200 ) {
$message = 'http_code error. no page, no permissions, no service';
$error[] = $message;
$message_key = 'error err_200';
$this->set_AddMessage($message, $message_key);
}
if (isset($error)) {
$error['error'] = TRUE;
return $error;
}
return $header;
}
}
/**
* get the key of content of the array that came from curl output
* @return <type>
*/
public function get_webPageContent(){
$result = $this->get_webPage();
if (!isset($result['error'])) {
return $result['content'];
}
}
/**
* get external class and do the operation here
*
* @param <type> $object
* @return mixed the class can return anything that external class object will return
*/
public function get_externalclass($external_object){
if (is_object($external_object)) {
if (property_exists($external_object, 'title')) {
$this->set_title($this->get_title() . $external_object->title);
}
if (method_exists($external_object, 'do_inject')) {
return $external_object->do_inject();
} else {
$message = get_class($external_object) . ' class object has no "do_inject" method. This method is
the brigde to communicate with mycurl class';
$message_key = 'error err_112';
$this->set_AddMessage($message, $message_key);
return false;
}
} else {
$message = 'The object is not an instance of a class.';
$message_key = 'error err_111';
$this->set_AddMessage($message, $message_key);
return false;
}
}
}
/**
* special method that going to use in my_curl->get_externalclass()
* build for getting the url of keezmovies.com file. After click them, the file will
* get downloaded
* @example
$keezmovies = new keezmovies();
$keezmovies->output = $output;
$url = $mycurl->get_externalclass($keezmovies);
* @properties $output html putput came form main class.
*/
class keezmovies{
public $output = '';
public $title = '<h3>Keezmovies Downloads Url by @uwiuw</h3>';
public function do_inject(){
if ($output = $this->output) {
$output = strip_tags($output);
$output = explode('flashvars.video_url = ', $output);
$output = explode(';', $output[1]);
$output = explode("'", $output[0]);
$url = rawurldecode ($output[1]);
return $url;
}
}
}
/**
* @todo Lists of todo
* 4. memiliki nama-nama properties yg mirip dengan mycurl
* 5. Kemampuan mendownload lebih dari satu video persekali klik submit button
* inspired by http://vipld.com/how-to-download-video-from-youtube-using-php/
*/
class youtube {
public $output = '';
public $video_url = '';
public $title = '<h3>Youtube Downloads by @uwiuw</h3>';
/**
* get the url of flv file
*
* @param <type> $data
* @return string url of the flv file
*/
function get_flv($data)
{
//After &fmt_url_map=
//Before &
//Split by %2C
//Select first
//After %7C
if(eregi('fmt_url_map',$data))
{
$data = end(split('&fmt_url_map=',$data));
$data = current(split('&',$data));
$split = explode('%2C',$data);
$data = $split[0];
$data = end(split('%7C',$data));
return(urldecode($data));
}else{
if(eregi('verify-age-details',$data))
{
echo 'Age verification needed<br>';
}
return(false);
}
}
/**
* get the html output by mimicing http request of browser
*/
function get_html($url)
{
$ch = curl_init();
$header[0] = "Accept: text/xml,application/xml,application/xhtml+xml,";
$header[0] .= "text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5";
$header[] = "Cache-Control: max-age=0";
$header[] = "Connection: keep-alive";
$header[] = "Keep-Alive: 300";
$header[] = "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7";
$header[] = "Accept-Language: en-us,en;q=0.5";
$header[] = "Pragma: "; //browsers keep this blank.
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows;U;Windows NT 5.0;en-US;rv:1.4) Gecko/20030624 Netscape/7.1 (ax)');
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_REFERER, "http://www.youtube.com/");
curl_setopt($ch, CURLOPT_ENCODING, 'gzip,deflate');
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_COOKIEFILE, COOKIE);
curl_setopt($ch, CURLOPT_COOKIEJAR, COOKIE);
$result = curl_exec ($ch);
if (!$result)
{
echo "cURL error number:" .curl_errno($ch);
echo "cURL error:" . curl_error($ch);
exit;
}
curl_close ($ch);
return($result);
}
/**
* download the file
*
* @param <type> $url
* @param <type> $filename
* @return <type>
*/
function get_file($url, $filename)
{
$file = fopen($filename, 'wb');
$ch = curl_init();
curl_setopt($ch, CURLOPT_FILE, $file);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_COOKIEFILE, COOKIE);
curl_setopt($ch, CURLOPT_COOKIEJAR, COOKIE);
curl_exec($ch);
curl_close($ch);
fclose($file);
return(true);
}
function get_playlist($url)
{
$data = get_html($url);
$data = end(split('FULL_SEQUENTIAL_VIDEO_LIST',$data));
$data = current(split('FULL_SHUFFLED_VIDEO_LIST',$data));
$data = substr(ereg_replace('[^-_a-zA-Z,"0-9]', '', $data),0,-1);
eval('$tracks = array('.$data.');');
return($tracks);
}
/***
* get list of youtube url and then download it
*
* @todo buat kemampaun method bisa mereturn value url yg berasal dari kumpulan array
* coba periksa cara penggunaannya pada class ini
*/
function download_playlist($tracks)
{
foreach($tracks as $id)
{
if (!is_integer($id)) {
continue;
}
$data = get_html('http://youtube.com/watch?v='.$id);
if ($data != '') {
$this->download_track($data);
}
}
}
/**
* get the file url and then download it
*
* @todo buat class ini bisa mengkomunikasikan pesan error yg terjadi
* dengan form yg ada di home.php. Saat ini internal error cuma
* bisa di-echo. Tapi tidak bisa dibypass ke class mycurl
* dan dioutput dengan benar pada form html yg ada pada home.php
*
* @param <type> $data
* @return <type>
*/
function download_track($data)
{
$name = end(split('eow-title',$data));
$name = current(split('">',$name));
$name = ereg_replace('[^-_a-zA-Z,"\' :0-9]',"",end(split('title="',$name)));
$name = ereg_replace(' ','_',$name);
$filename = getcwd() . '\\' . $name.'.flv';
if(!file_exists($filename))
{
echo 'Downloading : '. $filename;
$flv = $this->get_flv($data);
if($flv)
{
flush();
if($this->get_file($flv, $filename))
{
echo 'Done<br> the file is ' . $filename;
}
flush();
}
} else {
echo "$filename is exist";
}
return $this->video_url;
}
/**
* method for bridging with other class (in this context, it would be myclass)
*
* @todo testing how the brigde works
* @return string url file
*/
public function do_inject(){
if ($output = $this->output) {
ini_set('max_execution_time', 0);
return $this->download_track($output);
}
}
/**
* do the basic operation
*
* @param <type> $url
* @return mixed string of url of false
*/
function init($url) {
/**
* make the download have no script time limitation. it will excecuted forever
* if they have to
*/
ini_set('max_execution_time',0);
$vars = end(explode('?',$url));
$pairs = explode('&',$vars);
foreach($pairs as $pair)
{
$var = explode('=',$pair);
$data[$var[0]] = $var[1];
}
if($data['v']>0)
{
$this->download_playlist(get_playlist($url));
return $url;
}else{
$this->video_url = 'http://youtube.com/watch?v='.$data['v'];
$this->download_track($this->get_html($this->video_url));
return $this->video_url;
}
}
}