<s> import re <EOL> from livestreamer . compat import urlparse <EOL> from livestreamer . plugin import Plugin <EOL> from livestreamer . plugin . api import http , validate <EOL> from livestreamer . stream import HLSStream <EOL> _url_re = re . compile ( "<STR_LIT>" ) <EOL> _live_re = re . compile ( """<STR_LIT>""" , re . DOTALL ) <EOL> _live_schema = validate . Schema ( <EOL> validate . transform ( _live_re . search ) , <EOL> validate . any ( <EOL> None , <EOL> validate . union ( { <EOL> "<STR_LIT:type>" : validate . get ( <NUM_LIT:1> ) , <EOL> "<STR_LIT:url>" : validate . all ( <EOL> validate . get ( <NUM_LIT:2> ) , <EOL> validate . url ( scheme = "<STR_LIT:http>" ) , <EOL> ) , <EOL> } ) <EOL> ) <EOL> ) <EOL> class SSH101 ( Plugin ) : <EOL> @ classmethod <EOL> def can_handle_url ( self , url ) : <EOL> return _url_re . match ( url ) <EOL> def _get_streams ( self ) : <EOL> res = http . get ( self . url , schema = _live_schema ) <EOL> if not res : <EOL> return <EOL> if res [ "<STR_LIT:type>" ] == "<STR_LIT>" and urlparse ( res [ "<STR_LIT:url>" ] ) . path . endswith ( "<STR_LIT>" ) : <EOL> stream = HLSStream ( self . session , res [ "<STR_LIT:url>" ] ) <EOL> return dict ( hls = stream ) <EOL> __plugin__ = SSH101 </s>
