change this gig tags extractor porgram to getting information about the pricing of these gigs incluing basic advanced and 3rd pacage import requests
from bs4 import BeautifulSoup
import time
import logging

# Configure logging
logging.basicConfig(
    filename='scraper.log',
    filemode='a',
    format='%(asctime)s - %(levelname)s - %(message)s',
    level=logging.INFO
)

def read_urls(file_path):
    """
    Reads URLs from a specified text file.
    Each URL should be on a separate line.
    """
    try:
        with open(file_path, 'r', encoding='utf-8') as file:
            urls = file.read().splitlines()
        # Clean and filter out empty lines
        urls = [url.strip() for url in urls if url.strip()]
        logging.info(f"Successfully read {len(urls)} URLs from {file_path}.")
        return urls
    except FileNotFoundError:
        logging.error(f"File {file_path} not found.")
        raise
    except Exception as e:
        logging.error(f"Error reading {file_path}: {e}")
        raise

def extract_tags(html_content, url):
    """
    Extracts related tags from the HTML content.
    
    Parameters:
        html_content (str): The HTML content of the webpage.
        url (str): The URL of the webpage (for debugging purposes).
    
    Returns:
        list: A list of related tags.
    """
    soup = BeautifulSoup(html_content, 'html.parser')
    tags = []
    
    try:
        # Find the div with class 'gig-tags-container'
        tags_container = soup.find('div', class_='gig-tags-container')
        if tags_container:
            # Find all <a> tags within <li> elements inside the container
            tag_elements = tags_container.find_all('a')
            tags = [tag.get_text(strip=True) for tag in tag_elements if tag.get_text(strip=True)]
            if not tags:
                logging.warning(f"No tags found in gig-tags-container for URL: {url}")
        else:
            logging.warning(f"'gig-tags-container' div not found for URL: {url}")
    except Exception as e:
        logging.error(f"Error extracting tags for URL {url}: {e}")
    
    return tags

def process_urls(urls, output_file):
    """
    Processes each URL to extract related tags and write them to an output file.
    
    Parameters:
        urls (list): List of Fiverr gig URLs.
        output_file (str): Path to the output text file.
    """
    headers = {
        'User-Agent': (
            'Mozilla/5.0 (Windows NT 10.0; Win64; x64) '
            'AppleWebKit/537.36 (KHTML, like Gecko) '
            'Chrome/90.0.4430.93 Safari/537.36'
        )
    }

    with open(output_file, 'w', encoding='utf-8') as f_out:
        for idx, url in enumerate(urls, 1):
            print(f"Processing ({idx}/{len(urls)}): {url}")
            try:
                response = requests.get(url, headers=headers, timeout=15)
                response.raise_for_status()  # Raise HTTPError for bad responses
                tags = extract_tags(response.text, url)

                # Write extracted tags to the output file
                f_out.write(f"URL {idx}: {url}\n")
                f_out.write("Related Tags:\n")
                if tags:
                    for tag in tags:
                        f_out.write(f"- {tag}\n")
                else:
                    f_out.write("No related tags found.\n")
                f_out.write("="*80 + "\n\n")

                # Log successful extraction
                logging.info(f"Successfully processed URL {idx}: {url}")

                # Politeness delay to avoid overwhelming the server
                time.sleep(1)

            except requests.exceptions.HTTPError as http_err:
                print(f"HTTP error occurred for {url}: {http_err}")
                logging.error(f"HTTP error for URL {idx} ({url}): {http_err}")
                f_out.write(f"URL {idx}: {url}\n")
                f_out.write(f"HTTP Error: {http_err}\n")
                f_out.write("="*80 + "\n\n")
            except requests.exceptions.ConnectionError as conn_err:
                print(f"Connection error occurred for {url}: {conn_err}")
                logging.error(f"Connection error for URL {idx} ({url}): {conn_err}")
                f_out.write(f"URL {idx}: {url}\n")
                f_out.write(f"Connection Error: {conn_err}\n")
                f_out.write("="*80 + "\n\n")
            except requests.exceptions.Timeout as timeout_err:
                print(f"Timeout error for {url}: {timeout_err}")
                logging.error(f"Timeout error for URL {idx} ({url}): {timeout_err}")
                f_out.write(f"URL {idx}: {url}\n")
                f_out.write(f"Timeout Error: {timeout_err}\n")
                f_out.write("="*80 + "\n\n")
            except requests.exceptions.RequestException as req_err:
                print(f"Request exception for {url}: {req_err}")
                logging.error(f"Request exception for URL {idx} ({url}): {req_err}")
                f_out.write(f"URL {idx}: {url}\n")
                f_out.write(f"Request Exception: {req_err}\n")
                f_out.write("="*80 + "\n\n")
            except Exception as e:
                print(f"An unexpected error occurred for {url}: {e}")
                logging.error(f"Unexpected error for URL {idx} ({url}): {e}")
                f_out.write(f"URL {idx}: {url}\n")
                f_out.write(f"Unexpected Error: {e}\n")
                f_out.write("="*80 + "\n\n")

def main():
    """
    Main function to orchestrate the scraping process.
    """
    # Input and output file paths
    url_file = 'urls.txt'
    output_file = 'extracted_tags.txt'

    try:
        urls = read_urls(url_file)
        if not urls:
            print(f"No URLs found in {url_file}. Please add URLs, one per line.")
            logging.error(f"No URLs to process. {url_file} is empty.")
            return
    except Exception as e:
        print(f"Error reading URLs: {e}")
        return

    process_urls(urls, output_file)
    print(f"Extraction complete. Check the '{output_file}' file for results.")
    print(f"Refer to 'scraper.log' for detailed logs.")

