Repository: Flexget/Flexget

Issue:
BUG: Unhandled error in plugin discover
### Expected behaviour:
No crash. It should resolve itself if no response received from server?

### Actual behaviour:
Crashed with "CRITICAL task". I get this crash report about once daily. The discover task execute once per hour.

### Steps to reproduce:
- Execute a task using discover plugin

#### Config:
```yaml
templates:
  ##### Movies metainfo mainly for move and update tasks
  movies-metainfo:
    metainfo_movie: yes
    imdb_lookup: yes
    tmdb_lookup: yes
    trakt_lookup: yes
    parsing:
      movie: guessit

  ##### Common rejections
  reject:
    regexp:
      reject:
        - \b(s|d)ub(s|bed|lado|titulado)?\b
        - \bhc\b
        - \bdual\b
        - \b3d\b
        - \bfre(nch)?\b
        - \bita(lian)?\b
        - \bspa(nish)?\b
        - \bger(man)?\b
        - \bcastellano\b
        - \brus(sian)?\b
        - \bswe(dish)?\b
        - \bhindi\b
        - '[\. ]korsub[\. ]?'
        - \bstuttershit\b
        - \bshitbox\b
        - \bshittierbox\b
      accept:
        - \bkorean\b

  movie:
    torrent_alive: 1                 # Will reject results with less than 1 seed
    content_size:
      max: 7168
      strict: no
    set:
      path: '/{? folder.root ?}{? folder.moviesDVD ?}'
    template: transmissionRPC
    transmission:
      add_paused: no

tasks:
  download-movies-discover:
    priority: 33 # run after the movie list fill task
    template:
      - movies-metainfo
      - reject
      - movie
    quality: 1080p webdl+        # Make sure no screeners or cams are downloaded
    discover:
      what:
        - movie_list: movies
        - movie_list: movies_upgrade
      from:
        - rarbg:
            category: [44,50]
            sorted_by: seeders
            ranked: false
      interval: 1 hour
      release_estimations:
        optimistic: 120 days
    list_match:
      from:
        - movie_list: movies
        - movie_list: movies_upgrade
    list_remove:
      - movie_list: movies
      - movie_list: movies_upgrade
```
  
#### Log:
<details>
 <summary>(click to expand)</summary>

