Skip to content

Instantly share code, notes, and snippets.

@marz-hunter
Last active July 19, 2024 00:53
Show Gist options
  • Save marz-hunter/0eff7e2f2eafcffab44916ec92bf1c68 to your computer and use it in GitHub Desktop.
Save marz-hunter/0eff7e2f2eafcffab44916ec92bf1c68 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import io
import tldextract
def extract(infile):
with io.open(infile, encoding='utf-8') as f:
for line in f:
domain = line.strip('\n')
extracted = tldextract.extract(domain)
if extracted.registered_domain:
print("{}".format(extracted.registered_domain))
if __name__ == '__main__':
infile = input('Masukkan nama file input: ')
extract(infile)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment