I go to confession once a week. I would go more often if it were reasonable for me. So don’t let that be a mental block.
My standard advice on this:
There are monitoring programs (like Covenant Eyes) that can help with controlling electronic media. You could try using that with a trusted friend or mentor. Other than that, you need to put distance between yourself and the occasion of sin - keep windows and doors open, take cold showers, reduce (or eliminate temporarily) alcohol use around certain people/in certain situations, etc. Laughing more is also helpful, especially in the moment of temptation (rational delight filling the body - so watch more comedy!) as is fasting and other mild discomfort which distracts the body (holding your breath, biting your tongue, etc.)… just getting up and walking around can also give the space and time necessary to get a grip. Exercise also helps, in various ways, also in the moment… distracting and exhausting the body. Instinctively praying a decade of the rosary (meditating especially on one of the sorrowful mysteries) or singing a verse of a pious hymn will also create the time and strength of will you need to do what is right. Meditate also in the moment on the imminence of death, and always ask for the help of the Blessed Virgin Mary and St. Joseph… and ask the Lord always for the help you need. Go to confession as needed, then return to receiving Holy Communion.
And DO NOT DESPAIR!