0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

自分用_tin

Posted at

// ==UserScript==
// @name        Tinder自動スワイプ_自分用v24.05
// @namespace    http://tampermonkey.net/
// @version      24.05.01
// @description  Auto swipe for Tinder
// @author       spr
// @match        https://tinder.com/*
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        none
// ==/UserScript==

(function () {
  "use strict";

  let SPEED = 2.5; // スワイプ速度 何秒ごとにスワイプするか ※BANされないように2秒以上にしてください
  let NOPE_RATE = 0.1; // Nopeする確率 何割の確率でNopeするか
  let BIOLEN = 150; // Nopeするプロフの半角英数文字数 プロフに何文字以上の半角英数が含まれていたらNopeするか
  let NAMELEN =  1; // Nopeする名前の半角英数文字数 名前に何文字以上の半角英数が含まれていたらNopeするか
  let KANJILEN = 1; // 名前に何文字以上の漢字が含まれていたらNopeするか
  let DELAY_NOPE_RATE = 3; // 待機Nopeする確率 何割以下の確率で待機してからNopeするか
  let DELAY_SECONDS = 3.0; // 待機する時間 何秒間の待機Nopeするか
  let RELOAD_COUNT = 50; // エラーをするまでのカウント 何回エラーが出たら再読み込みするか


  let result = [];
  let likeCnt = 0;
  let nopeCnt = 0;
  let i = 1;
  let bioSelector;
  let errCnt = 0;
  let nameSelector;
  // try {
  setInterval(clickLikeButton, SPEED * 1000);


  function clickLikeButton() {
    // if (likeCnt + nopeCnt >= i * 50) {
    console.log("【結果発表】\nLIKE:" + likeCnt + " NOPE:" + nopeCnt);
    // i++;
    // }
    try {
      try {
        setTimeout(function () {
          clickInfo();
        }, 500);
        setTimeout(function () {}, 1500);
      } catch (infoErr) {
        console.warn("info err");
      }
      try {
        bioSelector = document.evaluate(
          '//div[contains(@class, "c-ds-text-secondary") and contains(@class, "BreakWord")]',
          document,
          null,
          XPathResult.FIRST_ORDERED_NODE_TYPE,
          null
        ).singleNodeValue.innerText;
      } catch (bioE) {
        bioSelector = "";
        console.log("bio not exists. click info");
        setTimeout(function () {
          clickInfo();
        }, 1000);

        try {
          bioSelector = document.evaluate(
            '//div[contains(@class, "c-ds-text-secondary") and contains(@class, "BreakWord")]',
            document,
            null,
            XPathResult.FIRST_ORDERED_NODE_TYPE,
            null
          ).singleNodeValue.innerText;
          console.log("プロフ:" + bioSelector);
        } catch (bioE) {
          bioSelector = "";
          console.log("bio not exists. click info");
          setTimeout(function () {
            clickInfo();
          }, 1000);
        }
      }
      nameSelector = document.evaluate(
        '//div[contains(@class, "c-ds-text-primary")]//div[contains(@class, "Ell")]',
        document,
        null,
        XPathResult.FIRST_ORDERED_NODE_TYPE,
        null
      ).singleNodeValue.innerText;

      if (
        bioCheck() ||
        engCount(bioSelector) >= BIOLEN ||
        engCount(nameSelector) >= NAMELEN ||
        kanjiCount(nameSelector) >= KANJILEN
      ) {
        console.log("名前:" + nameSelector + "\nプロフ:" + bioSelector);
        clickNopeButton();
      } else {

        let random = Math.random() * 11;
        if (random > NOPE_RATE) {
          likeCnt++;
///////////////////////////////////
likecreateAutoDismissTextBox('LIKEします', 2000);

        } else if (random <= DELAY_NOPE_RATE * 0.1 * NOPE_RATE) {
          // console.log("待機")
          setTimeout(function () {
            clickNopeButton();
          }, DELAY_SECONDS * 1000);
        } else {
          clickNopeButton();
        }
      }
    } catch (error) {
      console.warn("カードがありません:" + errCnt + "回目");
      //debugger;
      console.log(error.message);
      errCnt++;
      if (errCnt > RELOAD_COUNT) {
        location.reload();
      }
    }
  }

  function clickInfo() {
    let infoBtn = document
      .evaluate(
        '//div//button//span[normalize-space(text())="プロフィールを開く"]',
        document,
        null,
        XPathResult.FIRST_ORDERED_NODE_TYPE,
        null
      )
      .singleNodeValue.click();
  }

  function clickNopeButton() {

    nopeCnt++;
///////////////////////////////////
nopecreateAutoDismissTextBox('NOPEします', 2000);


  }



  function engCount(n) {
    let nagasa = 0;
    for (i = 0; i < n.length; i++) {
      if (n[i].match(/^[a-zA-Z]*$/)) {
        nagasa += 1;
      } else {
      }
    }
    return nagasa;
  }

  function kanjiCount(n) {
    let kanjiCnt = 0;
    for (i = 0; i < n.length; i++) {
      if (n[i].match(/^[\u4E00-\u9FFF\u3005-\u3007]+$/)) {
        kanjiCnt += 1;
      } else {
      }
    }
    return kanjiCnt;
  }


function nopecreateAutoDismissTextBox(message, timeout) {
    const textBox = document.createElement('input');
    textBox.type = 'text';
    textBox.value = message;
    textBox.style.position = 'fixed';
    textBox.style.top = '50%';
    textBox.style.left = '50%';
 textBox.style.backgroundColor = 'white';
    textBox.style.transform = 'translate(-50%, -50%)';
    textBox.style.zIndex = 1000; // Ensure the textbox is on top of other elements


   // document.body.appendChild(textBox);

    setTimeout(() => {
      //  document.body.removeChild(textBox);
    }, timeout);

    let nopeButtons = document.evaluate(
      '//button//span[normalize-space(text())="Nope"]',
      document,
      null,
      XPathResult.FIRST_ORDERED_NODE_TYPE,
      null
    ).singleNodeValue;

    setTimeout(() => {
         nopeButtons.click();
    }, 1000);
}


function likecreateAutoDismissTextBox(message, timeout) {
    const textBox = document.createElement('input');
    textBox.type = 'text';
    textBox.value = message;
    textBox.style.position = 'fixed';
    textBox.style.top = '50%';
    textBox.style.left = '50%';
 textBox.style.backgroundColor = 'white';
    textBox.style.transform = 'translate(-50%, -50%)';
    textBox.style.zIndex = 1000; // Ensure the textbox is on top of other elements


    //document.body.appendChild(textBox);

    setTimeout(() => {
     //document.body.removeChild(textBox);
    }, timeout);


        let likeBTN = document.evaluate(
          '//button//span[normalize-space(text())="Like"]',
          document,
          null,
          XPathResult.FIRST_ORDERED_NODE_TYPE,
          null
        ).singleNodeValue;


    setTimeout(() => {
         likeBTN.click();
    }, 1000);

}

//////////////////////////////////////////////////
//以下に除外したいワードを設定してください
//////////////////////////////////////////////////
  function bioCheck() {
    let NG_FLG =
      bioSelector.includes("sta") ||
      bioSelector.includes("witt") ||
      bioSelector.includes("DM") ||
      bioSelector.includes("I'm") ||
      bioSelector.includes("from") ||
      bioSelector.includes("スタ") ||
      bioSelector.includes("Hi") ||
      bioSelector.includes("ついった") ||
      bioSelector.includes("ins") ||
      bioSelector.includes("glish") ||
      bioSelector.includes("デブ") ||
      bioSelector.includes("ぽちゃ") ||
      bioSelector.includes("ぽっちゃり") ||
              bioSelector.includes("いんすた") ||
      bioSelector.includes("TW") ||
              bioSelector.includes("マネージャー") ||
                      bioSelector.includes("マネ") ||
      bioSelector.includes("IG") ||
      bioSelector.includes("セフレ") ||
      bioSelector.includes("t") ||
      bioSelector.includes("T") ||
      bioSelector.includes("w") ||
      bioSelector.includes("セ フ レ") ||
      bioSelector.includes("→") ||
      bioSelector.includes("⇨") ||
      bioSelector.includes("@") ||
      bioSelector.includes("つ");
    return NG_FLG;
  }




})();





0
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?