morrolinux / subito-it-searcher

searcher for subito.it
100 stars 36 forks source link

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

Closed gstru closed 3 years ago

gstru commented 3 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 3 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