from apify_client import ApifyClient# Initialize the clientclient = ApifyClient('YOUR_API_TOKEN')# Run the actorrun_input = { 'domain': 'apify.com'}# Start the runrun = client.actor('pratikdani/company-research-analysis-agent').call(run_input=run_input)# Wait for the run to finish and fetch resultsresults = client.dataset(run['defaultDatasetId']).list_items().items# Print the generated reportprint(results[0]['generated_report'])
const { ApifyClient } = require('apify-client');// Initialize the clientconst client = new ApifyClient({ token: 'YOUR_API_TOKEN',});async function researchCompany() { // Start the actor and wait for it to finish const run = await client.actor('pratikdani/company-research-analysis-agent').call({ domain: 'apify.com' }); // Fetch and print results const { items } = await client.dataset(run.defaultDatasetId).listItems(); console.log(items[0].generated_report);}researchCompany();
from apify_client import ApifyClientimport asyncioasync def research_companies(domains): client = ApifyClient('YOUR_API_TOKEN') results = [] for domain in domains: try: # Start the actor run run = await client.actor('pratikdani/company-research-analysis-agent').call( run_input={'domain': domain} ) # Get the results items = await client.dataset(run['defaultDatasetId']).list_items() results.append(items.items[0]) except Exception as e: print(f"Error processing {domain}: {str(e)}") return results# List of companies to researchdomains = [ 'apify.com', 'microsoft.com', 'apple.com']# Run the batch processresults = asyncio.run(research_companies(domains))# Process resultsfor result in results: print(f"Company: {result['domain']}") print(f"Report Length: {len(result['generated_report'])} characters") print("---")
import jsonfrom apify_client import ApifyClientdef save_company_research(domain, output_file): # Initialize the client client = ApifyClient('YOUR_API_TOKEN') # Run the actor run = client.actor('pratikdani/company-research-analysis-agent').call( run_input={'domain': domain} ) # Get results results = client.dataset(run['defaultDatasetId']).list_items().items[0] # Save to file with open(output_file, 'w') as f: json.dump(results, f, indent=2) print(f"Results saved to {output_file}")# Use the functionsave_company_research('apify.com', 'apify_research.json')
Remember to replace ‘YOUR_API_TOKEN’ with your actual Apify API token in all examples.