When our son first started getting homework and then having to revise for end of year tests in year one, we really struggled to get him motivated, and we'd often find him "studying" youtube instead of his school work.
Rather than whinge at him and threaten the modem being turned off, we instead decided to be interactive and studied "with him", i.e. got him in the lounge with us, TV off, ipad off, and sat together working through stuff. I'd have his exercise book and ask him questions, once we'd found his weaknesses, we found online resources to bring him back up to speed. Worked really well and got him into the habit of homework and revision. More importantly, without the destractions, he realised how quickly he could do what he needed to, whereas when he used to be left to his own devices, in his mind, he'd spent a full evening and achieved little, when in reality, the actual "learning" time was probably less than half an hour!
We've now got in the habit of a homework hour evening evening, and homework mornings on Saturday and Sunday. The rest of the time is his own to do what he wants, but those specific times of day are ringfenced for nothing but school work. He goes into year 10 in September, and we've already agreed that his homework times will increase for year 10 and then increase again for year 11. He no longer needs us in the same room as him as he's in the habit of working during the allotted times and doesn't try to cheat by using his ipad or watching TV during his homework time. Hopefully, that habit will continue through his GCSEs and A levels.