```
2021-08-03 04:59:31 DEBUG    utils.requests download-movies-discover GETing URL http://m.blu-ray.com/countries.json.php with args () and kwargs {'params': {'_': '1627937970202'}, 'allow_redirects': True, 'timeout': 30}
2021-08-03 04:59:33 ERROR    api_bluray    download-movies-discover Error refreshing movie details for Dune from blu-ray.com, cached info being used. No search results found for Dune (2021) on blu-ray.com
2021-08-03 04:59:33 DEBUG    est_movies_bluray download-movies-discover received release date: 2021-12-31
2021-08-03 04:59:33 VERBOSE  discover      download-movies-discover Dune (2021) hasn't been released yet (Expected: 2021-12-31 00:00:00)
2021-08-03 04:59:33 DEBUG    est_released  download-movies-discover The Batman (2022)
2021-08-03 04:59:33 DEBUG    est_movies_bluray download-movies-discover Skipping Blu-ray.com lookup since movie year is 2022
2021-08-03 04:59:33 VERBOSE  discover      download-movies-discover The Batman (2022) hasn't been released yet (Expected: 2022-01-01 00:00:00)
2021-08-03 04:59:33 DEBUG    est_released  download-movies-discover Fantastic Beasts 3 (2022)
2021-08-03 04:59:33 DEBUG    est_movies_bluray download-movies-discover Skipping Blu-ray.com lookup since movie year is 2022
2021-08-03 04:59:33 VERBOSE  discover      download-movies-discover Fantastic Beasts 3 (2022) hasn't been released yet (Expected: 2022-01-01 00:00:00)
2021-08-03 04:59:33 DEBUG    est_released  download-movies-discover Fast & Furious 10
2021-08-03 04:59:33 DEBUG    est_movies_bluray download-movies-discover Searching Blu-ray.com for release date of Fast & Furious 10 (None)
2021-08-03 04:59:33 DEBUG    api_bluray    download-movies-discover Cache has expired for The Fast and the Furious (Universal 100th Anniversary) (Media Markt Exclusive) (SteelBook) (2001), attempting to refresh from blu-ray.com.
2021-08-03 04:59:33 DEBUG    utils.requests download-movies-discover GETing URL http://m.blu-ray.com/quicksearch/search.php with args () and kwargs {'params': {'section': 'bluraymovies', 'country': 'ALL', 'keyword': 'Fast & Furious 10', '_': '1627937973481'}, 'allow_redirects': True, 'timeout': 30}
2021-08-03 04:59:35 DEBUG    utils.requests download-movies-discover GETing URL http://m.blu-ray.com/countries.json.php with args () and kwargs {'params': {'_': '1627937973481'}, 'allow_redirects': True, 'timeout': 30}
2021-08-03 04:59:36 DEBUG    utils.requests download-movies-discover GETing URL https://m.blu-ray.com/movies/The-Fast-and-the-Furious-Blu-ray/52239/ with args () and kwargs {'allow_redirects': True, 'timeout': 30}
2021-08-03 04:59:37 DEBUG    est_movies_bluray download-movies-discover received release date: 2012-03-01
2021-08-03 04:59:37 DEBUG    discover      download-movies-discover Fast & Furious 10 has been released at 2012-03-01 00:00:00
2021-08-03 04:59:37 DEBUG    est_released  download-movies-discover Free Guy (2021)
2021-08-03 04:59:37 DEBUG    est_movies_bluray download-movies-discover Searching Blu-ray.com for release date of Free Guy (2021)
2021-08-03 04:59:37 DEBUG    api_bluray    download-movies-discover Cache has expired for Eternals 4K (2021), attempting to refresh from blu-ray.com.
2021-08-03 04:59:37 DEBUG    utils.requests download-movies-discover GETing URL http://m.blu-ray.com/quicksearch/search.php with args () and kwargs {'params': {'section': 'bluraymovies', 'country': 'ALL', 'keyword': 'Free Guy', '_': '1627937977978'}, 'allow_redirects': True, 'timeout': 30}
2021-08-03 04:59:39 DEBUG    utils.requests download-movies-discover GETing URL http://m.blu-ray.com/countries.json.php with args () and kwargs {'params': {'_': '1627937977978'}, 'allow_redirects': True, 'timeout': 30}
2021-08-03 04:59:41 DEBUG    utils.requests download-movies-discover GETing URL https://m.blu-ray.com/movies/Free-Guy-4K-Blu-ray/295390/ with args () and kwargs {'allow_redirects': True, 'timeout': 30}
2021-08-03 04:59:43 DEBUG    est_movies_bluray download-movies-discover received release date: 2021-12-31
2021-08-03 04:59:43 VERBOSE  discover      download-movies-discover Free Guy (2021) hasn't been released yet (Expected: 2021-12-31 00:00:00)
2021-08-03 04:59:43 DEBUG    est_released  download-movies-discover Green Lantern Corps
2021-08-03 04:59:43 DEBUG    est_movies_bluray download-movies-discover Searching Blu-ray.com for release date of Green Lantern Corps (None)
2021-08-03 04:59:43 DEBUG    api_bluray    download-movies-discover Cache has expired for Toy Story 4 3D, attempting to refresh from blu-ray.com.
2021-08-03 04:59:43 DEBUG    utils.requests download-movies-discover GETing URL http://m.blu-ray.com/quicksearch/search.php with args () and kwargs {'params': {'section': 'bluraymovies', 'country': 'ALL', 'keyword': 'Green Lantern Corps', '_': '1627937983051'}, 'allow_redirects': True, 'timeout': 30}
2021-08-03 04:59:44 DEBUG    utils.requests download-movies-discover GETing URL http://m.blu-ray.com/countries.json.php with args () and kwargs {'params': {'_': '1627937983051'}, 'allow_redirects': True, 'timeout': 30}
2021-08-03 04:59:46 ERROR    api_bluray    download-movies-discover Error refreshing movie details for Green Lantern Corps from blu-ray.com, cached info being used. No search results found for Green Lantern Corps on blu-ray.com
2021-08-03 04:59:46 DEBUG    est_movies_bluray download-movies-discover received release date: 2019-12-31
2021-08-03 04:59:46 DEBUG    discover      download-movies-discover Green Lantern Corps has been released at 2019-12-31 00:00:00
2021-08-03 04:59:46 DEBUG    est_released  download-movies-discover Stanley Ka Dabba (2011)
2021-08-03 04:59:46 DEBUG    est_movies_bluray download-movies-discover Searching Blu-ray.com for release date of Stanley Ka Dabba (2011)
2021-08-03 04:59:46 DEBUG    api_bluray    download-movies-discover Cache has expired for The Tree of Life (DigiPack) (2011), attempting to refresh from blu-ray.com.
2021-08-03 04:59:46 DEBUG    utils.requests download-movies-discover GETing URL http://m.blu-ray.com/quicksearch/search.php with args () and kwargs {'params': {'section': 'bluraymovies', 'country': 'ALL', 'keyword': 'Stanley Ka Dabba', '_': '1627937986358'}, 'allow_redirects': True, 'timeout': 30}
2021-08-03 04:59:47 DEBUG    utils.requests download-movies-discover GETing URL http://m.blu-ray.com/countries.json.php with args () and kwargs {'params': {'_': '1627937986358'}, 'allow_redirects': True, 'timeout': 30}
2021-08-03 04:59:49 ERROR    api_bluray    download-movies-discover Error refreshing movie details for Stanley Ka Dabba from blu-ray.com, cached info being used. No search results found for Stanley Ka Dabba (2011) on blu-ray.com
2021-08-03 04:59:49 DEBUG    est_movies_bluray download-movies-discover received release date: 2018-11-19
2021-08-03 04:59:49 DEBUG    discover      download-movies-discover Stanley Ka Dabba (2011) has been released at 2018-11-19 00:00:00
2021-08-03 04:59:49 DEBUG    est_released  download-movies-discover Sherlock Holmes 3
2021-08-03 04:59:49 DEBUG    est_movies_bluray download-movies-discover Searching Blu-ray.com for release date of Sherlock Holmes 3 (None)
2021-08-03 04:59:49 DEBUG    api_bluray    download-movies-discover Cache has expired for Sherlock Holmes 3D, attempting to refresh from blu-ray.com.
2021-08-03 04:59:49 DEBUG    utils.requests download-movies-discover GETing URL http://m.blu-ray.com/quicksearch/search.php with args () and kwargs {'params': {'section': 'bluraymovies', 'country': 'ALL', 'keyword': 'Sherlock Holmes 3', '_': '1627937989564'}, 'allow_redirects': True, 'timeout': 30}
2021-08-03 04:59:51 DEBUG    utils.requests download-movies-discover GETing URL http://m.blu-ray.com/countries.json.php with args () and kwargs {'params': {'_': '1627937989564'}, 'allow_redirects': True, 'timeout': 30}
2021-08-03 04:59:52 DEBUG    utils.requests download-movies-discover GETing URL https://m.blu-ray.com/movies/Best-of-Blu-ray-Blu-ray/277513/ with args () and kwargs {'allow_redirects': True, 'timeout': 30}
2021-08-03 04:59:54 DEBUG    est_movies_bluray download-movies-discover received release date: 2010-01-01
2021-08-03 04:59:54 DEBUG    discover      download-movies-discover Sherlock Holmes 3 has been released at 2010-01-01 00:00:00
2021-08-03 04:59:54 DEBUG    est_released  download-movies-discover The Outsider (2016)
2021-08-03 04:59:54 DEBUG    est_movies_bluray download-movies-discover Searching Blu-ray.com for release date of The Outsider (2016)
2021-08-03 04:59:54 DEBUG    api_bluray    download-movies-discover Cache has expired for Mobile Suit Gundam Iron-Blooded Orphans: Season 1 Part 2 (2016), attempting to refresh from blu-ray.com.
2021-08-03 04:59:54 DEBUG    utils.requests download-movies-discover GETing URL http://m.blu-ray.com/quicksearch/search.php with args () and kwargs {'params': {'section': 'bluraymovies', 'country': 'ALL', 'keyword': 'The Outsider', '_': '1627937994117'}, 'allow_redirects': True, 'timeout': 30}
2021-08-03 04:59:55 DEBUG    utils.requests download-movies-discover GETing URL http://m.blu-ray.com/countries.json.php with args () and kwargs {'params': {'_': '1627937994117'}, 'allow_redirects': True, 'timeout': 30}
2021-08-03 04:59:57 ERROR    api_bluray    download-movies-discover Error refreshing movie details for The Outsider from blu-ray.com, cached info being used. No search results found for The Outsider (2016) on blu-ray.com
2021-08-03 04:59:57 DEBUG    est_movies_bluray download-movies-discover received release date: 2017-11-14
2021-08-03 04:59:57 DEBUG    discover      download-movies-discover The Outsider (2016) has been released at 2017-11-14 00:00:00
2021-08-03 04:59:57 DEBUG    est_released  download-movies-discover Red Notice (2021)
2021-08-03 04:59:57 DEBUG    est_movies_bluray download-movies-discover Searching Blu-ray.com for release date of Red Notice (2021)
2021-08-03 04:59:57 DEBUG    api_bluray    download-movies-discover Cache has expired for SAS: Red Notice 4K (2021), attempting to refresh from blu-ray.com.
2021-08-03 04:59:57 DEBUG    utils.requests download-movies-discover GETing URL http://m.blu-ray.com/quicksearch/search.php with args () and kwargs {'params': {'section': 'bluraymovies', 'country': 'ALL', 'keyword': 'Red Notice', '_': '1627937997399'}, 'allow_redirects': True, 'timeout': 30}
2021-08-03 04:59:59 DEBUG    utils.requests download-movies-discover GETing URL http://m.blu-ray.com/countries.json.php with args () and kwargs {'params': {'_': '1627937997399'}, 'allow_redirects': True, 'timeout': 30}
2021-08-03 05:00:00 DEBUG    utils.requests download-movies-discover GETing URL https://m.blu-ray.com/movies/SAS-Red-Notice-Blu-ray/293721/ with args () and kwargs {'allow_redirects': True, 'timeout': 30}
2021-08-03 05:00:01 DEBUG    est_movies_bluray download-movies-discover received release date: 2021-04-30
2021-08-03 05:00:01 DEBUG    discover      download-movies-discover Red Notice (2021) has been released at 2021-04-30 00:00:00
2021-08-03 05:00:01 DEBUG    est_released  download-movies-discover The Day I Bought a Star (2006)
2021-08-03 05:00:01 DEBUG    est_movies_bluray download-movies-discover Searching Blu-ray.com for release date of The Day I Bought a Star (2006)
2021-08-03 05:00:01 VERBOSE  api_bluray    download-movies-discover Searching from blu-ray.com `The Day I Bought a Star`
2021-08-03 05:00:01 DEBUG    utils.requests download-movies-discover GETing URL http://m.blu-ray.com/quicksearch/search.php with args () and kwargs {'params': {'section': 'bluraymovies', 'country': 'ALL', 'keyword': 'The Day I Bought a Star', '_': '1627938001830'}, 'allow_redirects': True, 'timeout': 30}
2021-08-03 05:00:03 DEBUG    utils.requests download-movies-discover GETing URL http://m.blu-ray.com/countries.json.php with args () and kwargs {'params': {'_': '1627938001830'}, 'allow_redirects': True, 'timeout': 30}
2021-08-03 05:00:05 DEBUG    est_movies_bluray download-movies-discover No search results found for The Day I Bought a Star (2006) on blu-ray.com
2021-08-03 05:00:05 DEBUG    discover      download-movies-discover The Day I Bought a Star (2006) has been released at 2006-01-01 00:00:00
2021-08-03 05:00:05 DEBUG    est_released  download-movies-discover Koro's Big Day Out (2002)
2021-08-03 05:00:05 DEBUG    est_movies_bluray download-movies-discover Searching Blu-ray.com for release date of Koro's Big Day Out (2002)
2021-08-03 05:00:05 DEBUG    api_bluray    download-movies-discover Cache has expired for The Transporter (2002), attempting to refresh from blu-ray.com.
2021-08-03 05:00:05 DEBUG    utils.requests download-movies-discover GETing URL http://m.blu-ray.com/quicksearch/search.php with args () and kwargs {'params': {'section': 'bluraymovies', 'country': 'ALL', 'keyword': "Koro's Big Day Out", '_': '1627938005045'}, 'allow_redirects': True, 'timeout': 30}
2021-08-03 05:00:06 DEBUG    utils.requests download-movies-discover GETing URL http://m.blu-ray.com/countries.json.php with args () and kwargs {'params': {'_': '1627938005045'}, 'allow_redirects': True, 'timeout': 30}
2021-08-03 05:00:08 ERROR    api_bluray    download-movies-discover Error refreshing movie details for Koro's Big Day Out from blu-ray.com, cached info being used. No search results found for Koro's Big Day Out (2002) on blu-ray.com
2021-08-03 05:00:08 DEBUG    est_movies_bluray download-movies-discover received release date: 2006-11-14
2021-08-03 05:00:08 DEBUG    discover      download-movies-discover Koro's Big Day Out (2002) has been released at 2006-11-14 00:00:00
2021-08-03 05:00:08 DEBUG    est_released  download-movies-discover Final Space (2016)
2021-08-03 05:00:08 DEBUG    est_movies_bluray download-movies-discover Searching Blu-ray.com for release date of Final Space (2016)
2021-08-03 05:00:08 DEBUG    api_bluray    download-movies-discover Cache has expired for Hacksaw Ridge (2016), attempting to refresh from blu-ray.com.
2021-08-03 05:00:08 DEBUG    utils.requests download-movies-discover GETing URL http://m.blu-ray.com/quicksearch/search.php with args () and kwargs {'params': {'section': 'bluraymovies', 'country': 'ALL', 'keyword': 'Final Space', '_': '1627938008263'}, 'allow_redirects': True, 'timeout': 30}
2021-08-03 05:00:23 ERROR    api_bluray    download-movies-discover Error refreshing movie details for Final Space from blu-ray.com, cached info being used. Error searching for Final Space (2016) on blu-ray.com: HTTPSConnectionPool(host='m.blu-ray.com', port=443): Max retries exceeded with url: /quicksearch/search.php?section=bluraymovies&country=ALL&keyword=Final+Space&_=1627938008263 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f2cf4d82c40>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'))
2021-08-03 05:00:23 DEBUG    est_movies_bluray download-movies-discover received release date: 2017-02-21
2021-08-03 05:00:23 DEBUG    discover      download-movies-discover Final Space (2016) has been released at 2017-02-21 00:00:00
2021-08-03 05:00:23 DEBUG    est_released  download-movies-discover Ani*Kuri15: A Gathering of Cats (2007)
2021-08-03 05:00:23 DEBUG    est_movies_bluray download-movies-discover Searching Blu-ray.com for release date of Ani*Kuri15: A Gathering of Cats (2007)
2021-08-03 05:00:23 VERBOSE  api_bluray    download-movies-discover Searching from blu-ray.com `Ani*Kuri15: A Gathering of Cats`
2021-08-03 05:00:23 DEBUG    utils.requests download-movies-discover GETing URL http://m.blu-ray.com/quicksearch/search.php with args () and kwargs {'params': {'section': 'bluraymovies', 'country': 'ALL', 'keyword': 'Ani*Kuri15: A Gathering of Cats', '_': '1627938023810'}, 'allow_redirects': True, 'timeout': 30}
2021-08-03 05:00:43 WARNING  urllib3.connectionpool download-movies-discover Retrying (Retry(total=0, connect=None, read=None, redirect=0, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f2cf51588b0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /quicksearch/search.php?section=bluraymovies&country=ALL&keyword=Ani%2AKuri15%3A+A+Gathering+of+Cats&_=1627938023810
2021-08-03 05:01:03 DEBUG    est_movies_bluray download-movies-discover Error searching for Ani*Kuri15: A Gathering of Cats (2007) on blu-ray.com: HTTPConnectionPool(host='m.blu-ray.com', port=80): Max retries exceeded with url: /quicksearch/search.php?section=bluraymovies&country=ALL&keyword=Ani%2AKuri15%3A+A+Gathering+of+Cats&_=1627938023810 (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f2cf4a6cb80>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'))
2021-08-03 05:01:03 DEBUG    discover      download-movies-discover Ani*Kuri15: A Gathering of Cats (2007) has been released at 2007-01-01 00:00:00
2021-08-03 05:01:03 DEBUG    est_released  download-movies-discover She and Her Cat (1999)
2021-08-03 05:01:03 DEBUG    est_movies_bluray download-movies-discover Searching Blu-ray.com for release date of She and Her Cat (1999)
2021-08-03 05:01:03 VERBOSE  api_bluray    download-movies-discover Searching from blu-ray.com `She and Her Cat`
2021-08-03 05:01:03 DEBUG    utils.requests download-movies-discover GETing URL http://m.blu-ray.com/quicksearch/search.php with args () and kwargs {'params': {'section': 'bluraymovies', 'country': 'ALL', 'keyword': 'She and Her Cat', '_': '1627938063867'}, 'allow_redirects': True, 'timeout': 30}
2021-08-03 05:01:03 CRITICAL task          download-movies-discover BUG: Unhandled error in plugin discover: Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):

  File "/var/packages/py3k/target/usr/local/lib/python3.8/threading.py", line 890, in _bootstrap
    self._bootstrap_inner()
    │    └ <function Thread._bootstrap_inner at 0x7f2d040ba550>
    └ <Thread(task_queue, started daemon 139830683232000)>
  File "/var/packages/py3k/target/usr/local/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
    │    └ <function Thread.run at 0x7f2d040ba280>
    └ <Thread(task_queue, started daemon 139830683232000)>
  File "/var/packages/py3k/target/usr/local/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
    │    │        │    │        │    └ {}
    │    │        │    │        └ <Thread(task_queue, started daemon 139830683232000)>
    │    │        │    └ ()
    │    │        └ <Thread(task_queue, started daemon 139830683232000)>
    │    └ <bound method TaskQueue.run of <flexget.task_queue.TaskQueue object at 0x7f2cf4ee1580>>
    └ <Thread(task_queue, started daemon 139830683232000)>
  File "/var/packages/py3k/target/usr/local/lib/python3.8/site-packages/flexget/task_queue.py", line 46, in run
    self.current_task.execute()
    │    │            └ <function Task.execute at 0x7f2cfbf74e50>
    │    └ <flexget.task.Task object at 0x7f2cf494bcd0>
    └ <flexget.task_queue.TaskQueue object at 0x7f2cf4ee1580>
  File "/var/packages/py3k/target/usr/local/lib/python3.8/site-packages/flexget/task.py", line 87, in wrapper
    return func(self, *args, **kw)
           │    │      │       └ {}
           │    │      └ ()
           │    └ <flexget.task.Task object at 0x7f2cf494bcd0>
           └ <function Task.execute at 0x7f2cfbf74dc0>
  File "/var/packages/py3k/target/usr/local/lib/python3.8/site-packages/flexget/task.py", line 722, in execute
    self._execute()
    │    └ <function Task._execute at 0x7f2cfbf74d30>
    └ <flexget.task.Task object at 0x7f2cf494bcd0>
  File "/var/packages/py3k/target/usr/local/lib/python3.8/site-packages/flexget/task.py", line 688, in _execute
    self.__run_task_phase(phase)
    │                     └ 'input'
    └ <flexget.task.Task object at 0x7f2cf494bcd0>
  File "/var/packages/py3k/target/usr/local/lib/python3.8/site-packages/flexget/task.py", line 514, in __run_task_phase
    response = self.__run_plugin(plugin, phase, args)
               │                 │       │      └ (<flexget.task.Task object at 0x7f2cf494bcd0>, {'what': [{'movie_list': 'movies'}, {'movie_list': 'movies_upgrade'}], 'from':...
               │                 │       └ 'input'
               │                 └ <PluginInfo(name=discover)>
               └ <flexget.task.Task object at 0x7f2cf494bcd0>
> File "/var/packages/py3k/target/usr/local/lib/python3.8/site-packages/flexget/task.py", line 547, in __run_plugin
    result = method(*args, **kwargs)
             │       │       └ {}
             │       └ (<flexget.task.Task object at 0x7f2cf494bcd0>, {'what': [{'movie_list': 'movies'}, {'movie_list': 'movies_upgrade'}], 'from':...
             └ <Event(name=plugin.discover.input,func=on_task_input,priority=128)>
  File "/var/packages/py3k/target/usr/local/lib/python3.8/site-packages/flexget/event.py", line 20, in __call__
    return self.func(*args, **kwargs)
           │    │     │       └ {}
           │    │     └ (<flexget.task.Task object at 0x7f2cf494bcd0>, {'what': [{'movie_list': 'movies'}, {'movie_list': 'movies_upgrade'}], 'from':...
           │    └ <bound method Discover.on_task_input of <flexget.plugins.input.discover.Discover object at 0x7f2cf8ced280>>
           └ <Event(name=plugin.discover.input,func=on_task_input,priority=128)>
  File "/var/packages/py3k/target/usr/local/lib/python3.8/site-packages/flexget/plugins/input/discover.py", line 293, in on_task_input
    entries = self.estimated(entries, estimation_mode)
              │    │         │        └ {'optimistic': '120 days', 'mode': 'strict'}
              │    │         └ [<Entry(title=Deadpool 3,state=undecided)>, <Entry(title=The Expendables 4,state=undecided)>, <Entry(title=The Suicide Squad ...
              │    └ <function Discover.estimated at 0x7f2cfa33c310>
              └ <flexget.plugins.input.discover.Discover object at 0x7f2cf8ced280>
  File "/var/packages/py3k/target/usr/local/lib/python3.8/site-packages/flexget/plugins/input/discover.py", line 183, in estimated
    est_date = estimator.estimate(entry)
               │         │        └ <Entry(title=She and Her Cat (1999),state=undecided)>
               │         └ <function EstimateRelease.estimate at 0x7f2cfa0f23a0>
               └ <flexget.components.estimate_release.estimate_release.EstimateRelease object at 0x7f2cf8c9eee0>
  File "/var/packages/py3k/target/usr/local/lib/python3.8/site-packages/flexget/components/estimate_release/estimate_release.py", line 30, in estimate
    estimate = estimator(entry)
               │         └ <Entry(title=She and Her Cat (1999),state=undecided)>
               └ <bound method EstimatesMoviesBluray.estimate of <flexget.components.estimate_release.estimators.est_movies_bluray.EstimatesMo...
  File "/var/packages/py3k/target/usr/local/lib/python3.8/site-packages/flexget/components/estimate_release/estimators/est_movies_bluray.py", line 31, in estimate
    movie = lookup(title=movie_name, year=movie_year, session=session)
            │            │                │                   └ <sqlalchemy.orm.session.ContextSession object at 0x7f2cf487fc40>
            │            │                └ 1999
            │            └ 'She and Her Cat'
            └ <function ApiBluray.lookup at 0x7f2cfa235550>
  File "/var/packages/py3k/target/usr/local/lib/python3.8/site-packages/flexget/plugins/internal/api_bluray.py", line 262, in lookup
    movie = BlurayMovie(title=title, year=year)
            │                 │           └ 1999
            │                 └ 'She and Her Cat'
            └ <class 'flexget.plugins.internal.api_bluray.BlurayMovie'>
  File "<string>", line 4, in __init__
  File "/var/packages/py3k/target/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/state.py", line 480, in _initialize_instance
    manager.dispatch.init_failure(self, args, kwargs)
    │       │        │            │     │     └ {}
    │       │        │            │     └ ('She and Her Cat', 1999)
    │       │        │            └ <sqlalchemy.orm.state.InstanceState object at 0x7f2cf42b3520>
    │       │        └ <member 'init_failure' of 'InstanceEventsDispatch' objects>
    │       └ <sqlalchemy.event.base.InstanceEventsDispatch object at 0x7f2cfa2a04c0>
    └ <ClassManager of <class 'flexget.plugins.internal.api_bluray.BlurayMovie'> at 7f2cfa29f950>
  File "/var/packages/py3k/target/usr/local/lib/python3.8/site-packages/sqlalchemy/util/langhelpers.py", line 70, in __exit__
    compat.raise_(
    │      └ <function raise_ at 0x7f2cfd93b670>
    └ <module 'sqlalchemy.util.compat' from '/var/packages/py3k/target/usr/local/lib/python3.8/site-packages/sqlalchemy/util/compat...
  File "/var/packages/py3k/target/usr/local/lib/python3.8/site-packages/sqlalchemy/util/compat.py", line 207, in raise_
    raise exception
  File "/var/packages/py3k/target/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/state.py", line 477, in _initialize_instance
    return manager.original_init(*mixed[1:], **kwargs)
           │       │              │            └ {}
           │       │              └ (<sqlalchemy.orm.state.InstanceState object at 0x7f2cf42b3520>, <flexget.plugins.internal.api_bluray.BlurayMovie object at 0x...
           │       └ <function BlurayMovie.__init__ at 0x7f2cfa2a03a0>
           └ <ClassManager of <class 'flexget.plugins.internal.api_bluray.BlurayMovie'> at 7f2cfa29f950>
  File "/var/packages/py3k/target/usr/local/lib/python3.8/site-packages/flexget/plugins/internal/api_bluray.py", line 87, in __init__
    response = bluray_request('quicksearch/search.php', **params)
               │                                          └ {'section': 'bluraymovies', 'country': 'ALL', 'keyword': 'She and Her Cat', '_': '1627938063867'}
               └ <function bluray_request at 0x7f2cf9faec10>
  File "/var/packages/py3k/target/usr/local/lib/python3.8/site-packages/flexget/plugins/internal/api_bluray.py", line 37, in bluray_request
    return response.json(strict=False)
           │        └ <function Response.json at 0x7f2cfdf7ab80>
           └ <Response [200]>
  File "/var/packages/py3k/target/usr/local/lib/python3.8/site-packages/requests/models.py", line 900, in json
    return complexjson.loads(self.text, **kwargs)
           │           │     │    │       └ {'strict': False}
           │           │     │    └ <property object at 0x7f2cfdf76db0>
           │           │     └ <Response [200]>
           │           └ <function loads at 0x7f2d010d44c0>
           └ <module 'json' from '/var/packages/py3k/target/usr/local/lib/python3.8/json/__init__.py'>
  File "/var/packages/py3k/target/usr/local/lib/python3.8/json/__init__.py", line 370, in loads
    return cls(**kw).decode(s)
           │     │          └ 'ï»¿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">...
           │     └ {'strict': False}
           └ <class 'json.decoder.JSONDecoder'>
  File "/var/packages/py3k/target/usr/local/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               │    │          │      │  └ 'ï»¿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">...
               │    │          │      └ <built-in method match of re.Pattern object at 0x7f2d0158f570>
               │    │          └ 'ï»¿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">...
               │    └ <function JSONDecoder.raw_decode at 0x7f2d010c1dc0>
               └ <json.decoder.JSONDecoder object at 0x7f2cf4b10130>
  File "/var/packages/py3k/target/usr/local/lib/python3.8/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
          │                                  └ 'ï»¿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">...
          └ <class 'json.decoder.JSONDecodeError'>

json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):
  File "/var/packages/py3k/target/usr/local/lib/python3.8/site-packages/flexget/task.py", line 547, in __run_plugin
    result = method(*args, **kwargs)
  File "/var/packages/py3k/target/usr/local/lib/python3.8/site-packages/flexget/event.py", line 20, in __call__
    return self.func(*args, **kwargs)
  File "/var/packages/py3k/target/usr/local/lib/python3.8/site-packages/flexget/plugins/input/discover.py", line 293, in on_task_input
    entries = self.estimated(entries, estimation_mode)
  File "/var/packages/py3k/target/usr/local/lib/python3.8/site-packages/flexget/plugins/input/discover.py", line 183, in estimated
    est_date = estimator.estimate(entry)
  File "/var/packages/py3k/target/usr/local/lib/python3.8/site-packages/flexget/components/estimate_release/estimate_release.py", line 30, in estimate
    estimate = estimator(entry)
  File "/var/packages/py3k/target/usr/local/lib/python3.8/site-packages/flexget/components/estimate_release/estimators/est_movies_bluray.py", line 31, in estimate
    movie = lookup(title=movie_name, year=movie_year, session=session)
  File "/var/packages/py3k/target/usr/local/lib/python3.8/site-packages/flexget/plugins/internal/api_bluray.py", line 262, in lookup
    movie = BlurayMovie(title=title, year=year)
  File "<string>", line 4, in __init__
  File "/var/packages/py3k/target/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/state.py", line 480, in _initialize_instance
    manager.dispatch.init_failure(self, args, kwargs)
  File "/var/packages/py3k/target/usr/local/lib/python3.8/site-packages/sqlalchemy/util/langhelpers.py", line 70, in __exit__
    compat.raise_(
  File "/var/packages/py3k/target/usr/local/lib/python3.8/site-packages/sqlalchemy/util/compat.py", line 207, in raise_
    raise exception
  File "/var/packages/py3k/target/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/state.py", line 477, in _initialize_instance
    return manager.original_init(*mixed[1:], **kwargs)
  File "/var/packages/py3k/target/usr/local/lib/python3.8/site-packages/flexget/plugins/internal/api_bluray.py", line 87, in __init__
    response = bluray_request('quicksearch/search.php', **params)
  File "/var/packages/py3k/target/usr/local/lib/python3.8/site-packages/flexget/plugins/internal/api_bluray.py", line 37, in bluray_request
    return response.json(strict=False)
  File "/var/packages/py3k/target/usr/local/lib/python3.8/site-packages/requests/models.py", line 900, in json
    return complexjson.loads(self.text, **kwargs)
  File "/var/packages/py3k/target/usr/local/lib/python3.8/json/__init__.py", line 370, in loads
    return cls(**kw).decode(s)
  File "/var/packages/py3k/target/usr/local/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/var/packages/py3k/target/usr/local/lib/python3.8/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
```
</details>

