vendor: add lxml dependency #3952
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves #3944
This adds the
lxmldependency for parsing XML and HTML to Streamlink'sinstall_requires.There's also the
lxml-stubspackage available on pypi for adding type definitions which are lacking in thelxmlpackage, but I don't know how this external package works. I'm using pycharm professional and it's generating types from the docs automatically (not that well though).lxml-stubsis supposed to go intodev-requirements.txtI think. Should this be added?The validation methods and
parse_xmlutility method have not been modified yet and are still using the standard library methods for parsing XML. DASH streams and the validation methods (which are only called one single plugin - rtve) are therefore not affected.I've tried to update the methods, but ran into encoding issues while reading XML from strings (utf-8) with a custom encoding set in the XML declaration (
<?xml version="..." encoding="..."?>). This needs some refactoring first.As an example on how XPath queries massively simplify plugins in a safe way, take a look at this diff:
bastimeyer/streamlink@requirements/lxml...bastimeyer:plugins/deutschewelle/rewrite-xpath