|
2 | 2 | import logging |
3 | 3 | import time |
4 | 4 |
|
5 | | -from streamlink import StreamError |
6 | | -from streamlink.compat import urlparse |
| 5 | +from streamlink.exceptions import PluginError, StreamError |
| 6 | +from streamlink.compat import urlparse, urlunparse |
7 | 7 | from streamlink.plugin import Plugin |
8 | 8 | from streamlink.plugin.api import validate |
9 | 9 | from streamlink.stream import HLSStream, hls_playlist |
@@ -158,6 +158,8 @@ def channel(self, channel): |
158 | 158 | except Exception: |
159 | 159 | log.debug("channel sleep {0}".format(_)) |
160 | 160 | time.sleep(0.75) |
| 161 | + else: |
| 162 | + raise PluginError("Unable to find 'self.api.channel' for {0}".format(channel)) |
161 | 163 | return self.session.http.json(res, schema=self.api_schema) |
162 | 164 |
|
163 | 165 | def vod(self, vod_id): |
@@ -197,6 +199,9 @@ class Filmon(Plugin): |
197 | 199 |
|
198 | 200 | def __init__(self, url): |
199 | 201 | super(Filmon, self).__init__(url) |
| 202 | + parsed = urlparse(self.url) |
| 203 | + if parsed.path.startswith("/channel/"): |
| 204 | + self.url = urlunparse(parsed._replace(path=parsed.path.replace("/channel/", "/tv/"))) |
200 | 205 | self.api = FilmOnAPI(self.session) |
201 | 206 |
|
202 | 207 | @classmethod |
@@ -241,6 +246,9 @@ def _get_streams(self): |
241 | 246 | else: |
242 | 247 | _id = channel |
243 | 248 |
|
| 249 | + if _id is None: |
| 250 | + raise PluginError("Unable to find channel ID: {0}".format(channel)) |
| 251 | + |
244 | 252 | try: |
245 | 253 | data = self.api.channel(_id) |
246 | 254 | for stream in data["streams"]: |
|
0 commit comments