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

Doubt developing extractors #13095

Closed
AllanDaemon opened this issue May 15, 2017 · 1 comment
Closed

Doubt developing extractors #13095

AllanDaemon opened this issue May 15, 2017 · 1 comment

Comments

@AllanDaemon
Copy link

@AllanDaemon AllanDaemon commented May 15, 2017

I have a doubt about developing extractors.

When creating or developing an extractor, can I save data (state) in a instance of the extractor (like class MyExtractorIE(InfoExtractor)? In all the code I saw until now, it seems to avoid saving state in the IE object, working with a more functional approach and passing data just as functions arguments. Many helper methods in the class InfoExtractor (in extractor/common.py) kinda follow this behaving like static methods.

So, in an extractor, can I save data like the video id and others parameters in the object (eg. self.webpage = fetched_webpage), or assuming that each download item creates a new instance of an InfoExtractor is wrong, or something else is wrong.

@dstftw
Copy link
Collaborator

@dstftw dstftw commented May 16, 2017

Extractors' instances are reused so you can't keep any data that affects extraction between downloads. Needless to say it does not even make any sense to store it.

@dstftw dstftw closed this May 16, 2017
@ytdl-org ytdl-org locked and limited conversation to collaborators May 16, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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.