title: Extracting number of likes on Instagram post
body: <p>I am very new to coding, and I am trying to write a code in PyCharm that compares my followers to the people that liked and commented on my posts. The end goal is to get a list of the followers that have not interacted with a single post.</p>
  <p>I am getting stuck at the part where I have to extract the number of likes on a post. I've tried multiple things, but the only way I've gotten the code to work so far is by putting the number of likes in manually:</p>
  <pre><code>#extract likers &amp; commenters
  time.sleep(1)
  extractlikers = WebDriverWait(driver, 2).until(EC.element_to_be_clickable((By.CSS_SELECTOR, &quot;a[href*='liked']&quot;))).click()
  
  time.sleep(1.5)
  likedbywindow = WebDriverWait(driver, 2).until(EC.element_to_be_clickable((By.CSS_SELECTOR, &quot;div[style*='hidden auto']&quot;)))
  
  while True:
      driver.execute_script(
          'arguments[0].scrollTop = arguments[0].scrollTop + arguments[0].offsetHeight;',
          likedbywindow)
  
      listoflikers = driver.find_elements(By.CSS_SELECTOR, &quot;a[class='_7UhW9   xLCgt        qyrsm KV-D4           se6yk       T0kll ']&quot;)
      numberoflikers = len(listoflikers)
      if (numberoflikers == 23):
          break
  </code></pre>
  <p>How can I replace the '23' so that I don't have to adjust the number manually for every post?</p>
  <p>Thanks in advance!</p>
  <p>UPDATE:
  Here's the URL of the post:
  <a href="https://www.instagram.com/p/CaFzLHuMhW6/" rel="nofollow noreferrer">https://www.instagram.com/p/CaFzLHuMhW6/</a></p>
  <p>HTML from element:</p>
  <pre><code>&lt;div class=&quot;_7UhW9   xLCgt        qyrsm KV-D4              fDxYl    T0kll &quot;&gt;&lt;span&gt;22&lt;/span&gt; others&lt;/div&gt;
  </code></pre>