I am trying to find a way to find the CDN that is serving a certain domain in Python.
My idea is to use DNS lookups to read the field CNAME in the response. From that I can map the CNAME response to a certain DNS provider. I am aware of a similar threat in How can I filter the domains served by a CDN from a list of domain names?. However, as it is highlighted there, there is no guarantee to obtain the CNAME for each domain tested. I wonder then if there is another method to find the corresponding CDN for a domain when the CNAME is not in the response in Python. So far I have tried:
# I am using Python 3.7.0 and the dnspython library
import dns.resolver
dns_results = dns.resolver.query('youtube.com', 'CNAME')
I am getting an error like this:
NoAnswer: The DNS response does not contain an answer to the question: youtube.com. IN CNAME
When I was expecting the answer to be Google.
Thank you for your help.