Sleazy Fork is available in English.

Pornhub视频下载

Pornhub视频下载与链接显示

Per 05-06-2023. Zie de nieuwste versie.

  1. // ==UserScript==
  2. // @name Pornhub视频下载
  3. // @name:en Pornhub website video download
  4. // @namespace http://tampermonkey.net/
  5. // @version 0.1
  6. // @description Pornhub视频下载与链接显示
  7. // @description:en Pornhub video download and link display
  8. // @author geigei717
  9. // @license MIT
  10. // @match https://*.pornhub.com/view_video.php?viewkey=*
  11. // @icon https://img-blog.csdnimg.cn/20181221195058594.gif
  12. // @grant unsafeWindow
  13. // @require https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js
  14. // ==/UserScript==
  15.  
  16. (function() {
  17. var set = setInterval(function(){
  18. url()
  19. },100);
  20.  
  21. function url(){
  22. if(media_5!=undefined&&media_5!==""&&media_5!=null){
  23. stopSet()
  24. $(".video-actions-menu").after('<div class="myporhub" style="color: red;font-size: 13px;"><div class="mp4Url">视频链接:<textarea style="width: 90%;height:50px;background-color: black;color: white;padding: 0 5px; margin-left: 65px;margin-top: -15px;" onclick="this.focus();this.select()" readonly="readOnly"></textarea></div><div class="mp4Donwload" style="height: 40px;line-height: 40px;" >视频下载:<div style="width: 90%;display: -webkit-flex;display: flex;-webkit-justify-content: space-around;justify-content: space-around;margin-top: -40px;margin-left: 10%;" ></div></div>')
  25. $.getJSON(media_5, function(data){
  26. for(let i=0;i<data.length;i++){
  27. var s = data[i]
  28. if(s.defaultQuality==true){
  29. $(".mp4Url").children("textarea").val(s.videoUrl)
  30. }
  31. if(s.format="mp4"){
  32. $(".mp4Donwload>div").append('<input type="button" style="width: 15%;height: 40px;border-radius: 7px;border: none;background-color: #048011;color: white;text-align: center;cursor: pointer;" onclick="downloadUrlFile(\''+s.videoUrl+'\',this)" class="'+s.quality+'p" value="'+s.quality+'p" >')
  33. }else{
  34. $(".mp4Donwload>div").append('<input type="button" style="width: 15%;height: 40px;border-radius: 7px;border: none;background-color: #7d7e85;color: white;text-align: center;" data-src="'+s.videoUrl+'" class="'+s.quality+'p" title="非MP4格式,暂不能下载" disabled value="'+s.quality+'p" >')
  35. }
  36. }
  37. });
  38. }
  39. }
  40.  
  41. function stopSet(){
  42. clearInterval(set);
  43. }
  44.  
  45. /**
  46. * 获取页面文件名
  47. * @param url 文件url
  48. */
  49. unsafeWindow.downloadUrlFile = function (url,obj){
  50. var th = $(obj);
  51. th.val("下载中:0%")
  52. th.attr("disabled", '')
  53. url= url.replace(/\\/g, '/');
  54. var xhr = new XMLHttpRequest;
  55. xhr.open('get', url);
  56. xhr.responseType = 'arraybuffer';
  57. xhr.onprogress = (event) => {
  58. if (event.lengthComputable) {
  59. var loaded = parseInt(event.loaded / event.total * 100);
  60. if(loaded==100){
  61. th.val("下载完成")
  62. th.removeAttr("disabled")
  63. }else{
  64. th.val("下载中:"+loaded+"%")
  65. }
  66. }
  67. }
  68. xhr.onload = function () {
  69. var link = document.createElement('a');
  70. link.href = window.URL.createObjectURL(new Blob([xhr.response]));
  71. link.download = $(".inlineFree").text()+".mp4";
  72. link.click();
  73. link.remove();
  74. };
  75. xhr.onerror = () => {
  76. th.val("下载失败,请重试")
  77. th.removeAttr("disabled")
  78. }
  79. xhr.send();
  80. }
  81. })();