Reputation: 65
I am practicing about web-scraping with Python.
And I have a problem because of the structure of webpage.
There are two <a>
in same list class.
I want to extract just link of the post. And I want to know how can I extract this link without touching another one.
Now, I write the code like this:
def extract_job(post):
title = post.find("span", {"class": "title"})
company = post.find("span", {"class": "company"})
location = post.find("span", {"class": "region"})
link = post.find
What do I have to put after find function?
Upvotes: 0
Views: 71
Reputation: 83
Instead of using the find method you can do it using css selectors with the select method. In the inspector if you right click on the element you want to find the selector for and click copy selector you can copy the selector and use that in your code.
link = post.select(put the copied selector here)
Upvotes: 1