1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = {
9 "urls": ["https://www.irs.gov/pub/irs-pdf/fw9.pdf"],
10 "schema": {
11 "type": "object",
12 "properties": {
13 "title": {
14 "type": "string",
15 "description": "Title of the form",
16 },
17 "formNumber": {
18 "type": "string",
19 "description": "The form number, e.g. W-9 or 1040",
20 },
21 "revisionDate": {
22 "type": "string",
23 "format": "date",
24 "description": "Revision date of the form",
25 },
26 "issuer": {
27 "type": "string",
28 "description": "Agency or organization that issues the form",
29 },
30 "fields": {
31 "type": "array",
32 "description": "The numbered fields a filer completes",
33 "items": {
34 "type": "object",
35 "properties": {
36 "label": { "type": "string" },
37 "description": { "type": "string" },
38 },
39 },
40 },
41 },
42 },
43 "extractor": "rules",
44 "includeMarkdown": False,
45}
46
47
48run = client.actor("owlabee/document-to-json-extractor").call(run_input=run_input)
49
50
51print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
52for item in client.dataset(run.default_dataset_id).iterate_items():
53 print(item)
54
55