Open WebdevWebi opened 6 days ago
Can you provide a bit more detail with examples of what you are saying. Also, how I can recreate the problem, i.e which input are you using. Also, if you think there can be any improvement in the module you can contribute to it's development too.
Yes, sorry, I translated the script from Italian to English:
from GoogleAds.main import GoogleAds, show_regions_list
def main():
# Creation of the GoogleAds instance
google_ads = GoogleAds(region="IT")
# Step 1: Enter your keyword
keyword = input("Enter the keyword to search for advertisers: ")
print(f"\nI am looking for advertisers for the keyword: {keyword}...")
# Get search suggestions
suggestions = google_ads.get_all_search_suggestions(keyword)
if not suggestions:
print(f"No suggestions found for the keyword '{keyword}'.")
return
# Filter suggestions to extract advertisers
advertisers = []
for suggestion in suggestions:
for _, details in suggestion.items():
if "1" in details and "2" in details: # Controllo per identificare inserzionisti
advertisers.append({
"name": details["1"], # Nome dell'inserzionista
"id": details["2"], # ID dell'inserzionista
"region": details.get("3", "Unknown Region"), # Regione, se disponibile
})
if not advertisers:
print("No advertisers found in suggestions.")
return
# Show list of advertisers
print("\nAdvertisers found:")
for idx, advertiser in enumerate(advertisers, start=1):
print(f"{idx}. {advertiser['name']} (ID: {advertiser['id']}, Region: {advertiser['region']})")
# Select advertiser
try:
selection = int(input("\nSelect an advertiser (number): "))
if 1 <= selection <= len(advertisers):
selected_advertiser = advertisers[selection - 1]
else:
print("Invalid selection. I go out.")
return
except ValueError:
print("Invalid input. I go out.")
return
advertiser_id = selected_advertiser["id"]
print(f"\nYou have selected: {selected_advertiser['name']} (ID: {advertiser_id}, Region: {selected_advertiser['region']})")
# Step 2: Get creative list
creatives_info = google_ads.creative_search_by_advertiser_id(advertiser_id, 200)
if not creatives_info:
print("No creatives found for the selected advertiser.")
return
# Creatives returned as a list
print("\nCreatives found for the selected advertiser:")
for idx, creative in enumerate(creatives_info, start=1):
print(f"{idx}. {creative}")
# Select creative
try:
selection = int(input("\nSelect creative (number): "))
if 1 <= selection <= len(creatives_info):
specific_creative_id = creatives_info[selection - 1]
else:
print("Invalid selection. I go out.")
return
except ValueError:
print("Invalid input. I go out.")
return
# Step 3: Get details of the selected creative
print(f"\nRetrieving details for the ID creative: {specific_creative_id}...")
ad_details = google_ads.get_detailed_ad(advertiser_id, specific_creative_id)
# Show creative details
print("\nDetails of the selected creative:")
for key, value in ad_details.items():
print(f"{key}: {value}")
if __name__ == "__main__":
main()
Now I'll show you the output that I receive and the output that Google receives for the same searched keyword:
my output:
Google outputs:
As you can see in my output only 2 adverts are detected, while Google's output detects many more adverts.
my input is "paper", a simple Italian test word, but I also detected this inconsistency with other keywords.
I am working with your project, and I have implemented a script whose code I will provide you:
However, I noticed that when carrying out a keyword search, advertisers are always scanned well, while the number of adverts relating to any previously scanned advertiser is not scanned well.
EXAMPLE: If an advertiser has 9 ads, only 3 are scanned.
I couldn't find a solution to this problem. Could you help me? Thanks!