External DSL to learn about OCaml and compilers. It should make it easier to make scrappers.
Compiles to Python.
Compile EZReq:
make
Compile the source code:
./ezreq examples/test.ezr
Run the code:
python3 examples/test.py
Source Code (examples/test.ezr
):
begin
title = get "https://example.org"
|> extract "<title>" "</title>"
|> print
end
Compiled program:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" File automatically generated by Ezreq """
def print_ezreq(var):
try:
print(var.text)
except AttributeError:
print(var)
import requests
title = requests.get("https://example.org")
pipe_tmp = title
pipe_tmp = pipe_tmp.text.split("<title>")[1].split("</title>")[0]
print_ezreq(pipe_tmp)
title = pipe_tmp
exit(0)
Result:
Example Domain
https://www.iana.org/domains/example