/
frmYouTube.rbfrm
1841 lines (1584 loc) · 49.4 KB
/
frmYouTube.rbfrm
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
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#tag Window
Begin Window frmYouTube
BackColor = 16777215
Backdrop = ""
CloseButton = True
Composite = True
Frame = 1
FullScreen = False
HasBackColor = False
Height = 1.68e+2
ImplicitInstance= True
LiveResize = False
MacProcID = 0
MaxHeight = 32000
MaximizeButton = False
MaxWidth = 32000
MenuBar = ""
MenuBarVisible = True
MinHeight = 64
MinimizeButton = False
MinWidth = 64
Placement = 3
Resizeable = False
Title = "YouTube Downloader - Internet Video Downloader"
Visible = True
Width = 6.03e+2
Begin TextField txtIn
AcceptTabs = ""
Alignment = 0
AutoDeactivate = True
AutomaticallyCheckSpelling= False
BackColor = 16777215
Bold = ""
Border = True
CueText = ""
DataField = ""
DataSource = ""
Enabled = True
Format = ""
Height = 22
HelpTag = ""
Index = -2147483648
InitialParent = ""
Italic = ""
Left = 233
LimitText = 0
LockBottom = ""
LockedInPosition= False
LockLeft = ""
LockRight = ""
LockTop = ""
Mask = ""
Password = ""
ReadOnly = ""
Scope = 0
TabIndex = 0
TabPanelIndex = 0
TabStop = True
Text = ""
TextColor = 0
TextFont = "System"
TextSize = 0
TextUnit = 0
Top = 20
Underline = ""
UseFocusRing = True
Visible = True
Width = 350
End
Begin HTTPSocket HTTP
Address = ""
Height = 32
Index = -2147483648
Left = -40
LockedInPosition= False
Port = 0
Scope = 0
TabPanelIndex = 0
Top = 85
Width = 32
yield = 0
End
Begin ProgressBar bar
AutoDeactivate = True
Enabled = True
Height = 20
HelpTag = ""
Index = -2147483648
InitialParent = ""
Left = 163
LockBottom = ""
LockedInPosition= False
LockLeft = ""
LockRight = ""
LockTop = ""
Maximum = 100
Scope = 0
TabPanelIndex = 0
Top = 89
Value = 0
Visible = True
Width = 420
End
Begin PushButton btnDownOld
AutoDeactivate = True
Bold = True
ButtonStyle = 0
Cancel = False
Caption = "Download"
Default = True
Enabled = True
Height = 28
HelpTag = "Download the selected clip now."
Index = -2147483648
InitialParent = ""
Italic = ""
Left = 163
LockBottom = ""
LockedInPosition= False
LockLeft = ""
LockRight = ""
LockTop = ""
Scope = 0
TabIndex = 2
TabPanelIndex = 0
TabStop = True
TextFont = "System"
TextSize = 0
TextUnit = 0
Top = 180
Underline = ""
Visible = False
Width = 179
End
Begin PushButton btnBrowseOld
AutoDeactivate = True
Bold = ""
ButtonStyle = 0
Cancel = ""
Caption = "..."
Default = ""
Enabled = True
Height = 25
HelpTag = ""
Index = -2147483648
InitialParent = ""
Italic = ""
Left = 622
LockBottom = ""
LockedInPosition= False
LockLeft = ""
LockRight = ""
LockTop = ""
Scope = 0
TabIndex = 3
TabPanelIndex = 0
TabStop = True
TextFont = "System"
TextSize = 0
TextUnit = 0
Top = 45
Underline = ""
Visible = False
Width = 44
End
Begin Label quote
AutoDeactivate = True
Bold = False
DataField = ""
DataSource = ""
Enabled = True
Height = 20
HelpTag = ""
Index = -2147483648
InitialParent = ""
Italic = False
Left = -40
LockBottom = False
LockedInPosition= False
LockLeft = False
LockRight = False
LockTop = False
Multiline = False
Scope = 0
Selectable = False
TabIndex = 4
TabPanelIndex = 0
Text = """"
TextAlign = 0
TextColor = 0
TextFont = "System"
TextSize = 12
TextUnit = 0
Top = 148
Transparent = False
Underline = False
Visible = False
Width = 12
End
Begin Label StaticText1
AutoDeactivate = True
Bold = ""
DataField = ""
DataSource = ""
Enabled = True
Height = 20
HelpTag = ""
Index = -2147483648
InitialParent = ""
Italic = ""
Left = 163
LockBottom = ""
LockedInPosition= False
LockLeft = ""
LockRight = ""
LockTop = ""
Multiline = ""
Scope = 0
Selectable = False
TabIndex = 9
TabPanelIndex = 0
Text = "URL:"
TextAlign = 0
TextColor = 0
TextFont = "System"
TextSize = 0
TextUnit = 0
Top = 22
Transparent = False
Underline = ""
Visible = True
Width = 48
End
Begin Label StaticText2
AutoDeactivate = True
Bold = ""
DataField = ""
DataSource = ""
Enabled = True
Height = 20
HelpTag = ""
Index = -2147483648
InitialParent = ""
Italic = ""
Left = 163
LockBottom = ""
LockedInPosition= False
LockLeft = ""
LockRight = ""
LockTop = ""
Multiline = ""
Scope = 0
Selectable = False
TabIndex = 10
TabPanelIndex = 0
Text = "Save to:"
TextAlign = 0
TextColor = 0
TextFont = "System"
TextSize = 0
TextUnit = 0
Top = 54
Transparent = False
Underline = ""
Visible = True
Width = 59
End
Begin PopupMenu popQ
AutoDeactivate = True
Bold = ""
DataField = ""
DataSource = ""
Enabled = True
Height = 27
HelpTag = "Select in what quality you want the YouTube clip to be donwloaded."
Index = -2147483648
InitialParent = ""
InitialValue = "Worst\nMedium\nBest"
Italic = ""
Left = 233
ListIndex = 0
LockBottom = ""
LockedInPosition= False
LockLeft = True
LockRight = ""
LockTop = True
Scope = 0
TabIndex = 14
TabPanelIndex = 0
TabStop = True
TextFont = "System"
TextSize = 0
TextUnit = 0
Top = 231
Underline = ""
Visible = True
Width = 109
End
Begin Canvas cnvThumb
AcceptFocus = ""
AcceptTabs = ""
AutoDeactivate = True
Backdrop = ""
DoubleBuffer = False
Enabled = True
EraseBackground = True
Height = 128
HelpTag = ""
Index = -2147483648
InitialParent = ""
Left = 23
LockBottom = ""
LockedInPosition= False
LockLeft = 64
LockRight = ""
LockTop = True
Scope = 0
TabIndex = 15
TabPanelIndex = 0
TabStop = True
Top = 20
UseFocusRing = True
Visible = True
Width = 128
Begin Canvas cnvProgress
AcceptFocus = ""
AcceptTabs = ""
AutoDeactivate = True
Backdrop = 341889023
DoubleBuffer = False
Enabled = True
EraseBackground = True
Height = 108
HelpTag = ""
Index = -2147483648
InitialParent = "cnvThumb"
Left = 37
LockBottom = ""
LockedInPosition= False
LockLeft = True
LockRight = ""
LockTop = True
Scope = 0
TabIndex = 0
TabPanelIndex = 0
TabStop = True
Top = 34
UseFocusRing = True
Visible = False
Width = 100
End
Begin Label lblProgress
AutoDeactivate = True
Bold = ""
DataField = ""
DataSource = ""
Enabled = True
Height = 100
HelpTag = ""
Index = -2147483648
InitialParent = "cnvThumb"
Italic = ""
Left = 52
LockBottom = ""
LockedInPosition= False
LockLeft = True
LockRight = ""
LockTop = True
Multiline = ""
Scope = 0
Selectable = False
TabIndex = 1
TabPanelIndex = 0
Text = "0%"
TextAlign = 1
TextColor = &hFFFFFF
TextFont = "System"
TextSize = 18
TextUnit = 0
Top = 36
Transparent = True
Underline = ""
Visible = False
Width = 72
End
End
Begin HTTPSocket httpThumb
Address = ""
Height = 32
Index = -2147483648
Left = -40
LockedInPosition= False
Port = 0
Scope = 0
TabPanelIndex = 0
Top = 10
Width = 32
yield = 0
End
Begin Label StaticText3
AutoDeactivate = True
Bold = ""
DataField = ""
DataSource = ""
Enabled = True
Height = 20
HelpTag = ""
Index = -2147483648
InitialParent = ""
Italic = ""
Left = 163
LockBottom = ""
LockedInPosition= False
LockLeft = ""
LockRight = ""
LockTop = ""
Multiline = ""
Scope = 0
Selectable = False
TabIndex = 16
TabPanelIndex = 0
Text = "Quality:"
TextAlign = 0
TextColor = 0
TextFont = "System"
TextSize = 0
TextUnit = 0
Top = 238
Transparent = False
Underline = ""
Visible = True
Width = 59
End
Begin ProgressWheel Wheel
AutoDeactivate = True
Enabled = True
Height = 16
HelpTag = ""
Index = -2147483648
InitialParent = ""
Left = -40
LockBottom = ""
LockedInPosition= False
LockLeft = False
LockRight = ""
LockTop = False
Scope = 0
TabIndex = 17
TabPanelIndex = 0
TabStop = True
Top = 54
Visible = False
Width = 16
End
Begin PushButton btnAddOld
AutoDeactivate = True
Bold = False
ButtonStyle = 0
Cancel = ""
Caption = "Add to queue"
Default = ""
Enabled = True
Height = 28
HelpTag = "Add the YouTube URL to the input file list so you can download and convert many clips at once."
Index = -2147483648
InitialParent = ""
Italic = ""
Left = 354
LockBottom = ""
LockedInPosition= False
LockLeft = ""
LockRight = ""
LockTop = ""
Scope = 0
TabIndex = 19
TabPanelIndex = 0
TabStop = True
TextFont = "System"
TextSize = 0
TextUnit = 0
Top = 180
Underline = ""
Visible = False
Width = 117
End
Begin PushButton btnCloseOld
AutoDeactivate = True
Bold = False
ButtonStyle = 0
Cancel = ""
Caption = "Close"
Default = ""
Enabled = True
Height = 28
HelpTag = "Cancel all downloads and close the window."
Index = -2147483648
InitialParent = ""
Italic = ""
Left = 477
LockBottom = ""
LockedInPosition= False
LockLeft = ""
LockRight = ""
LockTop = ""
Scope = 0
TabIndex = 20
TabPanelIndex = 0
TabStop = True
TextFont = "System"
TextSize = 0
TextUnit = 0
Top = 180
Underline = ""
Visible = False
Width = 79
End
Begin ComboBox txtOut
AutoComplete = False
AutoDeactivate = True
Bold = ""
DataField = ""
DataSource = ""
Enabled = True
Height = 25
HelpTag = ""
Index = -2147483648
InitialValue = ""
Italic = ""
Left = 233
ListIndex = 0
LockBottom = ""
LockedInPosition= False
LockLeft = True
LockRight = ""
LockTop = True
Scope = 0
TabIndex = 21
TabPanelIndex = 0
TabStop = True
TextFont = "System"
TextSize = 0
TextUnit = 0
Top = 50
Underline = ""
UseFocusRing = True
Visible = True
Width = 294
End
Begin Timer UnityProgress
Height = 32
Index = -2147483648
Left = -40
LockedInPosition= False
Mode = 0
Period = 500
Scope = 0
TabPanelIndex = 0
Top = 187
Width = 32
End
Begin Timer tPlaylist
Height = 32
Index = -2147483648
Left = -40
LockedInPosition= False
Mode = 0
Period = 3000
Scope = 0
TabPanelIndex = 0
Top = 290
Width = 32
End
Begin HTTPSocket HTTPlaylist
Address = ""
Height = 32
Index = -2147483648
Left = 0
LockedInPosition= False
Port = 0
Scope = 0
TabPanelIndex = 0
Top = 290
Width = 32
yield = 0
End
Begin Shell shell_youtube_dl
Arguments = ""
Backend = ""
Height = 32
Index = -2147483648
Left = 176
LockedInPosition= False
Mode = 1
Scope = 0
TabPanelIndex = 0
TimeOut = 6000
Top = 290
Width = 32
End
Begin PSButton btnAdd
AcceptFocus = ""
AcceptTabs = ""
AutoDeactivate = True
Backdrop = ""
ButtonStyle = 0
Caption = "Add to queue"
DoubleBuffer = False
Enabled = True
EraseBackground = True
Height = 19
HelpTag = ""
Icon = 8511487
Index = -2147483648
InitialParent = ""
Left = 354
LockBottom = True
LockedInPosition= False
LockLeft = False
LockRight = True
LockTop = False
Scope = 0
TabIndex = 22
TabPanelIndex = 0
TabStop = True
Top = 129
UseFocusRing = True
Visible = True
Width = 144
End
Begin PSButton btnClose
AcceptFocus = ""
AcceptTabs = ""
AutoDeactivate = True
Backdrop = ""
ButtonStyle = 0
Caption = "Close"
DoubleBuffer = False
Enabled = True
EraseBackground = True
Height = 19
HelpTag = ""
Icon = 1793927167
Index = -2147483648
InitialParent = ""
Left = 504
LockBottom = True
LockedInPosition= False
LockLeft = False
LockRight = True
LockTop = False
Scope = 0
TabIndex = 23
TabPanelIndex = 0
TabStop = True
Top = 129
UseFocusRing = True
Visible = True
Width = 79
End
Begin PSButton btnDown
AcceptFocus = ""
AcceptTabs = ""
AutoDeactivate = True
Backdrop = ""
ButtonStyle = 0
Caption = "Download"
DoubleBuffer = False
Enabled = True
EraseBackground = True
Height = 19
HelpTag = ""
Icon = 1141452799
Index = -2147483648
InitialParent = ""
Left = 163
LockBottom = True
LockedInPosition= False
LockLeft = True
LockRight = True
LockTop = False
Scope = 0
TabIndex = 24
TabPanelIndex = 0
TabStop = True
Top = 129
UseFocusRing = True
Visible = True
Width = 179
End
Begin PSButton btnBrowse
AcceptFocus = ""
AcceptTabs = ""
AutoDeactivate = True
Backdrop = ""
ButtonStyle = 0
Caption = "..."
DoubleBuffer = False
Enabled = True
EraseBackground = True
Height = 19
HelpTag = ""
Icon = ""
Index = -2147483648
InitialParent = ""
Left = 539
LockBottom = True
LockedInPosition= False
LockLeft = False
LockRight = True
LockTop = False
Scope = 0
TabIndex = 25
TabPanelIndex = 0
TabStop = True
Top = 53
UseFocusRing = True
Visible = True
Width = 44
End
End
#tag EndWindow
#tag WindowCode
#tag Event
Sub Close()
if (Window1.YouTubeQ = false) then // downloader does not works in a queue mode
Window1.saveConfig ( Window1.configFile, "youtubeQuality", cstr( popQ.ListIndex ) )
end if
// Stop the Ubuntu Unity script
Window1.UnityProgressEnd
End Sub
#tag EndEvent
#tag Event
Sub Open()
// set the wheel location
Wheel.top = cnvThumb.Top + (cnvThumb.Height-Wheel.Height)/2
Wheel.Left = cnvThumb.Left + (cnvThumb.Width-Wheel.Width)/2
cnvThumb.Refresh
if (Window1.YouTubeQ = false) then // downloader does not work in a queue mode
// enable the auto-paste
Dim c as New Clipboard
dim sURL as String
If (c.TextAvailable=true) then
if (inStr(0,c.Text,"www.youtube.com") <> 0) then
txtIn.Text = c.Text
end if
End if
c.close
// add available choices in txtOut combo based on OS
txtOut.AddRow "Desktop"
txtOut.AddRow "User's Home Folder"
if (TargetWin32 = True) then
txtOut.AddRow "Documents"
txtOut.AddRow "Music"
end if
txtOut.AddRow "Temporary Folder"
// load the last used quality
dim sQuality as String
sQuality = Window1.loadConfig(Window1.configFile, "youtubeQuality")
if (sQuality <> "" ) then
popQ.ListIndex = val( sQuality )
end if
// load the last used output folder
dim sOutput as String
sOutput = Window1.loadConfig(Window1.configFile, "youtubeOutput")
if (sOutput <> "") then txtOut.Text = sOutput else txtOut.ListIndex = 0
else
end if
End Sub
#tag EndEvent
#tag MenuHandler
Function Untitled() As Boolean Handles Untitled.Action
Return True
End Function
#tag EndMenuHandler
#tag Method, Flags = &h0
Sub addPlaylistToQ()
// ------------------------------- local file validation ------------------------------
if (txtOut.Text = "") then
msgbox "Please select a location to save the YouTube video."
Return
end if
dim q as string
q = quote.Text
// ------------------------- download process -----------------------------------
// URL.ex. http://www.youtube.com/watch?v=nw0fYdy7kBk
vVar = getVvar ( txtin.Text) // find v Variable in URL
if (vVar = "-1") then
msgbox "Please insert a valid YouTube URL."
return
else
HTTPlaylist.Get txtIn.Text
end if
End Sub
#tag EndMethod
#tag Method, Flags = &h0
Sub addSingleToQ()
// ------------------------------- local file validation ------------------------------
if (txtOut.Text = "") then
msgbox "Please select a location to save the YouTube video."
Return
end if
dim q as string
q = quote.Text
// ------------------------- download process -----------------------------------
// URL.ex. http://www.youtube.com/watch?v=nw0fYdy7kBk
'vVar = getVvar ( txtin.Text) // find v Variable in URL
'if (vVar = "-1") then
'msgbox "Please insert a valid YouTube URL."
'else
if ( txtIn.Text = "") then
MsgBox "Please enter a video url."
else
// do not add a null image in the thumbnail array
if (thumb = nil) then
thumb = picUnknown
end if
// update the thumbnail array
if (Window1.scrs.Ubound = Window1.lstIn.ListCount-1) then
Window1.scrs.Append thumb
else
Window1.scrs(Window1.lstIn.ListCount) = thumb
end if
// add to the list
if (sTitle = "") then
Window1.lstIn.AddRow ("Download " + q + txtIn.Text + q)
else
Window1.lstIn.AddRow ("Download " + q + sTitle + q)
end if
// set output dir
if (Window1.txtOut.Text = "") then Window1.txtOut.Text = Window1.lastOutputFolder
// display the drop box
Window1.dropBox()
Window1.lstIn.cell (window1.lstIn.LastIndex, 1) = "Download :: " + txtIn.Text + " :: " + txtOut.Text + " :: " + cstr(popQ.ListIndex)
frmYouTube.Close
end if
End Sub
#tag EndMethod
#tag Method, Flags = &h0
Sub disableAll()
// disable all the controls of the window
txtout.Enabled=false
txtin.Enabled=false
btnDown.Enabled=false
btnBrowse.Enabled=false
btnAdd.Enabled = False
popQ.Enabled = false
bar.Maximum = 100
End Sub
#tag EndMethod
#tag Method, Flags = &h0
Function filenameReady(sTitle as string) As String
// for removing any character not allowed in file names
dim q as String
q = quote.Text
sTitle = ReplaceAll(sTitle, "|", "-")
sTitle = ReplaceAll(sTitle, "+", " ")
sTitle = ReplaceAll(sTitle, "/", "-")
sTitle = ReplaceAll(sTitle, "\", "-")
sTitle = ReplaceAll(sTitle, "?", ".")
sTitle = ReplaceAll(sTitle, "%", ".")
sTitle = ReplaceAll(sTitle, "*", ".")
sTitle = ReplaceAll(sTitle, ":", ".")
sTitle = ReplaceAll(sTitle, "!", ".")
sTitle = ReplaceAll(sTitle, q, ".")
sTitle = ReplaceAll(sTitle, ">", ".")
sTitle = ReplaceAll(sTitle, "<", ".")
sTitle = trim(sTitle) // removes lead and tail white spaces
Return sTitle
End Function
#tag EndMethod
#tag Method, Flags = &h0
Function findExtByItag(itag as integer) As string
// get the itag YouTube code and return the extention
// ref. http://en.wikipedia.org/wiki/YouTube#Quality_and_codecs
dim ext as String
ext = ".flv" // default extention
select case itag
case 5,6,34,35,120
ext = ".flv"
case 13,17,36
ext = ".3gp"
case 18,22,37,38,82,83,84,85
ext = ".mp4"
case 43,44,45,46,100,101,102
ext = ".webm"
end select
// MsgBox (cstr(itag) + EndOfLine + ext)
return ext
End Function
#tag EndMethod
#tag Method, Flags = &h0
Function findExtByUrl(url as string) As String
// try to find the extension from the url
dim temp(),temp2 as String
temp = url.split("?")
if (temp.Ubound <> 0) then
temp2 = temp(0)
else
temp2 = url
end if
// MsgBox "temp2 "+temp2
temp = temp2.Split(".")
if (temp.Ubound <> 0) then
dim ext as String
ext = temp( temp.Ubound )
// MsgBox "ext "+ext
if ( (len(ext) = 3) or (len(ext) = 4) ) then
return "."+ext
else
return ".mp4"
end if
else
Return ".mp4"
end if
End Function
#tag EndMethod
#tag Method, Flags = &h0
Function getField(content as string, key as string) As string
// <-----> Get the Value of the Key from a getInfo page of YoutTube
dim iSt, iEn, i as Integer
dim res as string
iSt = inStr(content,key)
if (iSt <> 0) then