def parse_pages(self, response): ipToDns = IpToDns() for url in response.css('#alx-content > div > section.content-fixed.page-product-content > span > span > section > div.listings > ul > li > div.desc-container > p > a::text').extract(): domain = url.lower() dns_id = ipToDns.add_DNS(domain) ips = ipToDns.get_IPs(domain) for ip in ips: ipToDns.add_IP_to_DNS(ip, dns_id) yield {'domain': domain, 'IPs':ips}
def parse_pages(self, response): ipToDns = IpToDns() for url in response.css( '#alx-content > div > section.content-fixed.page-product-content > span > span > section > div.listings > ul > li > div.desc-container > p > a::text' ).extract(): domain = url.lower() dns_id = ipToDns.add_DNS(domain) ips = ipToDns.get_IPs(domain) for ip in ips: ipToDns.add_IP_to_DNS(ip, dns_id) yield {'domain': domain, 'IPs': ips}
#!/usr/local/bin/python2.7 from iptodns import IpToDns import sys if len(sys.argv) == 2: domain = sys.argv[1] ipToDns = IpToDns() dns_id = ipToDns.add_DNS(domain) ips = ipToDns.get_IPs(domain) for ip in ips: ipToDns.add_IP_to_DNS(ip, dns_id) print "OK! Add with success!" else: print "Error"