Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to save video link in variable ? #23725

Closed
superuser789 opened this issue Jan 13, 2020 · 1 comment
Closed

How to save video link in variable ? #23725

superuser789 opened this issue Jan 13, 2020 · 1 comment
Labels

Comments

@superuser789
Copy link

@superuser789 superuser789 commented Jan 13, 2020

Checklist

  • I'm asking a question
  • I've looked through the README and FAQ for similar questions
  • I've searched the bugtracker for similar questions including closed ones

Question

I am using youtube-dl python library. I want to get the direct link of desired quality of youtube video. I am using the following code which gets the direct links but prints them to stdout. I want to save it in a variable and use them to process further by ffmpeg.

from __future__ import unicode_literals
import youtube_dl

LINK='https://www.youtube.com/watch?v=9bZkp7q19f0'

class MyLogger(object):
    def debug(self, msg):
        msg=[]
        print('=====================')
        print(msg)

    def warning(self, msg):
        pass
    def error(self, msg):
        pass    
       
ydl_opts = {
    'format': 'bestvideo[height<=?720][fps<=?60][vcodec!=?vp9]+bestaudio/best',  
    'forceurl': True, 
     'quiet' : True,
     'skip_download' : True,
    'logger': MyLogger(),
    }


with youtube_dl.YoutubeDL(ydl_opts) as ydl:
    ydl.download([LINK])
@dstftw
Copy link
Collaborator

@dstftw dstftw commented Jan 13, 2020

extract_info.

@dstftw dstftw closed this Jan 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.