def get_data(url):
r = requests.get(url)
soup = BeautifulSoup(r.text, 'html.parser')
return soup
current_data = get_data(link)
x = current_data.find_all(text="Style Code:")
I’m trying to get the style code of a shoe off ebay but the problem is that it doesn’t have a specific class or any kind of unique identifier so I can’t just use find() to get the data. Currently I searched by text to find ‘Style Code:’ but how can I get to the next div? An example of a shoe product page would be this.
2
Answers
Try this,
Since there are lot’s of span is similar (with class
'ux-textspans'
) you need to iterate through it and find the next span after'Style Code:'