Diskuse » Creation Requests

is it possible?

§
Posted: 02. 08. 2016

is it possible?

Is it possible to change the user agent and/or vendor version using a userscript or is it possible to fool/disable an inline script that checks for that?

The script is

http://pastebin.com/Fyaaa9F0

§
Posted: 02. 08. 2016

I'm not sure what that says. However, it seems to be checking the value of navigator.userAgent.

Theoretically you could override that value. My closest experience with that is the following script (not related to useragent). Perhaps you can find examples for useragent online.

https://greasyfork.org/en/scripts/18256-hide-all-plugins/code

You can use the following page to test (you can't override the headers, check the JavaScript test section):

https://www.jeffersonscher.com/res/jstest.php

§
Posted: 02. 08. 2016

Thanks for the help.

§
Posted: 02. 08. 2016
Edited: 02. 08. 2016

I'm Still having trouble I was able to change the navigator.useragent value but not with the results I was expecting.

If I'm not mistaken the scripts sets a number based on how many coincidences or not it finds on your useragent vendor and window.opera strings depending on the number you either get an error the default browser player or jwplayer.

Using an add-on (which I cant keep but I tested it. And spoofing an mobile useragent I was able to get the default borwser player. Using internet explorer to open it (ie11 on w7 x64) I was able to get the jwplayer but If I try to put the useragent of ie on firefox with the add-on I get the error. Using the mobile/ie useragent with the script also gives me the error.

navigator.__defineGetter__('userAgent', function(){
return 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; xx-xx) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7'
});

The page that uses it is http://animeflv.net/ver/nanatsu-no-taizai-9.html for the video on option 1 only.

§
Posted: 02. 08. 2016

I do not know enough JavaScript to understand what you posted. Following along the lines of the script I referred to:

// ==UserScript==
// @name        Me Is IE
// @description Replace useragent string with an IE string
// @namespace   YourNameHere
// @include     http*://www.jeffersonscher.com/res/jstest.php
// @version     0.5
// @grant       none
// @run-at      document-start
// ==/UserScript==
Object.defineProperty(navigator, "userAgent", {value: "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko"});
§
Posted: 02. 08. 2016
Edited: 02. 08. 2016

Thanks but like I said I managed to change the user agent but it does not work (as in the site animeflv wont change it's behavior) unless I use and add-on also the user agent has to be from a mobile device and that only allows me to see the default player not the Jwplayer which would be optimal. Changing it to IE with the add-on or script does not work which is strange cause if I open that webpage on IE it does show the jwplayer.

§
Posted: 02. 08. 2016

I didn't understand half of the above, but if you wish to use the HTML5 player instead of the Flash-player, the easiest way would be disabling Flash.

§
Posted: 02. 08. 2016

@gnblizz That worked. Is there a way to disable it with a script only for the Izanagi player so I dont have to use the add-on to do so on a specific website? Or is there a way to configure something to make it work anywhere but for izanagi?

§
Posted: 03. 08. 2016
Edited: 03. 08. 2016

You can disable Flash on a site using the Permissions panel in the Page Info dialog. This doesn't hide it from a site, but the site can't actually use it. Not sure that will help you, but it's worth a try.

You can call up Page Info using any of these:

* right-click a blank area of the page and choose View Page Info > Permissions
* (menu bar) Tools menu > Page Info > Permissions
* click the padlock or "i" icon to the left of the site address, then the ">" icon, then More Information > Permissions

Near the top, you'll find a line for Adobe Flash and you can choose Block. Then close Page Info and reload the page to see what effect that has.

§
Posted: 03. 08. 2016
Edited: 03. 08. 2016

Edited: I tested and if you set the value to block It will still try to load the flashplayer, it wont switch to html5.

On the inline script it says

jwplayer('player').setup({
primary: 'flash',
});

Is there a way to change it to primary html5 or null?

An other way would be to make this script always return the html5 player but idk how to do either.

https://animeflv.net/js/JW7/jwplayer.js

§
Posted: 03. 08. 2016
// ==UserScript==
// @name        disguise
// @description disguise as a mobile
// @namespace   gnblizz
// @include     https://animeflv.net/embed_izanagi.php*
// @grant       none
// @run-at      document-start
// ==/UserScript==
Object.defineProperty(navigator, "userAgent", {value: "android"});
console.log('I am now',navigator.userAgent);
§
Posted: 03. 08. 2016
Edited: 03. 08. 2016

@gnblizz Thanks but that does not work. Changing the UA only works if the http header is changed also I think. Only changing the navigator.useragent value does not work. Disabling flash does but bloking it on the site doesnt.

@gnblizz @"Jefferson Scher"
Do you know how to make the jwplayer think you don't have flash with a script or do you know how to modify the jwplayer preference to display HTML5 over flash? Maybe It could also work if you make it think you have flash for IE installed.

§
Posted: 04. 08. 2016

I have uninstalled Flash a long time ago, so I didn't test against it.
On my system with the the script the plain native HTML5 player was active, instead of the fancy full featured HTML5 player.
I think I'll do some more research at the weekend.
P.S:
Have you checked, if the script did change the userAgent. The include could be wrong.

§
Posted: 04. 08. 2016
Edited: 04. 08. 2016

Thank you, It changes the navigator.useragent value but if you test it on the page that jefferson provided you'll see that there is a navigator UA string and a http referrer that contain the UA as well and those only change when you use an add-on to change them. I assume the script somehow looks at that too cause just changing the navigator.useragent does not affect how the player is displayed.

§
Posted: 04. 08. 2016

I didn't include Jeffersons url because of:


The page that uses it is http://animeflv.net/ver/nanatsu-no-taizai-9.html for the video on option 1 only.

Would you like try this then ?:

// ==UserScript==
// @name        disguise
// @description disguise as a mobile
// @namespace   gnblizz
// @include     https://animeflv.net/embed_izanagi.php*
// @include     http*://www.jeffersonscher.com/res/jstest.php
// @grant       none
// @run-at      document-start
// ==/UserScript==
Object.defineProperty(navigator, "userAgent", {value: "Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19"});
console.log('I am now',navigator.userAgent);

Again, please check, if the console says "I am now..."

§
Posted: 05. 08. 2016
Edited: 05. 08. 2016

I does not work. Like I said the script is not the problem. The script on itself does work but this script does not solve the issue of the player blocking the video.

The best shot was to disable flash to make the html5 player load instead of that one. The html player does not have this restriction of the user agent thing.

Is there a way to make the script make the page think that there is no flash installed or that the flash version is the IE version or is there a way to change the preference of the jwplayer to prioritize html5 over flash?

§
Posted: 05. 08. 2016
Edited: 05. 08. 2016

Thanks for trying. (Reason was jwplayer has a procedure isFlashSupported which works differently if isAndroidNative returns true.)
Javascript usually ask for Flash using navigator.plugins['Shockwave Flash'] , but it is write protected and i have to find out how to manipulate the PluginArray. However, hiding Flash might actually work.

§
Posted: 05. 08. 2016
Edited: 05. 08. 2016

OK, something to try again: wait it throes now an exception

// ==UserScript==
// @name        noflash
// @description hides flash for certain sites
// @namespace   gnblizz
// @include     https://animeflv.net/embed_izanagi.php*
// @include     http*://www.jeffersonscher.com/res/jstest.php
// @grant       none
// @run-at      document-start
// ==/UserScript==
var flashName = 'Shockwave Flash';
var origPluginArray = window.navigator.plugins;
var myPluginArray = {};
function initPluginArray(a) {
  var i = -1, k = -1, l = origPluginArray.length;
  while(++i < l) {
    console.log(i);
    console.log(origPluginArray[i].name);
    var plugin = origPluginArray[i];
    if(!plugin)
      break;
    if(plugin.name != flashName)
      a[(++k).toString()] = plugin; // this is wrong!
    else
      console.log(flashName, 'plugin removed for', location.hostname);
  };
  a.__proto__ = origPluginArray.__proto__;
  return i > k;
};
if(initPluginArray(myPluginArray))
  Object.defineProperty(navigator, "plugins", {value: myPluginArray});
else
  console.log('noflash not successful!');

If this works, I can make a regular script from it.

§
Posted: 06. 08. 2016

@gnblizz Wow dude it works. You are great. You should publish it IMO.

§
Posted: 07. 08. 2016

As a test page, you can include this one instead:

http*://www.jeffersonscher.com/res/plugins.html

Post reply

Sign in to post a reply.