Advertisement
guitarplayer616

ytdl.lua

Sep 15th, 2022
919
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.65 KB | None | 0 0
  1. local address = ...
  2. local bitrate = 48
  3. local l_bitrate = bitrate
  4. local base_site = "http://dfpwm.catgirl.services"
  5. local base_bitrate = 48
  6. local base_conv_url = base_site .. "/aconv"
  7.  
  8. function getId(str)
  9.     local id, _a, _b
  10.     if string.find(str, "youtube.com") then
  11.         _a, _b, id = string.find(str, "v=([a-zA-Z0-9_-]+)")
  12.     elseif string.find(str, "youtu.be/") then
  13.         _a, _b, id = string.find(str, "be/([a-zA-Z0-9_-]+)")
  14.     else
  15.         id = str
  16.     end
  17.     return id
  18. end
  19.  
  20. function downloadAudio(id)
  21.     print("Downloading " .. id)
  22.     local url = base_conv_url .. (tostring(l_bitrate) or "") .. "/" .. id
  23.     return url
  24. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement