title: Obtaining the number of comments of a list of youtube videos
body: <p>I have been coding a simple python script for obtaining number of views and number of comments of a list of videos. Using csv, I have converted a tab-separated table into a list of lists, and then I tried to obtain both elements. Inspecting number of views, the element is <code>"div", {"class":"watch-view-count"}</code>. It works as intended</p>
  
  <pre><code>r = requests.get(list_youtube_reading[n][0]) # it retrieves each video URL from a csv
  soup = BeautifulSoup(r.text)
  for element in soup.findAll("div", {"class":"watch-view-count"}): 
      patternviews = re.compile('^(.*?) .*') 
      scissorviews = patternviews.match(element.text.encode("utf-8")) 
      views = re.sub('\.','', tijeraviews.group(1))
  </code></pre>
  
  <p>However, element for number of comments is
      <code>&lt;h2 class="comment-section-header-renderer" tabindex="0"&gt;</code>
      <code>&lt;b&gt;Comments&lt;/b&gt;</code>
      <code>" • 6"</code>
      <code>&lt;span class="alternate-content-link"&gt;&lt;/span&gt;</code><br>
      <code>&lt;/h2&gt;</code></p>
  
  <p>When I tried to obtain it, with</p>
  
  <pre><code>for element in soup.findAll("h2", {"class":"comment-section-header-renderer"}):
      comments = element.text.encode("utf-8")
      print comments
  </code></pre>
  
  <p>nothing happens, and actually <code>soup</code>doesn't contain any <code>&lt;h2 class="comment-section-header-renderer" tabindex="0"&gt;</code> tag</p>
  
  <p>What can I do in order to retrieve number of comments? I tried to use youtube v3 data API, but for no avail</p>
  
  <p>thanks in advance</p>