Web Scraping From Strong Tag
How do i pull the data from the strong tag? I have tried soup.find('strong') and soup.find('div', class_='store-views') but it either comes up with the wrong data or 'None'
Solution 1:
That value is dynamically added, possibly from google analytics. You can use selenium to automate browser so you can capture this value when added:
from selenium import webdriver
d = webdriver.Chrome()
d.get('https://store.bricklink.com/legoseller9997&utm_content=globalnav#/shop')
print(d.find_element_by_css_selector('.store-views strong').text)
d.quit()
The other data comes from an ajax request:
import requests
r = requests.get('https://store.bricklink.com/ajax/clone/store/searchitems.ajax?showHomeItems=1&sid=1663355', headers= {'User-Agent':'Mozilla/5.0'}).json()
print(r)
Post a Comment for "Web Scraping From Strong Tag"