pip install bs4
. а также requests pip install requests
, через Win+R или cmditem = soup.find('a', class_="sih-inspect-magnifier")
print(item[href])
If you look at the source code for the page, you'll see that some javascript generates the webpage. What you see in the element browser is the webpage after the script has been run, and beautifulsoup just gets the html file. In order to parse the rendered webpage you'll need to use something like Selenium to render the webpage for you.
So, for example, this is how it would look with Selenium:
from bs4 import BeautifulSoup import selenium.webdriver as webdriver url = 'http://instagram.com/umnpics/' driver = webdriver.Firefox() driver.get(url) soup = BeautifulSoup(driver.page_source) for x in soup.findAll('li', {'class':'photo'}): print x
soup.findAll('li', {'class':'photo'})
меняете на ваши нужды <span class="post-stats__comments-count" title="Читать комментарии">21</span>
import requests
from bs4 import BeautifulSoup
pageURL = "https://habr.com/ru/post/442800/"
req = requests.get(pageURL)
soup = BeautifulSoup(req.content, 'html.parser')
comments = soup.find('span', {'class': 'post-stats__comments-count'}).get_text()
print('Количество комментариев на '+ pageURL + ' : ' +comments)
var content = {
'data': [["users","<div class='dev_status_okay'>Working<\/div>",14,100.000000],
["friends","<div class='dev_status_okay'>Working<\/div>",18,100.000000],
["groups","<div class='dev_status_okay'>Working<\/div>",17,100.000000],
["photos","<div class='dev_status_okay'>Working<\/div>",19,100.000000],
["video","<div class='dev_status_okay'>Working<\/div>",84,100.000000],
["messages","<div class='dev_status_okay'>Working<\/div>",31,100.000000],
["wall","<div class='dev_status_okay'>Working<\/div>",111,100.000000],
["newsfeed","<div class='dev_status_okay'>Working<\/div>",46,100.000000],
["notes","<div class='dev_status_okay'>Working<\/div>",67,100.000000],
["likes","<div class='dev_status_okay'>Working<\/div>",19,100.000000],
["pages","<div class='dev_status_okay'>Working<\/div>",26,100.000000]],
'header': ['Methods category', 'Status', 'Performance', 'Uptime']
};
Well, the thing is the sqlite3 module doesn't likes multithread cases, you can see that in the sqlite3 module's documentation
...the Python module disallows sharing connections and cursors between threads[1]