diff --git a/worker.php b/worker.php index 85e8d11..04a778b 100644 --- a/worker.php +++ b/worker.php @@ -104,14 +104,36 @@ foreach ($pending_submissions as $sub) { } } + $industry = null; + if ($company) { + $industry_query = ""{$company}" industry"; + $industry_results_json = shell_exec("gemini-tool google_web_search --query '{$industry_query}'"); + if ($industry_results_json) { + $results = json_decode($industry_results_json, true); + if (!empty($results['web_search_result']['results'])) { + $industry = $results['web_search_result']['results'][0]['title']; + } + } + } - $update_data = [ + $geo_location = null; + if ($company) { + $location_query = ""{$company}" headquarters location"; + $location_results_json = shell_exec("gemini-tool google_web_search --query '{$location_query}'"); + if ($location_results_json) { + $results = json_decode($location_results_json, true); + if (!empty($results['web_search_result']['results'])) { + $geo_location = $results['web_search_result']['results'][0]['title']; + } + } + } + + $update_data = [ 'linkedin_url' => $linkedin_url, 'twitter_url' => $twitter_url, 'company' => $company, - 'location' => 'Unknown', // Placeholder - 'industry' => 'Unknown', // Placeholder - 'geo_location' => 'Unknown', // Placeholder + 'industry' => $industry, + 'geo_location' => $geo_location, 'status' => 'Completed' ];