touhidurrr / iplist-youtube

An attempt to list all Youtube IPs at one place.
BSD 3-Clause "New" or "Revised" License
166 stars 36 forks source link

IPv4 range list #6

Closed realgooseman closed 9 months ago

realgooseman commented 9 months ago

Hi @touhidurrr,

Thanks for this repo, I needed the IP's linked to YouTube to whitelist them on my VPN and bypass load captchas.

Possible to add a list of YouTube's IPv4 addresses but in ranges with CIDR ? The list would be shorter and easier to enter and manage for whitelists/blocklists.

There's this link which provides all IPv4 addresses linked to Google with ranges but it's too broad and includes everything.

touhidurrr commented 9 months ago

Thanks for appreciating the project. I once thought something along these lines, given that x.x.x.A and x.x.x.B belongs to a big tech company, all the ips between x.x.x.A and x.x.x.B also belongs to the same company. This should be considerably reliable given that ips are bought and sold on blocks. And the resulting list should not be that broad either. Do you think writing a script that uses this logic to build a merged ranges list would work? Kindly let me know your thoughts about it.

realgooseman commented 9 months ago

I'm not too experienced, but I've seen tools online that let you enter starting and ending IP's to give you CIDR ranges like here.

Actually, a lot of the IP's listed on your IPv4 script are already ranged in the Google's official IPv4 list I showed before here. I'm not sure how it can be implemented, but it would help in creating a compact IPv4 range list for YouTube only.

touhidurrr commented 9 months ago

@realgooseman I added test support for CIDR (https://github.com/touhidurrr/iplist-youtube/commit/0b2a93f4274f26a0e0fe9afee5b8d525bc0d922a). CIDR Ranges File: https://github.com/touhidurrr/iplist-youtube/blob/main/cidr4.txt

The code in this version is messed up and I will try to clean it up later. However the CIDR list should work fine. If you you want a shorter CIDR file, you might want to change the value of maskLastNBits in https://github.com/touhidurrr/iplist-youtube/blob/0b2a93f4274f26a0e0fe9afee5b8d525bc0d922a/cidr.py#L24 to a larger number and try to generate a list yourself.

That's all for now, hope that helps.

realgooseman commented 9 months ago

Amazing, thanks for your work. I'm sure it will be useful for people who come across your repo (like I did).

touhidurrr commented 9 months ago

Resolved with https://github.com/touhidurrr/iplist-youtube/commit/b5319b3aa85961a5fc83945de806a227cede0e46. See cidr4.txt and cidr6.txt.