if __name__ == "__main__":
    main()
 ELEMT FOR PRICING <div class="packages-tabs triple"><input id="package-tab-1" name="package-tab-group" type="radio" checked=""><input id="package-tab-2" name="package-tab-group" type="radio"><input id="package-tab-3" name="package-tab-group" type="radio"><div class="nav-container"><label for="package-tab-1" class="new-pro-layout" tabindex="0" role="tab" aria-selected="true">Basic</label><label for="package-tab-2" class="new-pro-layout" tabindex="0" role="tab" aria-selected="false">Standard</label><label for="package-tab-3" class="new-pro-layout" tabindex="0" role="tab" aria-selected="false">Premium</label></div><div class="TEpHpiF"><div class="package-content zxTHQ6r"><header class="header-default"><h3 class=""><b class="title">Consulting Call</b><div class="price-wrapper"><span class="price-with-tooltip"><span class="price">PKR&nbsp;29,240</span><div class="jEW3B9z Y_05slf price-tooltip-wrapper"><span class="HsyURQF"><svg width="16" height="16" viewBox="0 0 14 15" xmlns="http://www.w3.org/2000/svg" fill="#404145"><g clip-path="url(#info-outline-icon_svg__a)"><path d="M6.3 4h1.4v1.4H6.3V4Zm0 2.8h1.4V11H6.3V6.8ZM7 .5c-3.864 0-7 3.136-7 7s3.136 7 7 7 7-3.136 7-7-3.136-7-7-7Zm0 12.6a5.607 5.607 0 0 1-5.6-5.6c0-3.087 2.513-5.6 5.6-5.6 3.087 0 5.6 2.513 5.6 5.6 0 3.087-2.513 5.6-5.6 5.6Z"></path></g><defs><clipPath id="info-outline-icon_svg__a"><path transform="translate(0 .5)" d="M0 0h14v14H0z"></path></clipPath></defs></svg></span></div></span></div></h3><p>On this 1 hour call, I will sit down with you and help refine your idea then provide a quote.</p></header><article><div class="additional-info"><div class="delivery-wrapper"><span class="glAQDp5 delivery-icon" aria-hidden="true" style="width: 16px; height: 16px;"><svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M8 0C3.6 0 0 3.6 0 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8zm0 14c-3.3 0-6-2.7-6-6s2.7-6 6-6 6 2.7 6 6-2.7 6-6 6z"></path><path d="M9 4H7v5h5V7H9V4z"></path></svg></span><b class="delivery">2-day delivery</b></div></div><ul class="features"><li class="qSePHwK flex flex-items-center"><span class="glAQDp5 bvg2_O1 ZbQv8bb C7W1J6j" aria-hidden="true" style="width: 16px; height: 16px;"><svg width="16" height="16" viewBox="0 0 11 9" xmlns="http://www.w3.org/2000/svg" fill="currentFill"><path d="M3.645 8.102.158 4.615a.536.536 0 0 1 0-.759l.759-.758c.21-.21.549-.21.758 0l2.35 2.349L9.054.416c.21-.21.55-.21.759 0l.758.758c.21.21.21.55 0 .759L4.403 8.102c-.209.21-.549.21-.758 0Z"></path></svg></span>Research</li><li class="qSePHwK flex flex-items-center"><span class="glAQDp5 bvg2_O1 C7W1J6j" aria-hidden="true" style="width: 16px; height: 16px;"><svg width="16" height="16" viewBox="0 0 11 9" xmlns="http://www.w3.org/2000/svg" fill="currentFill"><path d="M3.645 8.102.158 4.615a.536.536 0 0 1 0-.759l.759-.758c.21-.21.549-.21.758 0l2.35 2.349L9.054.416c.21-.21.55-.21.759 0l.758.758c.21.21.21.55 0 .759L4.403 8.102c-.209.21-.549.21-.758 0Z"></path></svg></span>Model creation</li><li class="qSePHwK flex flex-items-center"><span class="glAQDp5 bvg2_O1 C7W1J6j" aria-hidden="true" style="width: 16px; height: 16px;"><svg width="16" height="16" viewBox="0 0 11 9" xmlns="http://www.w3.org/2000/svg" fill="currentFill"><path d="M3.645 8.102.158 4.615a.536.536 0 0 1 0-.759l.759-.758c.21-.21.549-.21.758 0l2.35 2.349L9.054.416c.21-.21.55-.21.759 0l.758.758c.21.21.21.55 0 .759L4.403 8.102c-.209.21-.549.21-.758 0Z"></path></svg></span>Model documentation</li></ul></article></div><footer class="tab-footer drawer-payment-footer"><button class="sPdE5j4 FmssW6b co-white bg-co-black" type="button">Continue<span class="glAQDp5 rf" aria-hidden="true" style="width: 16px; height: 16px; fill: white;"><svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M9.92332 2.96885C9.63854 2.66807 9.1768 2.66807 8.89202 2.96885C8.60723 3.26963 8.60723 3.75729 8.89202 4.05807L11.6958 7.01931H1.48616C1.08341 7.01931 0.756918 7.36413 0.756918 7.7895C0.756918 8.21487 1.08341 8.5597 1.48616 8.5597H11.8436L8.89202 11.677C8.60723 11.9778 8.60723 12.4654 8.89202 12.7662C9.1768 13.067 9.63854 13.067 9.92332 12.7662L14.0459 8.41213C14.3307 8.11135 14.3307 7.62369 14.0459 7.32291L13.977 7.25011C13.9737 7.24661 13.9704 7.24315 13.9671 7.23972L9.92332 2.96885Z"></path></svg></span></button><button class="Rgqr5fr tbody-6 sRzYbul">Compare packages</button></footer></div></div>