Advertisement
syncretic

PBSKids.org Downloader 0.2

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