kone
비디오가게
비디오가게

픽팍 비밀번호 자동입력 업데이트

🪪정보
25,877 views · 12 points

https://kone.gg/s/pornvideo/a_ZpyfobfXMVn_IyMN0P8b

해당 게시물의 비밀번호 자동입력기가 제대로 작동하지 않는것 같아 업데이트 했어요

사용법은 이전 글 참조부탁드려요

아래 코드 그대로 붙여넣으면 사용가능해요

// ==UserScript==
// @name        PikPak 비밀번호 자동 입력 및 파일 보기
// @namespace   Violentmonkey Scripts
// @match       https://mypikpak.com/s/*
// @grant       GM_setValue
// @grant       GM_getValue
// @version     1.7
// @author      사용자
// @description 공유 링크의 비밀번호를 입력하고 파일 보기 버튼이 활성화되면 클릭합니다.
// ==/UserScript==

(function () {
    'use strict';

    let savedPassword = GM_getValue('pikpak_pw', '1234');
    let submitted = false;
    let checking = false;

    function createSettingsUI() {
        const container = document.createElement('div');
        container.style.cssText = `
            position: fixed;
            top: 5px;
            left: 300px;
            z-index: 999999;
            background: transparent;
            color: white;
            border-radius: 8px;
            font-family: sans-serif;
            font-size: 13px;
        `;

        const miniUI = document.createElement('div');
        miniUI.innerText = '🔑';
        miniUI.style.cssText = 'font-size: 20px; cursor: pointer; opacity: 0.5; padding: 5px;';

        const fullUI = document.createElement('div');
        fullUI.style.cssText = `
            display: none;
            align-items: center;
            gap: 8px;
            padding: 10px;
            background: rgba(0, 0, 0, 0.8);
            border-radius: 8px;
            box-shadow: 0 4px 6px rgba(0,0,0,0.3);
        `;

        const label = document.createElement('span');
        label.innerText = '자동 비밀번호:';

        const input = document.createElement('input');
        input.type = 'text';
        input.value = savedPassword;
        input.style.cssText = 'width: 80px; padding: 4px; border-radius: 4px; border: none; text-align: center; color: black;';

        const saveBtn = document.createElement('button');
        saveBtn.innerText = '저장';
        saveBtn.style.cssText = 'padding: 4px 8px; cursor: pointer; border: none; border-radius: 4px; background: #306eff; color: white;';

        saveBtn.addEventListener('click', () => {
            const newPassword = input.value.trim();
            if (!newPassword) {
                alert('비밀번호를 입력해주세요.');
                return;
            }
            GM_setValue('pikpak_pw', newPassword);
            savedPassword = newPassword;
            alert('비밀번호가 저장되었습니다.');
            scheduleCheck();
        });

        fullUI.append(label, input, saveBtn);
        container.append(miniUI, fullUI);
        document.body.appendChild(container);

        container.addEventListener('mouseenter', () => {
            miniUI.style.display = 'none';
            fullUI.style.display = 'flex';
        });
        container.addEventListener('mouseleave', () => {
            miniUI.style.display = 'block';
            fullUI.style.display = 'none';
        });
        miniUI.addEventListener('mouseenter', () => { miniUI.style.opacity = '1'; });
        miniUI.addEventListener('mouseleave', () => { miniUI.style.opacity = '0.5'; });
    }

    function findFileButton() {
        return [...document.querySelectorAll('button.pp-primary-button')]
            .find(button => button.textContent.includes('파일 보기')) ||
            [...document.querySelectorAll('button')]
                .find(button => button.textContent.includes('파일 보기'));
    }

    function buttonIsEnabled(button) {
        return !button.disabled && button.getAttribute('aria-disabled') === 'false';
    }

    function fillPassword(input) {
        // 사이트의 입력 이벤트 처리기가 값 변경을 알아차리도록 기본 setter를 사용합니다.
        const setter = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value').set;
        setter.call(input, savedPassword);
        input.dispatchEvent(new Event('input', { bubbles: true }));
        input.dispatchEvent(new Event('change', { bubbles: true }));
    }

    function checkPage() {
        if (submitted) return;

        const passwordInput = document.querySelector('input[placeholder="비밀번호를 입력해주세요"]');
        const button = findFileButton();
        if (!passwordInput || !button || !savedPassword) return;

        // 로딩 중 DOM이 다시 만들어져 입력값이 사라지면 다시 입력합니다.
        if (passwordInput.value !== savedPassword) {
            fillPassword(passwordInput);
            return; // 입력 이벤트에 대한 사이트의 처리가 끝난 뒤 버튼 상태를 다시 확인합니다.
        }

        if (buttonIsEnabled(button)) {
            submitted = true;
            observer.disconnect();
            clearInterval(fallbackInterval);
            button.click();
        }
    }

    function scheduleCheck() {
        if (checking || submitted) return;
        checking = true;
        setTimeout(() => {
            checking = false;
            checkPage();
        }, 0);
    }

    function start() {
        createSettingsUI();
        observer.observe(document.documentElement, {
            childList: true,
            subtree: true,
            attributes: true,
            attributeFilter: ['disabled', 'aria-disabled', 'ariadisabled', 'class']
        });
        scheduleCheck();
    }

    const observer = new MutationObserver(scheduleCheck);
    // 이벤트를 놓치거나 사이트가 입력값만 바꾼 경우에도 다시 확인합니다.
    const fallbackInterval = setInterval(scheduleCheck, 500);

    if (document.body) start();
    else document.addEventListener('DOMContentLoaded', start, { once: true });
})();

12
4 comments
매번 적기 귀찮았는데 감사합니다~
안 되는데 뭐가 문제일까요
유저스크립트 사용이 처음이시라면 확장프로그램 설정문제 일 가능성이 높습니다. 확장프로그램 설정 -> 사용자 스크립트 허용에 체크해주셔야해요
All
Title
Body