Skip to content

Conversation

@bastimeyer
Copy link
Member

Resolves #3944

This adds the lxml dependency for parsing XML and HTML to Streamlink's install_requires.

There's also the lxml-stubs package available on pypi for adding type definitions which are lacking in the lxml package, 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-stubs is supposed to go into dev-requirements.txt I think. Should this be added?


The validation methods and parse_xml utility 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

@gravyboat
Copy link
Member

lxml is well maintained and actively supported, I'm fine with adding this.

@gravyboat gravyboat merged commit 300a67e into streamlink:master Aug 28, 2021
@bastimeyer bastimeyer deleted the requirements/lxml branch August 28, 2021 19:09
Billy2011 added a commit to Billy2011/streamlink-27 that referenced this pull request Aug 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add lxml dependency

2 participants