මෙන්න මේ code එක මම ආතල් එකට වගේ google bird ට කියලා ලියවාගත්තා.. Coding ගැන දන්න අය මේක පොඩ්ඩක් බලල හරිද කියන්න පුළුවන් ද..?
import requests
from bs4 import BeautifulSoup
# Get the top search keywords from Google Trends
url = "https://trends.google.com/trends/explore?date=all&q=keyword1,keyword2,keyword3"
response = requests.get(url)
soup = BeautifulSoup(response.content, "html.parser")
# Extract the keywords and their search volumes
keywords = []
for trend in soup.find_all("div", class_="trend-title"):
keyword = trend.find("a").text
search_volume = trend.find("span", class_="value").text
keywords.append((keyword, search_volume))
# Filter the keywords by search volume
min_search_volume = 1000
keywords = [keyword for keyword, search_volume in keywords if int(search_volume) >= min_search_volume]
# Get the keyword difficulty for each keyword
keyword_difficulty = {}
for keyword in keywords:
url = "https://ahrefs.com/keyword-difficulty/{}?hflag=1".format(keyword)
response = requests.get(url)
soup = BeautifulSoup(response.content, "html.parser")
# Extract the keyword difficulty
keyword_difficulty[keyword] = soup.find("span", class_="keyword-difficulty").text
# Sort the keywords by keyword difficulty
sorted_keywords = sorted(keyword_difficulty.items(), key=lambda x: x[1])
# Print the top 10 low-competition keywords
for keyword, difficulty in sorted_keywords[:10]:
print("{} ({})".format(keyword, difficulty))