syncretic

PBSKids.org Downloader 0.1

Mar 10th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 4.04 KB | None | 0 0
  1. @ECHO off
  2.  
  3. ::Set your group name below:
  4. SET group=YourGroup
  5.  
  6. ECHO.
  7. ECHO Making sure there are no leftover temp files...
  8. ECHO.
  9.  
  10. DEL output.vtt
  11. DEL output.srt
  12. DEL output.ts
  13.  
  14. ECHO.
  15. ECHO If this is your first time using this script, please make sure streamlink is installed,
  16. ECHO and wget.exe, mkvmerge.exe and subtitleedit.exe are in the same directory as this batch file.
  17. ECHO.
  18.  
  19. SET /p m3u8=Playlist (m3u8) url:  
  20.  
  21. ECHO.
  22. ECHO Detecting max resolution . . .
  23.  
  24. IF "%m3u8%"=="%m3u8:1080p=%" (
  25.     SET res=720
  26. ) ELSE (
  27.     SET res=1080
  28. )
  29.  
  30. SET "m3u8=%m3u8:16x9-720p.m3u8=16x9-1080p.m3u8%"
  31. SET "m3u8=%m3u8:m1080-16x9-hls-400-2500k.m3u8=m1080-16x9-hls-6500k.m3u8%"
  32. SET "m3u8=%m3u8:m1080-16x9-hls-1200k.m3u8=m1080-16x9-hls-6500k.m3u8%"
  33. SET "m3u8=%m3u8:m1080-16x9-hls-2500k.m3u8=m1080-16x9-hls-6500k.m3u8%"
  34. SET "m3u8=%m3u8:720p-720p-3000k.m3u8=1080p.m3u8%"
  35. SET "m3u8=%m3u8:720p-540p-2000k.m3u8=1080p.m3u8%"
  36.  
  37. ECHO.
  38. ECHO %m3u8%
  39. ECHO.
  40.  
  41. IF "%m3u8%"=="%m3u8:16x9=%" (
  42.     SET aspect=4x3
  43. ) ELSE (
  44.     SET aspect=16x9
  45. )
  46.  
  47. IF "%aspect%"=="16x9" (
  48.     SET shortm3u8=%m3u8:*_=%
  49. ) ELSE (
  50.     SET shortm3u8=%m3u8:*4x3/=%
  51. )
  52.  
  53. ECHO shortened m3u8: %shortm3u8%
  54. ECHO.
  55.  
  56. SET season=%shortm3u8:~4,1%
  57. SET season=0%season%
  58. SET "season=%season:~-2%"
  59. SET epnum=%shortm3u8:~5,2%
  60. SET epnum=0%epnum%
  61. SET "epnum=%epnum:~-2%"
  62. SET ident=%shortm3u8:~0,7%
  63.  
  64. ECHO ident: %ident%
  65.  
  66. IF "%ident:~0,4%"=="arur" (SET series=Arthur)
  67. IF "%ident:~0,4%"=="bobl" (SET series=Bob.the.Builder)
  68. IF "%ident:~0,4%"=="caiu" (SET series=Caillu)
  69. IF "%ident:~0,4%"=="cith" (SET series=The.Cat.in.the.Hat.Knows.a.Lot.About.That)
  70. IF "%ident:~0,4%"=="cuge" (SET series=Curious.George)
  71. IF "%ident:~0,4%"=="cybr" (SET series=Cyberchase)
  72. IF "%ident:~0,4%"=="dins" (SET series=Dinosaur.Train)
  73. IF "%ident:~0,4%"=="dsna" (SET series=Design.Squad)
  74. IF "%ident:~0,4%"=="dtig" (SET series=Daniel.Tigers.Neighborhood)
  75. IF "%ident:~0,4%"=="elco" (SET series=The.Electric.Company)
  76. IF "%ident:~0,4%"=="mspe" (SET series=Martha.Speaks)
  77. IF "%ident:~0,4%"=="mstr" (SET series=Mister.Rogers)
  78. IF "%ident:~0,4%"=="ncat" (SET series=Nature.Cat)
  79. IF "%ident:~0,4%"=="odds" (SET series=Odd.Squad)
  80. IF "%ident:~0,4%"=="pcat" (SET series=Peg.plus.Cat)
  81. IF "%ident:~0,4%"=="pipe" (SET series=Pinkalicious.and.Peterrific)
  82. IF "%ident:~0,4%"=="rjgo" (SET series=Ready.Jet.Go)
  83. IF "%ident:~0,4%"=="sbub" (SET series=Splash.and.Bubbles)
  84. IF "%ident:~0,4%"=="sesa" (SET series=Sesame.Street)
  85. IF "%ident:~0,4%"=="sgir" (SET series=SciGirls)
  86. IF "%ident:~0,4%"=="sisk" (SET series=Sid.the.Science.Kid)
  87. IF "%ident:~0,4%"=="swhy" (SET series=Super.Why)
  88. IF "%ident:~0,4%"=="worg" (SET series=WordGirl)
  89. IF "%ident:~0,4%"=="wowo" (SET series=WordWorld)
  90.  
  91. ECHO.
  92. ECHO Max Resolution: %res%p
  93. ECHO.
  94. ECHO Aspect Ratio: %aspect%
  95. ECHO.
  96. ECHO Series Name: %series%
  97. ECHO.
  98. ECHO Season Number: %season%
  99. ECHO.
  100. ECHO Episode Number: %epnum%
  101. ECHO.
  102.  
  103. SET /p eptitle=Episode title:
  104. SET "eptitle=%eptitle: =.%"
  105.  
  106. SET /p subs=Subtitles (vtt) url (enter 0 for none):  
  107. ECHO.
  108. IF %subs%==0 (
  109.     GOTO :skipsubs
  110. ) ELSE (
  111.     ECHO Subtitles detected . . .
  112. )
  113. ECHO.
  114. ECHO Removing https from vtt url . . .
  115. ECHO.
  116. SET "subs=%subs:https=http%"
  117. ECHO Subtitles (vtt) url: %subs%
  118. ECHO.
  119. ECHO Downloading subtitles . . .
  120. ECHO.
  121. WGET "%subs%" -O output.vtt
  122. ECHO.
  123. ECHO Converting subtitles . . .
  124. ECHO.
  125. SUBTITLEEDIT /convert output.vtt srt
  126. :SKIPSUBS
  127. ECHO.
  128. ECHO.
  129. ECHO Downloading video and audio . . .
  130. ECHO.
  131. STREAMLINK %m3u8% best -o output.ts
  132. ECHO.
  133. IF %subs%==0 (
  134.     GOTO :MERGENOSUBS
  135. ) ELSE (
  136.     ECHO Merging files . . .
  137. )
  138. ECHO.
  139. MKVMERGE -o output.mkv --language 1:eng output.ts --default-track 0:0 --language 0:eng output.srt
  140. :FINISH
  141. IF "%m3u8%"=="%m3u8:1080p=%" (
  142.     SET res=720
  143. ) ELSE (
  144.     SET res=1080
  145. )
  146. REN output.mkv %series%.S%season%E%epnum%.%eptitle%.%res%p.PBSK.WEB-DL.AAC2.0.H.264-%group%.mkv
  147. ECHO.
  148. ECHO Continuing will delete temp files . . .
  149. ECHO.
  150. PAUSE
  151. DEL output.vtt
  152. DEL output.srt
  153. DEL output.ts
  154. EXIT /B
  155. :MERGENOSUBS
  156. ECHO.
  157. ECHO Merging files . . .
  158. ECHO.
  159. MKVMERGE -o output.mkv --language 1:eng output.ts
  160. GOTO :FINISH
Add Comment
Please, Sign In to add comment