GraphQL Extractor avatar

GraphQL Extractor

Try for free

No credit card required

Go to Store
GraphQL Extractor

GraphQL Extractor

jupri/graphql-extractor
Try for free

No credit card required

💫 Universal GraphQL Scraper

You can access the GraphQL Extractor programmatically from your own Python applications by using the Apify API. You can also choose the language preference from below. To use the Apify API, you’ll need an Apify account and your API token, found in Integrations settings in Apify Console.

1from apify_client import ApifyClient
2
3# Initialize the ApifyClient with your Apify API token
4# Replace '<YOUR_API_TOKEN>' with your token.
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7# Prepare the Actor input
8run_input = {
9    "limit": 100,
10    "url": "https://apify.hashnode.dev/api/graphql",
11    "query": """query ($host: String!, $after: String, $first: Int!, $filter: PublicationPostConnectionFilter) {\r
12    publication(host: $host) {\r
13        id\r
14        posts(after: $after, first: $first, filter: $filter) {\r
15            edges {\r
16                node {\r
17                    __typename id title subtitle slug publishedAt url brief\r
18                }\r
19                __typename\r
20            }\r
21            pageInfo { hasNextPage endCursor __typename }\r
22            totalDocuments\r
23            __typename\r
24        }\r
25        __typename\r
26    }\r
27}""",
28    "variables": "{ \"host\": \"apify.hashnode.dev\", \"first\": 10 }",
29    "cursor.step": 25,
30    "cursor.index": "",
31    "cursor.next": "after",
32    "cursor.offset": "",
33    "cursor.limit": "first",
34    "parse.root": "publication.posts",
35    "parse.list": "edges",
36    "parse.item": "node",
37    "parse.total": "totalDocuments",
38    "parse.next": "pageInfo.endCursor",
39}
40
41# Run the Actor and wait for it to finish
42run = client.actor("jupri/graphql-extractor").call(run_input=run_input)
43
44# Fetch and print Actor results from the run's dataset (if there are any)
45print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
46for item in client.dataset(run["defaultDatasetId"]).iterate_items():
47    print(item)
48
49# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

GraphQL Extractor API in Python

The Apify API client for Python is the official library that allows you to use GraphQL Extractor API in Python, providing convenience functions and automatic retries on errors.

Install the apify-client

pip install apify-client

Other API clients include:

Developer
Maintained by Community

Actor Metrics

  • 2 monthly users

  • 1 star

  • 85% runs succeeded

  • Created in Oct 2024

  • Modified a month ago

Categories