Open wilyarti opened 5 years ago
would you please tell me how to get this to run, I'm still noob
Yeah sure.
First open up the console on your browser (Ctrl + Shift + C). Paste these lines until they do not show an error (this loads jQuery and creates the regex function):
var jq = document.createElement('script');
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
// ... give time for script to load, then type (or see below for non wait option)
jQuery.noConflict();
jQuery.expr[':'].regex = function(elem, index, match) {
var matchParams = match[3].split(','),
validLabels = /^(data|css):/,
attr = {
method: matchParams[0].match(validLabels) ?
matchParams[0].split(':')[0] : 'attr',
property: matchParams.shift().replace(validLabels,'')
},
regexFlags = 'ig',
regex = new RegExp(matchParams.join('').replace(/^\s+|\s+$/g,''), regexFlags);
return regex.test(jQuery(elem)[attr.method](attr.property));
}
Then the rest of the code should run:
// find all low quality links and click on them.
$(':regex(title, Audio file.*)').next().each( function(index, element) {
element.click();
});
There is a much better way I'm sure. But I was too lazy to go through the code to see how it works.
I just used jQuery and a regex function to download all videos. I'm too lazy to click on each video.
It's probably a horrible idea but here goes:
// regex function for jQuery - https://j11y.io/javascript/regex-selector-for-jquery/ jQuery.expr[':'].regex = function(elem, index, match) { var matchParams = match[3].split(','), validLabels = /^(data|css):/, attr = { method: matchParams[0].match(validLabels) ? matchParams[0].split(':')[0] : 'attr', property: matchParams.shift().replace(validLabels,'') }, regexFlags = 'ig', regex = new RegExp(matchParams.join('').replace(/^\s+|\s+$/g,''), regexFlags); return regex.test(jQuery(elem)[attr.method](attr.property)); } // find all low quality links and click on them. $(':regex(title, Audio file.*)').next().each( function(index, element) { element.click(); });
There is probably a better way than this and it relies on jQuery. But it seems to work fine.
Thanks for sharing this information
If you want a jQuery less version that downloads the highest quality.
document.querySelectorAll('a[title^="Audio file"]').forEach(node => {
let sibling = node;
while (sibling.nextSibling) sibling = sibling.nextSibling;
sibling.click()
});
I just used jQuery and a regex function to download all videos. I'm too lazy to click on each video.
It's probably a horrible idea but here goes:
There is probably a better way than this and it relies on jQuery. But it seems to work fine.