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

[Question] Enable an extractor at runtime for embedded youtube-dl #26948

Closed
C0D3D3V opened this issue Oct 20, 2020 · 3 comments
Closed

[Question] Enable an extractor at runtime for embedded youtube-dl #26948

C0D3D3V opened this issue Oct 20, 2020 · 3 comments

Comments

@C0D3D3V
Copy link

@C0D3D3V C0D3D3V commented Oct 20, 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 use youtube-dl in one of my projects (moodle-dl). I can understand that with so many PR requests and so few team members, it can take a long time until an extractor gets merged.

I wonder if I can simply add extractors in an embedded youtube-dl instance externally?
For example, if I want to add the Extractor for zoom.us (#24751) at runtime, is that possible?

@C0D3D3V C0D3D3V added the question label Oct 20, 2020
@dstftw
Copy link
Collaborator

@dstftw dstftw commented Oct 20, 2020

Read developer instructions.

@dstftw dstftw closed this Oct 20, 2020
@dstftw dstftw added the duplicate label Oct 20, 2020
@C0D3D3V C0D3D3V changed the title [Question] Enable an extractor at runtime to embed youtube-dl [Question] Enable an extractor at runtime to embeded youtube-dl Oct 20, 2020
@C0D3D3V C0D3D3V changed the title [Question] Enable an extractor at runtime to embeded youtube-dl [Question] Enable an extractor at runtime for embeded youtube-dl Oct 20, 2020
@C0D3D3V C0D3D3V changed the title [Question] Enable an extractor at runtime for embeded youtube-dl [Question] Enable an extractor at runtime for embedded youtube-dl Oct 20, 2020
@C0D3D3V
Copy link
Author

@C0D3D3V C0D3D3V commented Oct 20, 2020

If someone tries to do the same, I suppose it works like this:

ydl.add_info_extractor(YourExternalExtractor(ydl))
@C0D3D3V
Copy link
Author

@C0D3D3V C0D3D3V commented Oct 21, 2020

Nope, this does not work, because Generic Extractor will raise an error as soon as it is tested... Generic Extractor is last in the Extractor list so you have to add your external extractor before the generic one, like this:

    additional_extractors = [
        OpencastIE(ydl),
        OpencastPlaylistIE(ydl),
    ]

    for extractor in additional_extractors:
        ydl._ies.insert(0, extractor)
        ydl._ies_instances[extractor.ie_key()] = extractor

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.