Repository: pymedusa/Medusa

Issue:
[APP SUBMITTED]: TypeError: cannot use a string pattern on a bytes-like object

### INFO
**Python Version**: `3.7.2 (default, Jan  3 2019, 02:55:40) [GCC 8.2.0]`
**Operating System**: `Linux-4.9.35-v7+-armv7l-with-debian-buster-sid`
**Locale**: `UTF-8`
**Branch**: [develop](../tree/develop)
**Database**: `44.14`
**Commit**: pymedusa/Medusa@18bd87dded99e1ecfbeae7757e226ea5510e0f96
**Link to Log**: https://gist.github.com/4421b6f5dd716b24746e97ed3008b0c4
### ERROR
<pre>
2019-02-10 19:30:40 ERROR    SNATCHQUEUE-SNATCH-526 :: [18bd87d] Snatch failed! For result: The.Office.(US).S03.1080p.WEB-DL.AAC2.0.AVC-TrollHD
Traceback (most recent call last):
  File "/home/pi/Medusa/<a href="../blob/18bd87dded99e1ecfbeae7757e226ea5510e0f96/medusa/search/queue.py#L503">medusa/search/queue.py</a>", line 503, in run
    self.success = snatch_episode(result)
  File "/home/pi/Medusa/<a href="../blob/18bd87dded99e1ecfbeae7757e226ea5510e0f96/medusa/search/core.py#L132">medusa/search/core.py</a>", line 132, in snatch_episode
    nzb_data = result.provider.download_nzb_for_post(result)
  File "/home/pi/Medusa/<a href="../blob/18bd87dded99e1ecfbeae7757e226ea5510e0f96/medusa/providers/nzb/binsearch.py#L275">medusa/providers/nzb/binsearch.py</a>", line 275, in download_nzb_for_post
    if not BinSearchProvider.nzb_check_segment.search(response.content):
TypeError: cannot use a string pattern on a bytes-like object
</pre>
---
_STAFF NOTIFIED_: @pymedusa/support @pymedusa/moderators



Discussion:
You still using binsearch? 
https://stackoverflow.com/questions/44457455/python3-regex-on-bytes-variable
Change this regex to use `rb` or `br` prefix instead of the `r` prefix
https://github.com/pymedusa/Medusa/blob/18bd87dded99e1ecfbeae7757e226ea5510e0f96/medusa/providers/nzb/binsearch.py#L32
This is the only regex that needs it because it's the only one being tested against the raw `response.content`.
Yeah still using it @p0psicles 
I'll test that @sharkykh 

### INFO
**Python Version**: `3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 23:09:28) [MSC v.1916 64 bit (AMD64)]`
**Operating System**: `Windows-10-10.0.17134-SP0`
**Locale**: `cp1252`
**Branch**: [develop](../tree/develop)
**Database**: `44.14`
**Commit**: pymedusa/Medusa@737d073fecac5fad8ae10c229c81d4fd3c6bbd4e
**Link to Log**: **No Log available**
### ERROR
<pre>
2019-02-12 10:06:26 ERROR    SNATCHQUEUE-SNATCH-21656 :: [737d073] Snatch failed! For result: Dynasty.S02E13.The.Hearing.DVDRip.XviD-SAiNTS.avi
Traceback (most recent call last):
  File "C:\Medusapy3\<a href="../blob/737d073fecac5fad8ae10c229c81d4fd3c6bbd4e/medusa/search/queue.py#L503">medusa\search\queue.py</a>", line 503, in run
    self.success = snatch_episode(result)
  File "C:\Medusapy3\<a href="../blob/737d073fecac5fad8ae10c229c81d4fd3c6bbd4e/medusa/search/core.py#L132">medusa\search\core.py</a>", line 132, in snatch_episode
    nzb_data = result.provider.download_nzb_for_post(result)
  File "C:\Medusapy3\<a href="../blob/737d073fecac5fad8ae10c229c81d4fd3c6bbd4e/medusa/providers/nzb/binsearch.py#L275">medusa\providers\nzb\binsearch.py</a>", line 275, in download_nzb_for_post
    if not BinSearchProvider.nzb_check_segment.search(response.content):
TypeError: cannot use a string pattern on a bytes-like object
</pre>
---
_STAFF NOTIFIED_: @pymedusa/support @pymedusa/moderators


Resolving patch:
diff --git a/medusa/providers/nzb/binsearch.py b/medusa/providers/nzb/binsearch.py
--- a/medusa/providers/nzb/binsearch.py
+++ b/medusa/providers/nzb/binsearch.py
@@ -272,7 +272,7 @@ def download_nzb_for_post(self, result):
             return None
 
         # Validate that the result has the content of a valid nzb.
-        if not BinSearchProvider.nzb_check_segment.search(response.content):
+        if not BinSearchProvider.nzb_check_segment.search(response.text):
             log.warning('Result returned from BinSearch was not a valid NZB')
             return None
 


Test patch: