API: SerpAPI Error: Your account has run out of searches issue fixed

This commit is contained in:
akash 2026-02-11 10:43:38 +05:30
parent fbd138aa15
commit c8ea8997fe
3 changed files with 35 additions and 7 deletions

View File

@ -61,9 +61,24 @@ const About = () => {
} }
function getProfileImage(r) { function getProfileImage(r) {
const url = r.profile_photo_url || r.author_profile_photo_url || r.user?.thumbnail; // Check multiple possible field names for profile images
const url = r.profile_photo_url ||
r.author_profile_photo_url ||
r.user?.thumbnail ||
r.user?.profile_photo_url ||
r.thumbnail ||
r.profile_picture ||
r.avatar;
if (!url) return null; if (!url) return null;
return url.startsWith("http") ? url : `https://lh3.googleusercontent.com/${url}`;
// If it's already a full URL, return it
if (url.startsWith("http")) {
return url;
}
// Otherwise, construct the Googleusercontent URL
return `https://lh3.googleusercontent.com/${url}`;
} }
function getInitials(name) { function getInitials(name) {

View File

@ -1,5 +1,5 @@
export default async function handler(req, res) { export default async function handler(req, res) {
const apiKey = "37eb7f83988cfd76ffb5c5af9adc25652efe5607e39997fc7d0e054d690ef25e"; const apiKey = "8f20ae2ffd1700f38274ea87d2230ea8e0982834f8376bf311e7a4f5092662a8";
const placeId = "ChIJW9-CDf_X1IkRnBCKKZdqyvA"; const placeId = "ChIJW9-CDf_X1IkRnBCKKZdqyvA";
// console.log("Pages API: Starting fetch for placeId:", placeId); // console.log("Pages API: Starting fetch for placeId:", placeId);

View File

@ -96,12 +96,10 @@ const TestimonialSection = () => {
console.log("Home: Fetching reviews..."); console.log("Home: Fetching reviews...");
const res = await fetch("/api/reviews"); const res = await fetch("/api/reviews");
const data = await res.json(); const data = await res.json();
console.log("Home: Received data:", data);
const cleaned = (data.reviews || []).filter(r => const cleaned = (data.reviews || []).filter(r =>
(r.text || r.description || r.snippet || r.review_text || r.body || r.content) && (r.text || r.description || r.snippet || r.review_text || r.body || r.content) &&
r.rating >= 4 r.rating >= 4
); );
console.log("Home: Cleaned reviews (rating >= 4):", cleaned.length);
setReviews(cleaned); setReviews(cleaned);
} catch (error) { } catch (error) {
console.error("Home: Failed to fetch reviews", error); console.error("Home: Failed to fetch reviews", error);
@ -131,9 +129,24 @@ const TestimonialSection = () => {
} }
function getProfileImage(r) { function getProfileImage(r) {
const url = r.profile_photo_url || r.author_profile_photo_url || r.user?.thumbnail; // Check multiple possible field names for profile images
const url = r.profile_photo_url ||
r.author_profile_photo_url ||
r.user?.thumbnail ||
r.user?.profile_photo_url ||
r.thumbnail ||
r.profile_picture ||
r.avatar;
if (!url) return null; if (!url) return null;
return url.startsWith("http") ? url : `https://lh3.googleusercontent.com/${url}`;
// If it's already a full URL, return it
if (url.startsWith("http")) {
return url;
}
// Otherwise, construct the Googleusercontent URL
return `https://lh3.googleusercontent.com/${url}`;
} }
function getInitials(name) { function getInitials(name) {