Question

The old youtube-dl use to be just one file so it was easy for me to edit. The new version has multiple files inside of it. To get it to work on my server I needed to extract the files and change the python path. Now how do I put it back together? The youtube-dl site says make compile.

youtube-dl contains main.py, init.py, FileDownloader.py, InfoExtractors.py, PostProcessor.py, utils.py

I need to put those scripts back into a single youtube-dl file. I'm running CentOS.

Thanks for your help!

Was it helpful?

Solution

If all you want is to change the interpreter line (the hashbang), you should edit the file.

Since it's a binary file, you can't use a normal text editor. I'd recommend just editing it with a Python script:

with open('youtube-dl', 'rb') as f:
    header = f.readline()
    zipfile = f.read()

with open('youtube-dl-new', 'wb') as f:
    print >> f, '#!/your/new/hashbang/line'
    f.write(zipfile)

In Python 3:

with open('youtube-dl', 'rb') as f:
    header = f.readline()
    zipfile = f.read()

with open('youtube-dl-new', 'wb') as f:
    print('#!/your/new/hashbang/line', file=f)
    f.write(zipfile)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top