I haven’t noticed it recently, but there is - or used to be - a phrase put at the front of many books, saying that it was only permissible to quote brief (i.e., a few sentences) portions of it, and that only for purposes of reviewing it, or some such. With an author who is zealous about his/her copyright, you can get in big legal trouble for quoting a large portion of something they’ve written, unless they’ve indicated something different under “fair use”.
I can think of a couple of fiction authors who have attorneys on retainer for the explicit purpose of going after people who quote anything more than a brief passage from their works. You won’t see fanfic online based on their characters - or at least not for very long - because as soon as they learn about it, there’s a lawsuit.
Not only isn’t it legal, it ain’t safe (from a financial perspective) to quote someone else’s writing without permission, even with attribution. Most authors live on the proceeds of their writing. It’s their job, IOW. And if you steal some of their work, you’re stealing money, as far as they’re concerned, and a great many of them will go after you, big time.
There is a new kind of semi-copyright. I can’t recall the exact name for it, but it gives certain broader rights for use of the work. But anything that has that limited protection will be clearly marked as such.
As for how it’s different on the web, have you forgotten the Hollywood writers strike? The whole thing was about how much they got paid for stuff they wrote that studios put online. Think about it: Can you blame them? Would you like someone to rip off some of your paycheck?
Eureka mentioned “rare stuff”. That would be things that are “Out Of Print”. More and more stuff that’s OOP is now in Google’s library, and there are several sites that have texts that are so old they’re out of copyright, or were written before there were copyright laws (e.g., the Gutenberg site). You’re probably safe enough quoting any of those, so long as you attribute it (it’s plagiarism otherwise; that’s what killed Joe Biden’s first run for president). But it is better - and it’s SOP for anybody who ever paid attention in HS English classes - to give a citation (to tell who it’s by and where it’s found). It will help you keep from looking ignorant, too.