text: import requests as req
  import re
  import csv
  
  # Social Media links to look for
  media_links = [
      "instagram",
      "facebook",
      "twitter",
      "linkedin",
      "youtube",
  ]
  
  output_link_format = []
  
  val = int(
      input(
          "\n----------------------------\n Social Media Links Scraper\n----------------------------\n1. Single Website\n2. CSV file of websites\nEnter your choice from 1 or 2 : "
      ))
  
  # Single Website Data
  if val == 1:
  
      # Takes website link as input
      link = input("\nEnter the website url : ")
  
      # Makes a get request to the url
      r = req.get(link)
      # print(r)
  
      if r.status_code == 200:
          # Finds all links on the website's page
          all_links = re.findall(
              r"\b((?:https?://)?(?:(?:www\.)?(?:[\da-z\.-]+)\.(?:[a-z]{2,6})|(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)|(?:(?:[0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|(?:[0-9a-fA-F]{1,4}:){1,7}:|(?:[0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|(?:[0-9a-fA-F]{1,4}:){1,5}(?::[0-9a-fA-F]{1,4}){1,2}|(?:[0-9a-fA-F]{1,4}:){1,4}(?::[0-9a-fA-F]{1,4}){1,3}|(?:[0-9a-fA-F]{1,4}:){1,3}(?::[0-9a-fA-F]{1,4}){1,4}|(?:[0-9a-fA-F]{1,4}:){1,2}(?::[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:(?:(?::[0-9a-fA-F]{1,4}){1,6})|:(?:(?::[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(?::[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(?:ffff(?::0{1,4}){0,1}:){0,1}(?:(?:25[0-5]|(?:2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(?:25[0-5]|(?:2[0-4]|1{0,1}[0-9]){0,1}[0-9])|(?:[0-9a-fA-F]{1,4}:){1,4}:(?:(?:25[0-5]|(?:2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(?:25[0-5]|(?:2[0-4]|1{0,1}[0-9]){0,1}[0-9])))(?::[0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])?(?:/[\w\.-]*)*/?)\b",
              r.text)
          # print(all_links)
  
          found_links = {
              "url": link,
              "instagram": "",
              "facebook": "",
              "twitter": "",
              "linkedin": "",
              "youtube": "",
          }
  
          # Searching for links
          for i in all_links:
              for j in media_links:
                  if i.find(j) > 0:
                      found_links[j] = i
  
          # Displaying output
          print()
          for k, v in found_links.items():
              print(k, ":", v)
  
  # Reading sites from csv file and writing output to a new csv file
  elif val == 2:
  
      # Taking file path as input and opening it
      csv_file = open(input("\nEnter file path : "))
  
      # Iterating through links in csv file
      for link in csv_file:
          link = str(link).strip()
          r = req.get(link)
          # print(r)
  
          if r.status_code == 200:
              found_links = {
                  "url": link,
                  "instagram": "",
                  "facebook": "",
                  "twitter": "",
                  "linkedin": "",
                  "youtube": "",
              }
              all_links = re.findall(
                  r"\b((?:https?://)?(?:(?:www\.)?(?:[\da-z\.-]+)\.(?:[a-z]{2,6})|(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)|(?:(?:[0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|(?:[0-9a-fA-F]{1,4}:){1,7}:|(?:[0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|(?:[0-9a-fA-F]{1,4}:){1,5}(?::[0-9a-fA-F]{1,4}){1,2}|(?:[0-9a-fA-F]{1,4}:){1,4}(?::[0-9a-fA-F]{1,4}){1,3}|(?:[0-9a-fA-F]{1,4}:){1,3}(?::[0-9a-fA-F]{1,4}){1,4}|(?:[0-9a-fA-F]{1,4}:){1,2}(?::[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:(?:(?::[0-9a-fA-F]{1,4}){1,6})|:(?:(?::[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(?::[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(?:ffff(?::0{1,4}){0,1}:){0,1}(?:(?:25[0-5]|(?:2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(?:25[0-5]|(?:2[0-4]|1{0,1}[0-9]){0,1}[0-9])|(?:[0-9a-fA-F]{1,4}:){1,4}:(?:(?:25[0-5]|(?:2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(?:25[0-5]|(?:2[0-4]|1{0,1}[0-9]){0,1}[0-9])))(?::[0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])?(?:/[\w\.-]*)*/?)\b",
                  r.text)
              # print(all_links)
              for i in all_links:
                  for j in media_links:
                      if i.find(j) > 0:
                          found_links[j] = i
              output_link_format.append(found_links)
          else:
              print(link, "did not return status code 200")
      # print(output_link_format)
  
      # Generating output csv file
      print("Generating output csv file...")
      keys = output_link_format[0].keys()
  
      with open('output.csv', 'w', newline='') as output_file:
          dict_writer = csv.DictWriter(output_file, keys)
          dict_writer.writeheader()
          dict_writer.writerows(output_link_format)
  
      print("Output csv file generated successfully")
  else:
      print("Invalid choice! Enter choice between 1-2")
  