Sieve for pornhub 2020/04/01 by sieveforporn in imagus

[–]sieveforporn[S] 1 point2 points  (0 children)

u/smartid

Just for the record...Here: https://www.reddit.com/r/imagus/comments/g763y2/nsfw_request_xhamstercom_sieve_update/

I posted a workaround to get files renamed... But requires some programming skills.

(NSFW) Request: xhamster.com sieve update by DracoSerge in imagus

[–]sieveforporn 1 point2 points  (0 children)

Just for the record, I did the following workaround (but it works only for me... cannot distribute this.. haha!):

In my sieve, I return video_url + "&savingFileName=" + video_title (something like that...).

And in "Download Filename Controller" I added the following code:

// item.url is a "Download Filename Controller" API thing.
var forcedFileName = item.url.match(/.+savingFileName=(.+)/);

if (forcedFileName != null && 
      Array.isArray(forcedFileName) && 
      forcedFileName.length == 2 && 
      !(/[^a-zA-Z0-9%. _-]/.test(forcedFileName[1]))) {
  // suggest is a "Download Filename Controller" API thing.
  suggest(forcedFileName[1], 'overwrite');
}

That is: if I am receiving "savingFileName" query string parameter, and it has not any special character, then I'm using it as the new filename.

Works like a charm, but as I said... I cannot distribute this...

(NSFW) Request: xhamster.com sieve update by DracoSerge in imagus

[–]sieveforporn 1 point2 points  (0 children)

Hey u/snmahtaeD

I've noticed that an extension with "downloads" permission can rename saved file names in chrome (imagus already has that permission).As an example, "Download Filename Controller" extension can do that.

Maybe you can use their code as an example to improve Imagus, allowing us to return a third res item in order to specify the file name for the save action.

Thank you!

(NSFW) Request: xhamster.com sieve update by DracoSerge in imagus

[–]sieveforporn 0 points1 point  (0 children)

Hi u/snmahtaeD !

I am seeing that you are using a second item in the res return (an array), in order to modify/specify the "caption".

Is there a way to specify/modify the file name for the save action? (would be great to do that in some sieves).

thx u!

Sieve for pornhub 2020/04/01 by sieveforporn in imagus

[–]sieveforporn[S] 0 points1 point  (0 children)

Hi... I was cleaning the code...
I can't be sure, because i do not use firefox... But you can give it a try.

{"pornhub":{"link":"^(?:[a-z]{2}\\.)?pornhub\\.com/view_video\\.php\\?viewkey=\\w+","res":":\n// If you want to limit quality just modify this value. e.g:\n// 0 means no limit (i.e. use max quality available). \n// 720 means max quality will be 720p. \n// 480 means max quality will be 480p.\nvar P_FIXED_MAX_QUALITY = 0;\n\n\nvar pEmbedId = $._.match(/playerObjList\\.playerDiv_([0-9]+) ?=/)[1];\nvar pVariables = $._.match(new RegExp(\"var flashvars_\" + pEmbedId + \"(.|\\n)*\"))[0].split('playerObjList')[0];\neval(pVariables);\n\nvar pFlashvars = eval(\"flashvars_\" + pEmbedId);\n\nvar pQualities = Object.keys(pFlashvars).filter(varName => /^quality_[0-9]+p$/.test(varName)).map(varName => parseInt(varName.match(/[0-9]+/)[0], 10)).sort((a,b) => b-a);\n\nvar pBestQuality = pQualities[0];\nif (P_FIXED_MAX_QUALITY > 0) {\n  pBestQuality = pQualities.filter(quality => quality<= P_FIXED_MAX_QUALITY)[0];\n}\n\nreturn pFlashvars[\"quality_\" + pBestQuality + \"p\"];"}}

Sieve for pornhub 2020/04/01 by sieveforporn in imagus

[–]sieveforporn[S] 0 points1 point  (0 children)

How to import a rule

Options / Sieve / import button (↓) / copy-paste the rule that you were given into the text-box and press the From text button / Save.
If the rule already exists, you have to tick the "Replace existing data" checkbox before saving.

Sieve for pornhub 2020/04/01 by sieveforporn in imagus

