Jumat, 20 Januari 2023

CEK DA PA

import requests from bs4 import BeautifulSoup def check_da_pa(url): try: # Make the request to the URL response = requests.get(url) # Parse the HTML content soup = BeautifulSoup(response.content, 'html.parser') # Extract the DA and PA from the HTML da = soup.find('div', {'class': 'domain_rank'}).get_text() pa = soup.find('div', {'class': 'page_rank'}).get_text() # Return the DA and PA return {'DA': da, 'PA': pa} except: # Handle any errors that may occur return None # Example usage url = 'https://example.com' result = check_da_pa(url) print(result)

Tidak ada komentar:

Posting Komentar