### Additional information:

- FlexGet version: 3.1.133
- Python version: 3.8.6
- Installation method: pip
- Using daemon (yes/no): yes
- OS and version: Synology DSM 6



Discussion:

Resolving patch:
diff --git a/flexget/plugins/internal/api_bluray.py b/flexget/plugins/internal/api_bluray.py
--- a/flexget/plugins/internal/api_bluray.py
+++ b/flexget/plugins/internal/api_bluray.py
@@ -1,5 +1,6 @@
 import time
 from datetime import date, datetime, timedelta
+from json.decoder import JSONDecodeError
 from typing import Any, Dict, Optional
 
 from dateutil.parser import parse as dateutil_parse
@@ -11,6 +12,7 @@
 
 from flexget import db_schema, plugin
 from flexget.event import event
+from flexget.plugin import PluginError
 from flexget.utils import requests
 from flexget.utils.database import year_property
 from flexget.utils.soup import get_soup
@@ -34,7 +36,10 @@ def bluray_request(endpoint, **params) -> Any:
     full_url = BASE_URL + endpoint
     response = requests.get(full_url, params=params)
     if response.content:
-        return response.json(strict=False)
+        try:
+            return response.json(strict=False)
+        except JSONDecodeError as e:
+            raise PluginError('Could decode json from response blu-ray api')
 
 
 def extract_release_date(bluray_entry: Dict[str, Any]) -> date:


Test patch: