I'm trying to create a web crawler and I need to get links from a website. First I planned to use regex but I found lots of comments about BS and making everything easier. Currently I'm stuck because website I want to parse has more complicated structure than tutorials and I can't find a good way to get only the links I'm interested in.
The webpage I'm tying to parse: HERE
What's making it hard is the fact that I don't want to get links from premium ads (they have yellow background). To go around that I've used title at top of regular ads.
Also links don't start with http but just /rel/link
This returns the part of website I'm interested in but it's type is <class 'bs4.element.Tag'> and I have no idea what to do next. I guess I'm missing something really simple that would extract links from that but any solution is welcome. I would try to find regex to extract it but that would cause lots of duplicates because link is on img and title.
The webpage I'm tying to parse: HERE
What's making it hard is the fact that I don't want to get links from premium ads (they have yellow background). To go around that I've used title at top of regular ads.
Also links don't start with http but just /rel/link
Code
from bs4 import BeautifulSoup
import requests
import re
url = 'http://www.njuskalo.hr/prijenosna-racunala/'
page = requests.get(url)
prefix = "http://www.njuskalo.hr"
soup = BeautifulSoup(page.content, 'html.parser')
#title = soup.find('title').text
letters = soup.find_all("h3", class_="EntityList-groupTitle")
lista = letters[2].next_sibling
lista = lista.next_sibling
print(lista)This returns the part of website I'm interested in but it's type is <class 'bs4.element.Tag'> and I have no idea what to do next. I guess I'm missing something really simple that would extract links from that but any solution is welcome. I would try to find regex to extract it but that would cause lots of duplicates because link is on img and title.


