title: Scraping an onclick value in BeautifulSoup in Pandas
body: <p>For class, we've been asked to scrape the North Koren News Agency's website: <a href="http://kcna.kp/kcna.user.home.retrieveHomeInfoList.kcmsf" rel="nofollow noreferrer">http://kcna.kp/kcna.user.home.retrieveHomeInfoList.kcmsf</a></p>
  <p>The question asks to scrape the <code>onclick</code> values for the website. I've tried solving this in two different ways: by navigating the DOM tree. And by building a regex within a lop to systematically pull them out. I've failed on both counts.</p>
  <p>Attempt1:</p>
  <pre><code>onclick_soup = soup_doc.find_all('a', class_='titlebet')[0]
  onclick_soup
  </code></pre>
  <p>Output:</p>
  <pre><code>&lt;a class=&quot;titlebet&quot; href=&quot;#this&quot; onclick='fn_showArticle(&quot;AR0140322&quot;,
  &quot;&quot;, &quot;NT00&quot;, &quot;L&quot;)'&gt;경애하는 최고령도자 &lt;nobr&gt;&lt;strong&gt;&lt;font
  style=&quot;font-size:10pt;&quot;&gt;김정은&lt;/font&gt;&lt;/strong&gt;&lt;/nobr&gt;동지께서 라오스인민혁명당 중앙위원회
  총비서인 라오스인민민주주의공화국 주석에게 축전을 보내시였다&lt;/a&gt;
  </code></pre>
  <p>Attempt2:</p>
  <pre><code>regex_for_onclick_soup = r&quot;onclick='(.*?)\(&quot; onclick_value_soup =
  soup_doc.find_all('a', class_='titlebet') for onclick_value in
  onclick_value_soup: value =
  re.findall(regex_for_onclick_value,onclick_value) print(onclick_value)
  </code></pre>
  <p>Attempt2 results in a <code>TypeError</code></p>
  <p>I'm doing this in pandas. Any guidance would be helpful.</p>