Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to extract such text from javascript sentences in a html file by python
    text
    copied!<p>I'm new to web-scraping coding. I'm using python to parse the html files and the package I'm using is BeautifulSoup. Now I want to extract the certain numbers like the <code>1</code> in <code>$mwidgetHelper.setTitle('Posts (1)')</code>, the <code>1</code> in <code>$mwidgetHelper.setTitle('Notes (1)')</code>, and the text like the <code>user_638166_451203</code> in <code>hover_boxes.hoverize_link('user_638166_451203', 'user_profile')</code> under the <code>&lt;script&gt;</code> tag in this html file. The question is I'm not sure which methods I should use to parse these elements. The codes are below:</p> <pre><code>&lt;script&gt; newDiv = document.createElement("div"); newDiv.id = $mwidgetManager.getTitleId(); newDiv.className = 'mw_title widget_title ' + $mwidgetManager.getTitleId(); newDiv.innerHTML = "About Me"; $p('ppwt_1').appendChild(newDiv); $mwidgetHelper.setTitle('About kk'); $mwidgetManager.nextApp(); newDiv = document.createElement("div"); newDiv.id = $mwidgetManager.getTitleId(); newDiv.className = 'mw_title widget_title ' + $mwidgetManager.getTitleId(); newDiv.innerHTML = "Status"; $p('ppwt_11').appendChild(newDiv); $mwidgetHelper.setTitle('Posts (1)'); $mwidgetHelper.setSubtitle('&lt;a href=\"/user_posts/list/9\"&gt;See All&lt;\/a&gt;'); $mwidgetManager.nextApp(); $mwidgetHelper.setTitle('Notes (1)'); $mwidgetHelper.setSubtitle('&lt;a href=\"/notes/list/9\"&gt;See All&lt;\/a&gt;'); //&lt;![CDATA[ hover_boxes.hoverize_link('user_638166_451203', 'user_profile'); //]]&gt; &lt;/script&gt; </code></pre> <p>Thanks!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload