title: Issues with re and TypeError: expected string or bytes-like object
body: <p>I'm using the Teleport API to produce heatmaps of different stats about cities when searched, but I'm having trouble with the whole using re to get something from what I got. So here's what I'm trying to search.</p>
  <p>So once I put in the city, I would get something like this:</p>
  <pre><code>{'_embedded': {'city:search-results': [{'_links': {'city:item': {'href': 'https://api.teleport.org/api/cities/geonameid:5809844/'}},
  </code></pre>
  <p>So my entire code, including the re, which is causing my computer issues, is:</p>
  <pre><code>area = input(&quot;What's the city you'd like to see? &quot;)
  area = area.lower()
  area = area.replace(' ','-')
  
  if area == 'new-york-city':
      area = 'new-york'
  
  with urllib.request.urlopen('https://api.teleport.org/api/cities/?search='+area) as url:
      #This brings in the info from the API.
      api = json.loads(url.read().decode()) #This decodes the info coming in.
      id = re.search('^geonameid:',api)
      id = str(id)
  api
  </code></pre>
  <p>And the error is that was the type error I got in the beginning. I think I just figured it out that it was coming from the search itself, because I tried coercing it to a string in the second line, but I got an error even when I commented out that line.</p>
  <p>My second question is I'm not sure if I'm using the right code but I'm trying to find the first instance of the geonameid, as with common names, there could be others.</p>
  <p>Any suggestions? Thanks!</p>