Skip to content

Commit

Permalink
add-iwmf (#128)
Browse files Browse the repository at this point in the history
add new source from `directory.iwmf.ir`
  • Loading branch information
Chocolate4U authored Sep 4, 2023
1 parent c788384 commit bf394be
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
v2fly_base_url = "https://raw.githubusercontent.com/v2fly/domain-list-community/master/data/"
# https://enamad.ir/DomainListForMIMT
enamad_url = "https://raw.githubusercontent.com/bootmortis/enamad-mirror/main/out/domains.csv"
# https://directory.iwmf.ir
iwmf_url = "https://raw.githubusercontent.com/Chocolate4U/iwmf.ir-Mirror/main/data/iwmf.csv"

# input files
adsl_tci_file_path = "src/data/adsl_tci.txt"
Expand Down
9 changes: 9 additions & 0 deletions src/get_domians.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ def enamad() -> Iterable[str]:
domains = (domain.split(',')[2] for domain in domains)
return list(set(domains))

def iwmf() -> Iterable[str]:
resp = requests.get(consts.iwmf_url)
resp.raise_for_status()

domains = resp.text
domains = domains.splitlines()[1:]
domains = (domain.split(',')[1] for domain in domains)
return list(set(domains))

def adsl_tci() -> Iterable[str]:
with open(consts.adsl_tci_file_path, "r") as file:
return (line.strip() for line in file.readlines())
Expand Down
1 change: 1 addition & 0 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def collect_and_clean_domains(*domain_set: Iterable[Iterable[str]]) -> Iterable[
all_domains = collect_and_clean_domains(
get_domians.g2b_ito_gov(),
get_domians.enamad(),
get_domians.iwmf(),
get_domians.adsl_tci(),
get_domians.v2fly(),
)
Expand Down

0 comments on commit bf394be

Please sign in to comment.