Skip to content

Instantly share code, notes, and snippets.

@dogukanatakul
Created October 12, 2024 08:08
Show Gist options
  • Select an option

  • Save dogukanatakul/530af4c9bf4ac5660f7c07535f3ca439 to your computer and use it in GitHub Desktop.

Select an option

Save dogukanatakul/530af4c9bf4ac5660f7c07535f3ca439 to your computer and use it in GitHub Desktop.
Linkedin Otomatik Bağlantı Kurma/Davet Gönderme Botu.
async function clickConnectButtons() {
// Get all "Connect" buttons
let buttons = document.querySelectorAll(BUTTON_CLASS);
// Eğer buton kalmadıysa belirtilen URL'ye yönlendir ve sayfa yüklendikten sonra tekrar butonları kontrol et
if (buttons.length === 0) {
window.location.href = TARGET_URL;
// Sayfanın tamamen yüklenmesini bekle ve ardından 10 saniye bekle
await waitForPageLoad();
await new Promise((resolve) => setTimeout(resolve, 10000)); // 10 saniye bekle
// Tekrar fonksiyonu çağır, yeni butonları bul ve tıkla
clickConnectButtons();
return;
}
// Loop through each "Connect" button
for (let button of buttons) {
// Check if the button text is "Bağlantı kur"
if (button.innerText !== CONNECT) {
continue;
}
// Click on the button
button.click();
// Wait for 500 milliseconds
await new Promise((resolve) => setTimeout(resolve, 500));
}
// Eğer işlem tamamlandıysa yine belirlenen URL'ye git
window.location.href = TARGET_URL;
// Sayfanın tamamen yüklenmesini bekle ve ardından 10 saniye bekle
await waitForPageLoad();
await new Promise((resolve) => setTimeout(resolve, 10000)); // 10 saniye bekle
// Tekrar butonları kontrol et ve işlemi devam ettir
clickConnectButtons();
}
// Sayfanın tamamen yüklendiğinden emin olmak için
function waitForPageLoad() {
return new Promise((resolve) => {
if (document.readyState === "complete") {
resolve();
} else {
window.addEventListener("load", resolve);
}
});
}
// Define the constants
let BUTTON_CLASS = ".artdeco-button__text";
let CONNECT = "Bağlantı kur";
let TARGET_URL = "https://www.linkedin.com/mynetwork/"; // İstediğin URL'yi buraya ekle
// Call the function to start the loop
clickConnectButtons();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment