prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  ine.py for source in data["playlist"][0]["sources"]: TypeError: 'NoneType' object is not subscriptable
  Hi, INE plugin is failing since recently:
  
  ```
  $ streamlink -o ./streamlink.mp4 https://streaming.ine.com/play/1cfbc029-dd6d-4646-80b9-7316e3ac121a/introduction 720p --http-cookie laravel_session=removed
  [cli][info] Found matching plugin ine for URL https://streaming.ine.com/play/1cfbc029-dd6d-4646-80b9-7316e3ac121a/introduction
  Traceback (most recent call last):
    File "/opt/local/Library/Frameworks/Python.framework/Versions/Current/bin/streamlink", line 11, in <module>
      load_entry_point('streamlink==0.6.0', 'console_scripts', 'streamlink')()
    File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/streamlink_cli/main.py", line 1027, in main
      handle_url()
    File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/streamlink_cli/main.py", line 482, in handle_url
      streams = fetch_streams(plugin)
    File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/streamlink_cli/main.py", line 394, in fetch_streams
      sorting_excludes=args.stream_sorting_excludes)
    File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/streamlink/plugin/plugin.py", line 328, in get_streams
      return self.streams(*args, **kwargs)
    File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/streamlink/plugin/plugin.py", line 236, in streams
      ostreams = self._get_streams()
    File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/streamlink/plugins/ine.py", line 50, in _get_streams
      for source in data["playlist"][0]["sources"]:
  TypeError: 'NoneType' object is not subscriptable
  $ 
  $ python --version
  Python 3.5.3
  $ streamlink --version
  streamlink 0.6.0
  $ streamlink --version-check
  [cli][info] Your Streamlink version (0.6) is up to date!
  $
  ```
  Same error on mac OS and Windows.
  This particular URL was 'downloadable' with no problem about a month ago or so.
  
  </issue>
  <code>
  [start of src/streamlink/plugins/ine.py]
  1 from __future__ import print_function
  2 
  3 import json
  4 import re
  5 
  6 from streamlink.plugin import Plugin
  7 from streamlink.plugin.api import http
  8 from streamlink.plugin.api import validate
  9 from streamlink.stream import HLSStream
  10 
  11 
  12 class INE(Plugin):
  13     url_re = re.compile(r"""https://streaming.ine.com/play\#?/
  14             ([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/?
  15             (.*?)""", re.VERBOSE)
  16     play_url = "https://streaming.ine.com/play/{vid}/watch"
  17     js_re = re.compile(r'''script type="text/javascript" src="(https://content.jwplatform.com/players/.*?)"''')
  18     jwplayer_re = re.compile(r'''jwplayer\(".*?"\).setup\((\{.*\})\);''', re.DOTALL)
  19     setup_schema = validate.Schema(
  20         validate.transform(jwplayer_re.search),
  21         validate.any(
  22             None,
  23             validate.all(
  24                 validate.get(1),
  25                 validate.transform(json.loads),
  26                 {"playlist": [
  27                     {"sources": [{"file": validate.text,
  28                                   "type": validate.text}]}
  29                 ]}
  30             )
  31         )
  32     )
  33 
  34     @classmethod
  35     def can_handle_url(cls, url):
  36         return cls.url_re.match(url) is not None
  37 
  38     def _get_streams(self):
  39         vid = self.url_re.match(self.url).group(1)
  40         self.logger.debug("Found video ID: {0}", vid)
  41 
  42         page = http.get(self.play_url.format(vid=vid))
  43         js_url_m = self.js_re.search(page.text)
  44         if js_url_m:
  45             js_url = js_url_m.group(1)
  46             self.logger.debug("Loading player JS: {0}", js_url)
  47 
  48             res = http.get(js_url)
  49             data = self.setup_schema.validate(res.text)
  50             for source in data["playlist"][0]["sources"]:
  51                 if source["type"] == "hls":
  52                     return HLSStream.parse_variant_playlist(self.session, "https:" + source["file"])
  53 
  54 
  55 __plugin__ = INE
  56
  [end of src/streamlink/plugins/ine.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/src/streamlink/plugins/ine.py b/src/streamlink/plugins/ine.py
  --- a/src/streamlink/plugins/ine.py
  +++ b/src/streamlink/plugins/ine.py
  @@ -15,7 +15,7 @@
               (.*?)""", re.VERBOSE)
       play_url = "https://streaming.ine.com/play/{vid}/watch"
       js_re = re.compile(r'''script type="text/javascript" src="(https://content.jwplatform.com/players/.*?)"''')
  -    jwplayer_re = re.compile(r'''jwplayer\(".*?"\).setup\((\{.*\})\);''', re.DOTALL)
  +    jwplayer_re = re.compile(r'''jwConfig\s*=\s*(\{.*\});''', re.DOTALL)
       setup_schema = validate.Schema(
           validate.transform(jwplayer_re.search),
           validate.any(
  
verification_info: {"golden_diff": "diff --git a/src/streamlink/plugins/ine.py b/src/streamlink/plugins/ine.py\n--- a/src/streamlink/plugins/ine.py\n+++ b/src/streamlink/plugins/ine.py\n@@ -15,7 +15,7 @@\n             (.*?)\"\"\", re.VERBOSE)\n     play_url = \"https://streaming.ine.com/play/{vid}/watch\"\n     js_re = re.compile(r'''script type=\"text/javascript\" src=\"(https://content.jwplatform.com/players/.*?)\"''')\n-    jwplayer_re = re.compile(r'''jwplayer\\(\".*?\"\\).setup\\((\\{.*\\})\\);''', re.DOTALL)\n+    jwplayer_re = re.compile(r'''jwConfig\\s*=\\s*(\\{.*\\});''', re.DOTALL)\n     setup_schema = validate.Schema(\n         validate.transform(jwplayer_re.search),\n         validate.any(\n", "issue": "ine.py for source in data[\"playlist\"][0][\"sources\"]: TypeError: 'NoneType' object is not subscriptable\nHi, INE plugin is failing since recently:\r\n\r\n```\r\n$ streamlink -o ./streamlink.mp4 https://streaming.ine.com/play/1cfbc029-dd6d-4646-80b9-7316e3ac121a/introduction 720p --http-cookie laravel_session=removed\r\n[cli][info] Found matching plugin ine for URL https://streaming.ine.com/play/1cfbc029-dd6d-4646-80b9-7316e3ac121a/introduction\r\nTraceback (most recent call last):\r\n  File \"/opt/local/Library/Frameworks/Python.framework/Versions/Current/bin/streamlink\", line 11, in <module>\r\n    load_entry_point('streamlink==0.6.0', 'console_scripts', 'streamlink')()\r\n  File \"/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/streamlink_cli/main.py\", line 1027, in main\r\n    handle_url()\r\n  File \"/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/streamlink_cli/main.py\", line 482, in handle_url\r\n    streams = fetch_streams(plugin)\r\n  File \"/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/streamlink_cli/main.py\", line 394, in fetch_streams\r\n    sorting_excludes=args.stream_sorting_excludes)\r\n  File \"/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/streamlink/plugin/plugin.py\", line 328, in get_streams\r\n    return self.streams(*args, **kwargs)\r\n  File \"/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/streamlink/plugin/plugin.py\", line 236, in streams\r\n    ostreams = self._get_streams()\r\n  File \"/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/streamlink/plugins/ine.py\", line 50, in _get_streams\r\n    for source in data[\"playlist\"][0][\"sources\"]:\r\nTypeError: 'NoneType' object is not subscriptable\r\n$ \r\n$ python --version\r\nPython 3.5.3\r\n$ streamlink --version\r\nstreamlink 0.6.0\r\n$ streamlink --version-check\r\n[cli][info] Your Streamlink version (0.6) is up to date!\r\n$\r\n```\r\nSame error on mac OS and Windows.\r\nThis particular URL was 'downloadable' with no problem about a month ago or so.\n", "before_files": [{"content": "from __future__ import print_function\n\nimport json\nimport re\n\nfrom streamlink.plugin import Plugin\nfrom streamlink.plugin.api import http\nfrom streamlink.plugin.api import validate\nfrom streamlink.stream import HLSStream\n\n\nclass INE(Plugin):\n    url_re = re.compile(r\"\"\"https://streaming.ine.com/play\\#?/\n            ([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/?\n            (.*?)\"\"\", re.VERBOSE)\n    play_url = \"https://streaming.ine.com/play/{vid}/watch\"\n    js_re = re.compile(r'''script type=\"text/javascript\" src=\"(https://content.jwplatform.com/players/.*?)\"''')\n    jwplayer_re = re.compile(r'''jwplayer\\(\".*?\"\\).setup\\((\\{.*\\})\\);''', re.DOTALL)\n    setup_schema = validate.Schema(\n        validate.transform(jwplayer_re.search),\n        validate.any(\n            None,\n            validate.all(\n                validate.get(1),\n                validate.transform(json.loads),\n                {\"playlist\": [\n                    {\"sources\": [{\"file\": validate.text,\n                                  \"type\": validate.text}]}\n                ]}\n            )\n        )\n    )\n\n    @classmethod\n    def can_handle_url(cls, url):\n        return cls.url_re.match(url) is not None\n\n    def _get_streams(self):\n        vid = self.url_re.match(self.url).group(1)\n        self.logger.debug(\"Found video ID: {0}\", vid)\n\n        page = http.get(self.play_url.format(vid=vid))\n        js_url_m = self.js_re.search(page.text)\n        if js_url_m:\n            js_url = js_url_m.group(1)\n            self.logger.debug(\"Loading player JS: {0}\", js_url)\n\n            res = http.get(js_url)\n            data = self.setup_schema.validate(res.text)\n            for source in data[\"playlist\"][0][\"sources\"]:\n                if source[\"type\"] == \"hls\":\n                    return HLSStream.parse_variant_playlist(self.session, \"https:\" + source[\"file\"])\n\n\n__plugin__ = INE\n", "path": "src/streamlink/plugins/ine.py"}]}