JavaScript Code to Flowchart avatar

JavaScript Code to Flowchart

Try for free

No credit card required

Go to Store
JavaScript Code to Flowchart

JavaScript Code to Flowchart

drobnikj/js-code-2-flowchart
Try for free

No credit card required

Use this to convert JavaScript code to a flowchart. The actor uses https://www.npmjs.com/package/js2flowchart npm package to convert the code to a flowchart. The output is an SVG file.

You can access the JavaScript Code to Flowchart 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 = { "code": """// The function accepts a single argument: the \"context\" object.
9// For a complete list of its properties and functions,
10// see https://apify.com/apify/web-scraper#page-function 
11async function pageFunction(context) {
12    // This statement works as a breakpoint when you're trying to debug your code. Works only with Run mode: DEVELOPMENT!
13    // debugger; 
14
15    // jQuery is handy for finding DOM elements and extracting data from them.
16    // To use it, make sure to enable the \"Inject jQuery\" option.
17    const $ = context.jQuery;
18    const pageTitle = $('title').first().text();
19
20    // Print some information to actor log
21    context.log.info(`URL: ${context.request.url}, TITLE: ${pageTitle}`);
22
23    // Manually add a new page to the queue for scraping.
24    context.enqueueRequest({ url: 'http://www.example.com' });
25
26    // Return an object with the data extracted from the page.
27    // It will be stored to the resulting dataset.
28    return {
29        url: context.request.url,
30        pageTitle
31    };
32}""" }
33
34# Run the Actor and wait for it to finish
35run = client.actor("drobnikj/js-code-2-flowchart").call(run_input=run_input)
36
37# Fetch and print Actor results from the run's dataset (if there are any)
38print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
39for item in client.dataset(run["defaultDatasetId"]).iterate_items():
40    print(item)
41
42# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

JavaScript Code to Flowchart API in Python

The Apify API client for Python is the official library that allows you to use JavaScript Code to Flowchart 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

  • 12 monthly users

  • 4 stars

  • 89% runs succeeded

  • Created in Nov 2017

  • Modified a year ago

Categories