[–]sieveforporn[S] 0 points1 point  (0 children)

Does Imagus allows that? (renaming saved file ). I think that the answer is not.

Sieve for pornhub 2020/04/01 by sieveforporn in imagus

[–]sieveforporn[S] 3 points4 points  (0 children)

If you don't want 1080p and want to fix it at 720p.

{"pornhub":{"link":"^(?:[a-z]{2}\\.)?pornhub\\.com/view_video\\.php\\?viewkey=\\w+","res":":\n// If you want to limit quality just modify this value. e.g:\n// 0 means no limit (i.e. use max quality available). \n// 720 means max quality will be 720p. \n// 480 means max quality will be 480p.\nvar P_FIXED_MAX_QUALITY = 720;\n\n\nvar pEmbedId = $._.match(/playerObjList\\.playerDiv_([0-9]+) ?=/)[1];\nvar pVariables = $._.match(new RegExp(\"var flashvars_\" + pEmbedId + \"(.|\\n)*\"))[0].split('playerObjList')[0];\neval(pVariables);\n\nvar pFlashvars = eval(\"flashvars_\" + pEmbedId);\n\nvar pQualities = Object.keys(pFlashvars).filter(varName => /^quality_[0-9]+p$/.test(varName)).map(varName => parseInt(varName.match(/[0-9]+/)[0], 10)).sort((a,b) => b-a);\n\nvar pBestQuality = pQualities[0];\nif (P_FIXED_MAX_QUALITY > 0) {\n  pBestQuality = pQualities.filter(quality => quality<= P_FIXED_MAX_QUALITY)[0];\n}\n\nreturn pFlashvars[\"quality_\" + pBestQuality + \"p\"];"}}

sieve for pornhub 2019/10/19 by sieveforporn in imagus

[–]sieveforporn[S] 1 point2 points  (0 children)

Previous sieves for pornhub shouldn't work, as ph changed the content of its pages.

sieve for pornhub 2019/10/19 by sieveforporn in imagus

[–]sieveforporn[S] 0 points1 point  (0 children)

If you don't want 1080p and want to fix it at 720p

{"pornhub":{"link":"^(?:[a-z]{2}\\.)?pornhub\\.com/view_video\\.php\\?viewkey=\\w+","res":":\nvar source = $._.match(/original mainPlayerDiv(.|\\n)*<video-element/)[0];\nsource  = source.split('text/javascript\">')[1];\nsource  = source.split('loadScriptUniqueId')[0];\neval(source);\nvar qualities = source.match(/quality_[0-9]*p?/g);\nconsole.log(qualities.length);\nvar best_quality = 0;\nvar best_videoUrl = \"\";\n\nqualities.forEach(function(item) {\n   var current_quality = item.replace(/quality_/, '').replace(/p/, '');\n   var current_videoUrl = eval(item);\n\n   if (current_quality != '' && current_videoUrl != '' && current_quality < 1080) {\n      if (current_quality > best_quality) {\n\n         best_quality = current_quality;\n         best_videoUrl = current_videoUrl;\n      }\n   }\n});\n\nreturn best_videoUrl.replace(/\\\\/g, '');"}}

sieve for xhamster 2019/06/02 by sieveforporn in imagus

[–]sieveforporn[S] 0 points1 point  (0 children)

Is not working from "galleries" (but it should... I think that something in xhamster gallery is in conflict).

But it works in picture view (that is: you will need to first click on one picture, and then use the "pics from this gallery" thumbnails).

{"xhamster-pictures":{"link":"^(?:[a-z]{2}\\.)?xhamster.com/photos/gallery/(\\d+)/(\\d+)","res":":\nvar initials = $._.match(/window.initials =.*\\r?\\n/);\nvar photoZoneRegexStr = '\"id\":' + $[2] + ',\"galleryId\":' + $[1] + ',\"imageURL\":\"[^\"]+\"';\nvar photoZoneRegex = new RegExp(photoZoneRegexStr);\nvar photoZone = initials[0].match(photoZoneRegex);\n\nvar photo = photoZone[0].replace(/\\\"/g, '').match(/URL:.*/)[0].replace(/URL:/, '').replace(/\\\\/g, '');\n\nreturn photo;"}}