javascript - Accessing soundcloud's lib/audiomanager via on-page JS -



javascript - Accessing soundcloud's lib/audiomanager via on-page JS -

i maintain greasemonkey script monitors current track playing progress on soundcloud. previously, require("lib/audiomanager") access object allow me view state of entire page such playing track info.

the issue is, soundcloud has moved using webpack clientside javascript. stores these classes specific number in package, understanding. number stored appears alter every time clientside js updated , recompiled.

the way access objects stored within webpack appears via global webpackjsonp, below. number pack needs unique.

webpackjsonp([6060], { 0: function (e, t, n) { window.aman = n(726); e.exports = function (abc) { console.log("exports called"); }; } });

that code execute , give me access object @ number in webpack. object defined in clientside webpack'd js is:

726: function (e, t, n) { (function (t) { function i(e) { var n = t(e.getcontainerelement()), = e.getstate() === r.states.error; n.toggleclass('blocked', i) } var r, s = n(53), o = n(14), = 1000 / 60; e.exports = r = new s({ flashaudiopath: n(2181), flashobjectid: 'flashaudioobject', updateinterval: a, debug: !1 }), r.errors = s.errors, r.states = s.states, r.update_interval = a, o.once('audio:flash_block audio:flash_unblock', i) }) .call(t, n(1)) },

so, solutions can think of:

find object webpack number not change, can utilize handle object iterate every webpack number , object has same set of methods one.

the latter seems messy, , first seems impossible. ideas?

things i've tried:

making new n(53) desired object seems remain same across updates. gives me audiomanager, separate page's normal audiomanager, can't see playing.

afaik can access packages package. soundcloud doesn’t utilize provideplugin none of libraries , modules available global space.

updated:

i know it’s ugly hack works:

class="snippet-code-js lang-js prettyprint-override">webpackjsonp([6060], { 0: function (e, t, n) { var = 0, found = false, lib; while (i < 2000 && !found) { seek { lib = n(i); } grab (err) { lib = null; } if (lib && typeof lib._mute !== 'undefined') { found = true; console.log('found', lib, i); } console.log(i, lib); i++; } window.aman = lib; } });

javascript soundcloud webpack

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -