title: How to accept Youtube cookies with Python requests module
body: <p>I am new to Python and HTTP. For exercise I have created the small function that searches Youtube and returns search results in response object</p>
  <pre><code>def search_yt():
      import requests
      url = 'https://www.youtube.com/results'
      query_string = str(input('Please enter search keyword: '))
      payload = {'search_query': query_string}
      r = requests.get(url, params=payload)
      print(r.text)
  </code></pre>
  <p>The problem is that i am being redirected to a cookie acceptance page with an Accept button. Here is the form</p>
  <pre><code>&lt;form action=&quot;https://consent.youtube.com/s&quot; method=&quot;POST&quot; style=&quot;display:inline;&quot;&gt;
  &lt;input type=&quot;hidden&quot; name=&quot;gl&quot; value=&quot;NO&quot;&gt;
  &lt;input type=&quot;hidden&quot; name=&quot;m&quot; value=&quot;0&quot;&gt;
  &lt;input type=&quot;hidden&quot; name=&quot;pc&quot; value=&quot;yt&quot;&gt;
  &lt;input type=&quot;hidden&quot; name=&quot;continue&quot; value=&quot;https://www.youtube.com/results?search_query=Michael+Jackson&quot;&gt;
  &lt;input type=&quot;hidden&quot; name=&quot;ca&quot; value=&quot;r&quot;&gt;&lt;input type=&quot;hidden&quot; name=&quot;x&quot; value=&quot;8&quot;&gt;
  &lt;input type=&quot;hidden&quot; name=&quot;v&quot; value=&quot;cb.20210518-05-p0.no+FX+161&quot;&gt;
  &lt;input type=&quot;hidden&quot; name=&quot;t&quot; value=&quot;ADw3F8jK04hHEDaOQ6Lo4k3iEAJmnGpVoQ:1621602104080&quot;&gt;
  &lt;input type=&quot;hidden&quot; name=&quot;hl&quot; value=&quot;no&quot;&gt;&lt;input type=&quot;hidden&quot; name=&quot;src&quot; value=&quot;1&quot;&gt;
  &lt;input type=&quot;hidden&quot; name=&quot;uxe&quot; value=&quot;23983172&quot;&gt;&lt;input type=&quot;submit&quot; value=&quot;Godta&quot; class=&quot;button&quot; aria-label=&quot;Godta bruken av informasjonskapsler og andre data for formålene som beskrives&quot;/&gt;
  &lt;/form&gt;
  </code></pre>
  <p>How do I go past this page?</p>