PHDownloader

Pornhub 视频一键下载 | pornhub.com

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

You will need to install an extension such as Tampermonkey to install this script.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği indirebilmeniz için ayrıca Tampermonkey gibi bir eklenti kurmanız gerekmektedir.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         PHDownloader
// @namespace    http://tampermonkey.net/
// @version      0.0.2
// @description  Pornhub 视频一键下载 | pornhub.com
// @author       Hmhm
// @match        *://*.pornhub.com/view_video.php?viewkey=*
// @match        *://*.pornhubpremium.com/view_video.php?viewkey=*
// @icon         https://ci.phncdn.com/www-static/favicon.ico
// @grant        unsafeWindow
// @require      https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js
// @license MIT
// ==/UserScript==

(async function () {
  'use strict';
  const videoWrap = document.querySelector(".video-wrapper")
  const signDom = document.querySelector(".video-wrapper .title-container")
  let remoteAddress
  for (let key in unsafeWindow) {
    if (key.startsWith('flashvars_')) {
      console.log(unsafeWindow[key])
      let flashvars = unsafeWindow[key]
      let mediaDefinitions = flashvars.mediaDefinitions
      mediaDefinitions.some(item => {
        if (item.remote) {
          remoteAddress = item.videoUrl  
        }
      })
    }
  }
  const list = await $.ajax(remoteAddress).then(data => {
    return data
  })
  const dom = document.createElement("div");
  let str = '<div>download list</div><ul class="download_list">';
  list.forEach(item => {
    const { videoUrl, quality } = item
    console.log(item)
    str += `<li><a href="${videoUrl}" target="_blank">${quality}P</a></li>`
  })
  str += '</ul>';
  dom.innerHTML = str
  const fragment = document.createDocumentFragment();
  fragment.appendChild(dom)
  videoWrap.insertBefore(fragment, signDom)
})();