title: Scraper Python and YouTube API
body: <p>would like to <strong>scrape</strong> youtube for some channels stats and lo learn how it works. And than to make csv for the following analysis. Used <a href="https://www.youtube.com/watch?v=5qtC-tsQ-wE" rel="nofollow noreferrer">this video</a> to create and to learn.</p>
  <p>I have 2 files:
  main.py, youtube_statistics</p>
  <p><strong>main.py</strong></p>
  <pre><code>from youtube_statistics import YTstats
  
  API_KEY = &quot;xxx&quot;
  channel_id = &quot;xxx&quot;
  
  yt = YTstats(API_KEY, channel_id)
  yt.get_channel_statistics()
  </code></pre>
  <p><strong>youtube_statistics.py</strong></p>
  <pre><code>class YTstats:
      def_init_(self, api_key, channel_id)
      self.api_key = api_key
      self.channel_id = channel_id
      self.channel_statistics = None
  
  
  def get_channel_statistics(self):
      url = f'https://www.googleapis.com/youtube/v3/channels?part=statistics&amp;id={self.channel_id}&amp;key={self.api_key}'
      print(url)
  </code></pre>
  <p>This is not all code, but tries to run main called errors:</p>
  <pre><code>Traceback (most recent call last):
    File &quot;D:/!Python/YouTube API/main.py&quot;, line 1, in &lt;module&gt;
      from youtube_statistics import YTstats
    File &quot;D:\!Python\YouTube API\youtube_statistics.py&quot;, line 1, in &lt;module&gt;
      class YTstats:
    File &quot;D:\!Python\YouTube API\youtube_statistics.py&quot;, line 2, in YTstats
      def_init_(self, api_key, channel_id)
  NameError: name 'def_init_' is not defined
  </code></pre>
  <p>What going wrong, how to fix? On video everything is works.</p>
  <p>Thank you.</p>