XVideos Filter

Filter xvideos search results based on preferences

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         XVideos Filter
// @namespace    XVideos Filter
// @version      0.1
// @description  Filter xvideos search results based on preferences
// @author       EmersonxD
// @match        https://www.xvideos.com/tags/*
// @grant        none
// ==/UserScript==

(function() {
  'use strict';

  // Define your search terms and preferences here
  var searchTerm = "conhece";
  var preferences = ["HD", "1080p", "longa"];

  // Get the search results page
  var url = `https://www.xvideos.com/tags/${searchTerm}`;
  var xhr = new XMLHttpRequest();
  xhr.open('GET', url, true);
  xhr.onload = function() {
    if (xhr.status === 200) {
      var soup = new DOMParser().parseFromString(xhr.responseText, 'text/html');
      var videos = [];
      var videoElements = soup.querySelectorAll('div.thumb');
      for (var i = 0; i < videoElements.length; i++) {
        var video = videoElements[i];
        var title = video.querySelector('a.title').textContent.trim();
        var duration = video.querySelector('span.duration').textContent.trim();
        var quality = video.querySelector('span.quality').textContent.trim();
        
        if (preferences.every(p => quality.includes(p))) {
          videos.push({ title, duration, quality });
        }
      }
      
      // Print the filtered videos
      for (var i = 0; i < videos.length; i++) {
        console.log(`Title: ${videos[i].title}, Duration: ${videos[i].duration}, Quality: ${videos[i].quality}`);
      }
    }
  };
  xhr.send();
})();