I'm not an expert on Barcelona but I'll tell you the most direct way is to search in rental Facebook groups in the city, owners post there a lot without intermediaries and you avoid commissions. Also try platforms like Booking (which sometimes has hostels at good prices) or straight up on the hostels' own pages, because many offer discounts if you book directly with them instead of through agencies. You'll find something for less than 40 euros a night, but you gotta check carefully because sometimes something pops up and the next day it disappears, so don't trust the first ad you see without verifying it's legit.