src/streamlink/plugins/ustvnow.py
def _get_streams(self):
        """
        Finds the streams from tvcatchup.com.
        """
        token = self.login(self.get_option("username"), self.get_option("password"))
        m = self._url_re.match(self.url)
        scode = m and m.group("scode") or self.get_option("station_code")

        res = self.session.http.get(self._guide_url, params=dict(token=token))

        channels = OrderedDict()
        for t in itertags(res.text, "a"):
            if t.attributes.get('cs'):
                channels[t.attributes.get('cs').lower()] = t.attributes.get('title').replace("Watch ", "").strip()

        if not scode:
            log.error("Station code not provided, use --ustvnow-station-code.")
            log.info("Available stations are: \n{0} ".format('\n'.join('    {0} ({1})'.format(c, n) for c, n in channels.items())))
            return

        if scode in channels:
            log.debug("Finding streams for: {0}", channels.get(scode))

            r = self.session.http.get(self._stream_url, params={"scode": scode,
                                                   "token": token,
                                                   "br_n": "Firefox",
                                                   "br_v": "52",
                                                   "br_d": "desktop"},
                         headers={"User-Agent": useragents.FIREFOX})

            data = self.session.http.json(r)
            return HLSStream.parse_variant_playlist(self.session, data["stream"])
        else:
            log.error("Invalid station-code: {0}", scode)
def _get_streams(self):
        """
        Finds the streams from tvcatchup.com.
        """
        token = self.login(self.get_option("username"), self.get_option("password"))
        m = self._url_re.match(self.url)
        scode = m and m.group("scode") or self.get_option("station_code")

        res = self.session.http.get(self._guide_url, params=dict(token=token))

        channels = OrderedDict()
        for t in itertags(res.text, "a"):
            if t.attributes.get('cs'):
                channels[t.attributes.get('cs').lower()] = t.attributes.get('title').replace("Watch ", "").strip()

        if not scode:
            log.error("Station code not provided, use --ustvnow-station-code.")
            log.info("Available stations are: \n{0} ".format('\n'.join('    {0} ({1})'.format(c, n) for c, n in channels.items())))
            return

        if scode in channels:
            log.debug("Finding streams for: {0}", channels.get(scode))

            r = self.session.http.get(self._stream_url, params={"scode": scode,
                                                   "token": token,
                                                   "br_n": "Firefox",
                                                   "br_v": "52",
                                                   "br_d": "desktop"},
                         headers={"User-Agent": useragents.FIREFOX})

            data = self.session.http.json(r)
            return HLSStream.parse_variant_playlist(self.session, data["stream"])
        else:
            log.error("Invalid station-code: {0}", scode)
def _get_streams ( self ) : token = self . login ( self . get_option ( "username" ) , self . get_option ( "password" ) ) m = self . _url_re . match ( self . url ) scode = m and m . group ( "scode" ) or self . get_option ( "station_code" ) res = self . session . http . get ( self . _guide_url , params = dict ( token = token ) ) channels = OrderedDict ( ) for t in itertags ( res . text , "a" ) : if t . attributes . get ( 'cs' ) : channels [ t . attributes . get ( 'cs' ) . lower ( ) ] = t . attributes . get ( 'title' ) . replace ( "Watch " , "" ) . strip ( ) if not scode : log . error ( "Station code not provided, use --ustvnow-station-code." ) log . info ( "Available stations are: \n{0} " . format ( '\n' . join ( '    {0} ({1})' . format ( c , n ) for c , n in channels . items ( ) ) ) ) return if scode in channels : log . debug ( "Finding streams for: {0}" , channels . get ( scode ) ) r = self . session . http . get ( self . _stream_url , params = { "scode" : scode , "token" : token , "br_n" : "Firefox" , "br_v" : "52" , "br_d" : "desktop" } , headers = { "User-Agent" : useragents . FIREFOX } ) data = self . session . http . json ( r ) return HLSStream . parse_variant_playlist ( self . session , data [ "stream" ] ) else : log . error ( "Invalid station-code: {0}" , scode )
Finds the streams from tvcatchup.com.
Finds the streams from tvcatchup . com .