0

i've some python code to convert audio/video like this :

import os

import json



def extract_format_data(format_data:)

extension = format_data["ext"]

format_name = format_data["format"]

url = format_data["url"]

return { "extension": extension, "format_name": format_name,"url": url }



def extract_video_data_from_url(url:)

command = f'youtube-dl "{url}" -j'

output = os.popen(command.read())

video_data = json.loads(output)

title = video_data["title"]

formats = video_data["formats"]

thumbnail = video_data["thumbnail"]

formats = [extract_format_data(format_data for format_data in formats])

return {"title": title, "formats": formats, "thumbnail": thumbnail }

as you can see, i've put youtube-dl in my code with "IMPORT OS" at the top.

i don't really now how come the code is running without put "IMPORT YOUTUBE-DL" at the top.

but my question is, is it possible if the whole code i've been created to put in hosting without "IMPORT YOUTUBE-DL"? or just put "IMPORT OS"?

thanks!

warstha
  • 13
  • 5
  • I think that would depend on what kind of Hosting service you're using. If you're using a Managed server, then running `youtube-dl` as a binary executable that you run using `os.system` or `os.popen` is probably fine, but different hosting services have different rules and limitations. – JohnAlexINL Oct 03 '22 at 13:32

0 Answers0