yt-dlp support
This commit is contained in:
21
node_modules/@pedroslopez/moduleraid/LICENSE
generated
vendored
Normal file
21
node_modules/@pedroslopez/moduleraid/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018 Andreas N.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
85
node_modules/@pedroslopez/moduleraid/README.md
generated
vendored
Normal file
85
node_modules/@pedroslopez/moduleraid/README.md
generated
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
**NOTE** This package was modified from pixeldesu's original moduleRaid for compatibility with webpack v5 used in WhatsApp Web. No support will be given outside of anything strictly necessary to extract modules in WhatsApp Web.
|
||||
|
||||
<div align='center'>
|
||||
<img width=200px src='.github/logo.png?raw=true'>
|
||||
|
||||
<h1>moduleRaid</h1>
|
||||
<p>moduleRaid is a utility to get modules and module constructors from <code>webpackJsonp</code> functions embedded on websites by Webpack. It also provides functions to search through returned modules.</p>
|
||||
</div>
|
||||
|
||||
<h2 align='center'>Installation</h2>
|
||||
|
||||
You can get moduleRaid over npm
|
||||
|
||||
```
|
||||
$ npm install moduleraid
|
||||
```
|
||||
|
||||
Or if you directly want to use it in the browser
|
||||
|
||||
```html
|
||||
<script src="https://unpkg.com/moduleraid@4.0.1/moduleraid.js"></script>
|
||||
<!-- minified -->
|
||||
<script src="https://unpkg.com/moduleraid@4.0.1/moduleraid.min.js"></script>
|
||||
```
|
||||
|
||||
Alternatively, just copy the script from `moduleraid.js` and run it in a devtool console
|
||||
on the site of your choosing.
|
||||
|
||||
<h2 align='center'>Usage</h2>
|
||||
|
||||
### Preparation
|
||||
|
||||
Using `moduleRaid` as a module, simply require and execute it somewhere where it will end up as a public facing script on a page that also
|
||||
includes a Webpack build!
|
||||
|
||||
```js
|
||||
const moduleRaid = require('moduleraid')
|
||||
|
||||
window.mR = moduleRaid()
|
||||
```
|
||||
|
||||
If you a running the script from the console or loading it over a service like unpkg, no further need for preparations!
|
||||
|
||||
### The `moduleraid` object
|
||||
|
||||
Once `moduleRaid` is run or included on a page that includes a Webpack build (usually noted by a `webpackJsonp` function), it
|
||||
will return a object, containing:
|
||||
|
||||
* `modules`: An object containing all modules we could get from Webpack
|
||||
* `constructors`: An array containing all module constructor functions
|
||||
* `get(id)`: Get the module from the specified `id`
|
||||
* `findModule(query)`: Return the module that has `query` as a key in its exports
|
||||
* `findFunction(query)`: Return functions that include `query` (`query` can be either a string or a function)
|
||||
|
||||
If you run the code in devtools or load it as external script from unpkg/etc. the `moduleRaid` object can be found in `window.mR` by default.
|
||||
|
||||
**Note:** If moduleRaid had to get modules through iteration, `constructors` will be empty and so `findFunction` will not work.
|
||||
|
||||
#### Debug Mode
|
||||
|
||||
If you call moduleRaid with an optional argument `true`, you will enable debug output. Debug output will show errors that are normally supressed.
|
||||
|
||||
In the version that is minified and you can't just add another argument easily, simply run `window.mRdebug = true` before adding the script and you should
|
||||
be fine!
|
||||
|
||||
<h2 align='center'>How it works</h2>
|
||||
|
||||
There already was a script basically doing the same as `moduleRaid` some months earlier, called [`webcrack`](https://gist.github.com/no-boot-device/cb63762000e606e50690911cac1bcead) (made by [no-boot-device](https://github.com/no-boot-device)), which was rendered obsolute due to structural changes in how you can access Webpack modules from the outside.
|
||||
|
||||
This library is an effort to bring back the ability to inspect all available modules, for debugging or userscript purposes.
|
||||
|
||||
As noted above, Webpack exposes a function `webpackJsonp` containing all the code that has been bundled with Webpack. The function takes three
|
||||
parameters, all of them being an array. The first two don't seem to really matter, the last one is interesting, it seems to directly return
|
||||
a module given an index.
|
||||
|
||||
So, in a brute-forcy manner we simply run a `while` over `webpackJsonp([], [], [i])` until we get an exception from Webpack (trying to run `call`
|
||||
on `undefined`), and now we have all modules (_or most of them_)!
|
||||
|
||||
<h2 align='center'>Known Issues</h2>
|
||||
|
||||
* There seem to be a lot of empty modules, I'm not sure if these are _padding_ or something is missing here
|
||||
|
||||
<h2 align='center'>License</h2>
|
||||
|
||||
moduleRaid is licensed under the MIT License
|
||||
73
node_modules/@pedroslopez/moduleraid/moduleraid.js
generated
vendored
Normal file
73
node_modules/@pedroslopez/moduleraid/moduleraid.js
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
/* moduleRaid v5
|
||||
* https://github.com/@pedroslopez/moduleRaid
|
||||
*
|
||||
* Copyright pixeldesu, pedroslopez and other contributors
|
||||
* Licensed under the MIT License
|
||||
* https://github.com/pedroslopez/moduleRaid/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
const moduleRaid = function () {
|
||||
moduleRaid.mID = Math.random().toString(36).substring(7);
|
||||
moduleRaid.mObj = {};
|
||||
|
||||
fillModuleArray = function() {
|
||||
(window.webpackChunkbuild || window.webpackChunkwhatsapp_web_client).push([
|
||||
[moduleRaid.mID], {}, function(e) {
|
||||
Object.keys(e.m).forEach(function(mod) {
|
||||
moduleRaid.mObj[mod] = e(mod);
|
||||
})
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
||||
fillModuleArray();
|
||||
|
||||
get = function get (id) {
|
||||
return moduleRaid.mObj[id]
|
||||
}
|
||||
|
||||
findModule = function findModule (query) {
|
||||
results = [];
|
||||
modules = Object.keys(moduleRaid.mObj);
|
||||
|
||||
modules.forEach(function(mKey) {
|
||||
mod = moduleRaid.mObj[mKey];
|
||||
|
||||
if (typeof mod !== 'undefined') {
|
||||
if (typeof query === 'string') {
|
||||
if (typeof mod.default === 'object') {
|
||||
for (key in mod.default) {
|
||||
if (key == query) results.push(mod);
|
||||
}
|
||||
}
|
||||
|
||||
for (key in mod) {
|
||||
if (key == query) results.push(mod);
|
||||
}
|
||||
} else if (typeof query === 'function') {
|
||||
if (query(mod)) {
|
||||
results.push(mod);
|
||||
}
|
||||
} else {
|
||||
throw new TypeError('findModule can only find via string and function, ' + (typeof query) + ' was passed');
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
return {
|
||||
modules: moduleRaid.mObj,
|
||||
constructors: moduleRaid.cArr,
|
||||
findModule: findModule,
|
||||
get: get
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof module === 'object' && module.exports) {
|
||||
module.exports = moduleRaid;
|
||||
} else {
|
||||
window.mR = moduleRaid();
|
||||
}
|
||||
29
node_modules/@pedroslopez/moduleraid/package.json
generated
vendored
Normal file
29
node_modules/@pedroslopez/moduleraid/package.json
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"name": "@pedroslopez/moduleraid",
|
||||
"version": "5.0.2",
|
||||
"description": "Get modules from webpack v5",
|
||||
"main": "moduleraid.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"types": "./moduleraid.d.ts",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/pixeldesu/moduleRaid.git"
|
||||
},
|
||||
"keywords": [
|
||||
"webpack",
|
||||
"module",
|
||||
"research",
|
||||
"extraction"
|
||||
],
|
||||
"files": [
|
||||
"moduleraid.js"
|
||||
],
|
||||
"author": "Andreas Nedbal <andy@pixelde.su>, Pedro Lopez <pedroslopez@me.com>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/pixeldesu/moduleRaid/issues"
|
||||
},
|
||||
"homepage": "https://github.com/@pedroslopez/moduleRaid#readme"
|
||||
}
|
||||
Reference in New Issue
Block a user