morrolinux / subito-it-searcher

searcher for subito.it
94 stars 35 forks source link

TypeError: can only concatenate str (not "Tag") to str #13

Closed gstru closed 2 years ago

gstru commented 2 years ago

When the price doesn't exist the script should save the price as unknown in the json file. Instead it scrapes the span tag and prints concatenation error.

image

A quick solution could be to check the variable.

from bs4 import BeautifulSoup, Tag

price_soup = BeautifulSoup(price, 'html.parser')
if type(price_soup == Tag)
morrolinux commented 2 years ago

Hi, This project is no longer maintained but you can of course make a PR with your tested solution ad I'll just merge it :) Thank you