DrKain/scrape-youtube

Explicit Content Filter

Closed this issue · 6 comments

Adult Content Filter
I looked on all sites and docs but was unable to find a filter for Explicit Content

You should add this feature

Can you provide an example?

Can you provide an example?

Like the 18+ content filter that would filter the 18+ content from the results

I had not seen this option before but I after some digging this should do what you want:

import { youtube } from 'scrape-youtube';

const options = {
    requestOptions: {
        // Enable YouTube's restricted mode
        // https://support.google.com/youtube/answer/174084
        headers: { Cookie: 'PREF=f2=8000000' }
    }
}

youtube.search('Fuck away the pain', options);
// No Results because of the explicit song
youtube.search('Tiger boo', options);
// 20 results for a child-friendly video
youtube.search('Fuck away the pain');
// 20 results without a cookie used

Bro that doesn't seems to be working i am attaching an attachment
Like it works for few search but not all whole

well do you know some api or method to check a youtube link for NSFW content ?
Screenshot 2021-12-11 120951

That song doesn't fit YouTube's content filter. YouTube's filter works based on the content of the video and language used in the video, in the case of the song you linked it's provocative at most. The word "sexual" isn't enough to merit a blacklist.

If you are worried about results containing explicit words you might need to compile a list of words you consider 'bad' and filter them yourself.
However, this will cause other problems. Tom Scott explains this pretty well in his "Why Web Filters Don't Work" video

I'm going to mark this issue as closed because in the scope of this package I've provided you with a viable solution.
There's not much more help I can offer here, other than what I've already told you in the previous comments.