If you inspect the element you are interpreting the source from the browsers eyes...and if its not there with python, then it means its javascript. You would have to get the source with selenium first before handing it off to BeaufitulSoup
for example
for example
from bs4 import BeautifulSoup from selenium import webdriver import time import os url = 'http://www.publi24.ro/anunturi/locuri-de-munca/anunt/Echipa-Tehnician-Alpinist-Telecom/7b00667478616b51.html' def setup(): ''' setup webdriver and create browser ''' #https://chromedriver.storage.googleapis.com/index.html #https://chromedriver.storage.googleapis.com/index.html?path=2.25/ ##latest chromedriver = "/home/metulburr/chromedriver" #the path to the chromedriver os.environ["webdriver.chrome.driver"] = chromedriver browser = webdriver.Chrome(chromedriver) return browser browser = setup() browser.get(url) time.sleep(2) soup = BeautifulSoup(browser.page_source, 'lxml') tag = soup.find('span', {'add-view':'18230886'}) print(tag.text) browser.quit()
Output:$ python test.py
16
Although this will pop a browser up for a couple seconds. IF you want you can use a headless browser to keep it in the background.
Recommended Tutorials: