How can i create a tweet directly from a button with JavaScript?

I am creating a random quote generator following along with a tutorial found at this link: https://www.youtube.com/watch?v=pbWHp63-V3c&t=2465s

In the video around the 40 minute mark he adds the functionality to create a tweet with the quote auto-populated into the input of the tweet. I know twitter has went through some changes in the transition to X and this does not seem to be working for me. Here is my code I have written so far:

    <script>
      const QUOTEBANK = [
        {
          quote: "We suffer more often in imagination than in reality.",
          author: "Seneca",
        },
        {
          quote:
            "You're the air I breathe. You're EVERYTHING to me. I wish you could see yourself through my eyes...",
          author: "Clara Dobbins",
        },
        {
          quote:
            "Accept the things to which fate binds you, and love the people with whom fate brings you together, but do so with all your heart",
          author: "Marcus Aurelius",
        },
        {
          quote: "He has the most who is most content with the least.",
          author: "Diogenes",
        },
        {
          quote:
            "For a man to conquer himself is the first and noblest of all victories",
          author: "Plato",
        },
        {
          quote:
            "It's not what happens to you, but how you react to it that matters.",
          author: "Epictetus",
        },
        {
          quote: "The goal of life is living in agreement with Nature",
          author: "Zeno of Citium",
        },
      ];
      window.onload = init;
      function init() {}

      function generateQuote() {
        let quoteSize = QUOTEBANK.length;
        let randomIndex = Math.floor(Math.random() * quoteSize);
        let randomQuoteData = QUOTEBANK[randomIndex];

        let twitterLink =
          "https://twitter.com/intent/tweet?hashtags=quotes&amp;related=freecodecamp&amp;text=%22";

        //Add the quote
        let quoteInApiFormat = randomQuoteData.quote.replace(/ /g, "%20");
        twitterLink += quoteInApiFormat;
        //Add the author
        let authorInApiFormat = randomQuoteData.author.replace(/ /g, "%20");

        twitterLink += authorInApiFormat;

        document.getElementById("tweet-quote").href = twitterLink;
        document.getElementById("text").innerText = randomQuoteData.quote;
        document.getElementById("author").innerText = randomQuoteData.author;
      }
    </script>

I tried implementing the same code as the tutorial but when I press the link, I only get a tweet that says “#quotes ” instead of my quote.