Post "Liked on YouTube: ..." to X.
NOTE: Google Apps Script must be run with the same Google account as YouTube's
Authentication is required to tweet from third party clients.
- Apply for a developer account from here
- Create a project and app
- Set up "User authentication settings"
The "Callback URI" will be set later, so any URL is fine. - Note down "Client ID" and "Client Secret"
Go to https://script.google.com/home/usersettings and turn "On" the toggle.
$ git clone https://github.com/ahuglajbclajep/liked-on-youtube.git .
$ npm i
$ npx clasp login # Use the same account as in step 2
# Replace "YOUR_*" with the ID and Secret you note down in step 1
$ sed -ie s/X_CLIENT_ID/YOUR_X_CLIENT_ID/ src/post.ts
$ sed -ie s/X_CLIENT_SECRET/YOUR_X_CLIENT_SECRET/ src/post.ts
$ npm run deploy
- Open the Google Apps Script project page
e.g.npx clasp open
- Create a new deployment as a Web app (for everyone)
- Note down the Web app URL
- Replace the "Callback URI" set in step 1 with the Web app URL
- Open your browser in incognito mode and log in to X
- Open another tab in the browser in incognito mode and access the Web app URL
- If all goes well, the connection to X is complete
Once connected, the application will work even if you archive deployments.
- Open the Google Apps Script project page
- Open index.gs and run the "main" function
- If there is an update, videos will be posted to X every hour.