title: Variable Undefined in Python Script
body: <p>I wanted to download Thumbnails from a channel and I was using this Script that I found on GitHub.
  <a href="https://github.com/rohitnairtech/YoutubeChannelAllVideoThumbnailDownloader" rel="nofollow noreferrer">https://github.com/rohitnairtech/YoutubeChannelAllVideoThumbnailDownloader</a></p>
  
  <p>So in line : <code>pageCount +=1</code>     it says undefined variable</p>
  
  <p>Also a HTTP Bad Request When Script Runs.I was just thinking I will tackle it one by one if this Undefined variable could be sorted out first.</p>
  
  <p>I have replaced the required section with my Youtube API and ChannelID.
  I am not a python programmer so I don't know how global variables work here or what could be a the solution to this.
  I read somethings on Globals but couldn't find a proper explanation of what the problem here is.
  <a href="https://i.stack.imgur.com/ahFQV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ahFQV.png" alt="enter image description here"></a></p>
  
  <pre><code>def setURL (nextPage):
      sleep(4)
      global pageCount
      pageCount += 1 #Error Here
  </code></pre>
  
  <p>This code should download and store the thumbnails in a thumbnails folder that it automatically creates at root directory of script.</p>
  
  <p>EDIT1:
  pageCount is already defined in line 55 just before calling setURL shouldn't that work ?
  Answer by Chetan Solves this Questions (That simple).
  <a href="https://i.stack.imgur.com/Iey8z.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Iey8z.png" alt="Image 2 Code"></a></p>
  
  <p>EDIT2:
  ERROR Log after running the code:
  These are self destruct links after use.</p>
  
  <pre><code>https://file.io/rE6BdY
  
   https://file.io/d9fyJb
  
   https://file.io/XsOXMw
  
   https://file.io/hrWZBS
  </code></pre>