fb

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Facebook Video Downloader</title>
  <style>
    body {
      font-family: Arial, sans-serif;
      background: #f0f2f5;
      text-align: center;
      padding: 50px;
    }
    .container {
      max-width: 500px;
      margin: auto;
      background: white;
      padding: 30px;
      border-radius: 8px;
      box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    }
    h1 {
      color: #1877f2;
    }
    input[type="text"] {
      width: 100%;
      padding: 12px;
      margin: 15px 0;
      border: 1px solid #ccc;
      border-radius: 4px;
    }
    button {
      padding: 12px 25px;
      background-color: #1877f2;
      border: none;
      color: white;
      font-size: 16px;
      border-radius: 4px;
      cursor: pointer;
    }
    button:hover {
      background-color: #145dbf;
    }
    .result {
      margin-top: 20px;
    }
  </style>
</head>
<body>

  <div class="container">
    <h1>Facebook Video Downloader</h1>
    <p>Paste the Facebook video link below:</p>
    <form id="downloadForm">
      <input type="text" id="videoURL" placeholder="https://www.facebook.com/video/xyz" required>
      <button type="submit">Download</button>
    </form>
    <div class="result" id="resultArea"></div>
  </div>

  <script>
    document.getElementById('downloadForm').addEventListener('submit', function(e) {
      e.preventDefault();
      const url = document.getElementById('videoURL').value;
      const resultArea = document.getElementById('resultArea');

      if (!url) {
        resultArea.innerHTML = "<p style='color:red;'>Please enter a video URL.</p>";
        return;
      }

      // Send URL to backend (to be built in PHP, Python, etc.)
      fetch('/api/download', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify({ video_url: url })
      })
      .then(response => response.json())
      .then(data => {
        if (data.success) {
          resultArea.innerHTML = `
            <p>Download Ready:</p>
            <a href="${data.download_url}" download>Click here to download video</a>
          `;
        } else {
          resultArea.innerHTML = "<p style='color:red;'>Failed to fetch video. Make sure the URL is correct.</p>";
        }
      })
      .catch(error => {
        resultArea.innerHTML = "<p style='color:red;'>Server error. Try again later.</p>";
        console.error(error);
      });
    });
  </script>

</body>
</html>

Comments