I turn my iPod on to rock songs on shuffle and play to whatever song comes on and learn it. Stopping the song - turning it off and on at parts I'm not sure of and going over 'em until I've close to nailed 'em. Repeat thru the song 'til I can play licks and passages competently. And then going thru the whole song 'til I've got it nailed. With certain licks I'll either learn 'em, approximate 'em, or make my own. Riffs I'll learn pretty darn faithfully.
More advanced ---> then I'll dial up a streaming rock station and play whatever comes up cold. What I'm listening for is chord qualities ( = Major, minor, Dom, dim) and chord progressions = what chord follows what chord. There are a bunch of standard "progressions" you hesr again and again that will become really familiar.
1. Mostly what you will hear in rock bass lines is chord roots (a LOT) and fifths of the chord. Then prolly thirds (Major? minor?). Then 7ths usually minor (also called "flat")). then 6ths.
2. Mostly
in a Key you're going to hear I* (Tonic, root), then a V7 (also called Dom = major triad 1, 3, 5, with a minor (also called flat) 7th.) Then the IV. chord. In rock next you'll probably hear a vi*, or a iii, or
maybe a ii; or a bIII, or bVII, or a bVI. (b before a chord numeral = flat sign)
Have FUN! Play WHAT YOU HEAR and then play what you want to hear!! Easy peasy
*Note that some Roman numerals are upper case = which means Major chord (major 3rd)
some Roman numerals are lower case which indicates minor chord (minor [or "flat"] 3rd). Hint: Get a beginning theory book, or take a class (FUN!!!), or dial up Rick Beato, Michael New on YouTube.

☮