Giter Club home page Giter Club logo

Comments (9)

ivideom avatar ivideom commented on September 22, 2024 4

You may try a workaround like this:

--- a/src/inject/main-player-page-hls.js
+++ b/src/inject/main-player-page-hls.js
@@ -33,9 +33,8 @@ function main(utils, parameters = {}) {
                        const arr = [];
                        try {
                                const segments = player.tech_.hls.playlists.media_.segments;
-                               segments.forEach(x => arr.push({ uri: x.resolvedUri }));
-                               arr.forEach(videojs.Hls.xhr.beforeRequest);
-                               arr.forEach(x => typeof x.decryptURI === 'function' && x.decryptURI());
+                               segments.forEach(x => arr.push({ uri: x.resolvedUri, method: "HEAD", timeout: 50 }));
+                               arr.forEach(x => x.uri = videojs.Hls.xhr(x, function(){}).uri);
                        } catch (error) {
                                return logError(error);
                        }

It works, though hundreds of requests will be sent (querying for response headers only, no data)...

from chrome-avgle-helper.

ivideom avatar ivideom commented on September 22, 2024 4

tried the workaround but still getting the same error.

function main(utils, parameters = {}) {
// #21
waitForVideoJS(100, () => {
const player = videojs('video-player');
player.on('loadedmetadata', () => {
logInfo(Detected the hls.js loadedmetadata event!);

		const arr = [];
		try {
			const segments = player.tech_.hls.playlists.media_.segments;
			//segments.forEach(x => arr.push({ uri: x.resolvedUri }));
			//arr.forEach(videojs.Hls.xhr.beforeRequest);
			//arr.forEach(x => typeof x.decryptURI === 'function' && x.decryptURI());
			segments.forEach(x => arr.push({ uri: x.resolvedUri, method: "HEAD", timeout: 50 }));
            arr.forEach(x => x.uri = videojs.Hls.xhr(x, function(){}).uri);
			
		} catch (error) {
			return logError(error);
		}

Note that you will need to rebuild the chrome extension after src code updated.
(And may need to restart chrome to load the updated extension)

# Install Node.js and yarn
# Visit: https://nodejs.org/en/
# And https://yarnpkg.com/getting-started/install

# Install dependencies
yarn install

# Launch builder script
yarn run build

from chrome-avgle-helper.

cooltoy99 avatar cooltoy99 commented on September 22, 2024 1

I'm encountering the below warning and causing the script to retry wget again without Referer header, it can be fixed by updating the download.sh and downloader-hls.sh in your extension/dist folder (re-import after updating the sh).

Avgle_wget_warn

Replace
"$WGET_BIN" "$ref1" "$ref2" --header "User-Agent: $CFG_USER_AGENT" "$out1" "$out2" $2;

With
if [[ -n "$3" ]]; then "$WGET_BIN" "$ref1" "$ref2" --header "User-Agent: $CFG_USER_AGENT" "$out1" "$out2" $2; else "$WGET_BIN" "$ref1" "$ref2" --header "User-Agent: $CFG_USER_AGENT" $2; fi

from chrome-avgle-helper.

chenhow83 avatar chenhow83 commented on September 22, 2024

After modified still getting error.

download-FC2-PPV-1648397.sh: line 886: ((: i<=!WU1HRUQLSxgLQgNQBAVTWgVUBRlXAAhIEF5eRg9SRF1VXFwbVF4JGAlXSF9LXwk1USdcU3IxMTERWRxQLX9qTkZeH0YKHQFZBg8AVAMEU1AEWwUCGAgPCwhFDAVMU1NAUAQCAwYAVQRRCwFXHUYWAkMHCG51AgI8TEt6GBFSVFFDXEEIUV4WVAceHwNEUg4GGQFaWhsWAwAVUFYKVgEDBAgPBwEYXAFTC1MMCl5GI0xEEVEDG1VRUU4IHgVQAAsBAQ4GDBlcFANNQVQFHwZbVBoUBBpVVUgSEg== : syntax error: operand expected (error token is "== ")

from chrome-avgle-helper.

ivideom avatar ivideom commented on September 22, 2024

Seems the dectyptURI function call will check whether its called by functions in "avgle.com/templates/frontend/videojs-contrib-hls.js" (which's used to generate md5 hash for decrypting the video segment uri).
It might cause current script not work any more.

from chrome-avgle-helper.

chenhow83 avatar chenhow83 commented on September 22, 2024

tried the workaround but still getting the same error.

function main(utils, parameters = {}) {
// #21
waitForVideoJS(100, () => {
const player = videojs('video-player');
player.on('loadedmetadata', () => {
logInfo(Detected the hls.js loadedmetadata event!);

		const arr = [];
		try {
			const segments = player.tech_.hls.playlists.media_.segments;
			//segments.forEach(x => arr.push({ uri: x.resolvedUri }));
			//arr.forEach(videojs.Hls.xhr.beforeRequest);
			//arr.forEach(x => typeof x.decryptURI === 'function' && x.decryptURI());
			segments.forEach(x => arr.push({ uri: x.resolvedUri, method: "HEAD", timeout: 50 }));
            arr.forEach(x => x.uri = videojs.Hls.xhr(x, function(){}).uri);
			
		} catch (error) {
			return logError(error);
		}

from chrome-avgle-helper.

heroboy avatar heroboy commented on September 22, 2024

就2点:

  1. 必须在进入创建xhr这个时间点调用。你可以在相应位置设置断点,然后控制台执行代码能解密成功。但是如果过了这个代码段,执行同样的代码,就解密失败了。
  2. beforeRequest和decryptURI必须按顺序调用。
var backupBeforeRequest = videojs.Hls.xhr.beforeRequest;
var done = false;
let v = videojs('video-player');
v.on('loadedmetadata', function () {
	console.log('test:', 'loadedmetadata')
	videojs.Hls.xhr.beforeRequest = function () {
		backupBeforeRequest.apply(videojs.Hls.xhr, arguments);
		if (!done) {
			console.log('start decrypt video uri')
			done = true;
			try {
				v = videojs('video-player');
				arr = v.tech_.hls.playlists.media_.segments.map(x => {
					return {
						uri: x.resolvedUri,
						"timeout": 0,
						"withCredentials": false,
						"responseType": "arraybuffer",
						"headers": {}
					}
				});
				for(let item of arr)
				{
					videojs.Hls.xhr.beforeRequest(item)
					item.decryptURI();
				}
				
				console.log(arr[0]);
			}
			catch (e) {
				console.error('some error', e);
			}

		}
	}
})

from chrome-avgle-helper.

sino1641 avatar sino1641 commented on September 22, 2024

就2点:

  1. 必须在进入创建xhr这个时间点调用。你可以在相应位置设置断点,然后控制台执行代码能解密成功。但是如果过了这个代码段,执行同样的代码,就解密失败了。
  2. beforeRequest和decryptURI必须按顺序调用。
var backupBeforeRequest = videojs.Hls.xhr.beforeRequest;
var done = false;
let v = videojs('video-player');
v.on('loadedmetadata', function () {
	console.log('test:', 'loadedmetadata')
	videojs.Hls.xhr.beforeRequest = function () {
		backupBeforeRequest.apply(videojs.Hls.xhr, arguments);
		if (!done) {
			console.log('start decrypt video uri')
			done = true;
			try {
				v = videojs('video-player');
				arr = v.tech_.hls.playlists.media_.segments.map(x => {
					return {
						uri: x.resolvedUri,
						"timeout": 0,
						"withCredentials": false,
						"responseType": "arraybuffer",
						"headers": {}
					}
				});
				for(let item of arr)
				{
					videojs.Hls.xhr.beforeRequest(item)
					item.decryptURI();
				}
				
				console.log(arr[0]);
			}
			catch (e) {
				console.error('some error', e);
			}

		}
	}
})

so how to use it, thx

from chrome-avgle-helper.

ilovefood2 avatar ilovefood2 commented on September 22, 2024
arr.forEach(x => x.uri = videojs.Hls.xhr(x, function(){}).uri);

this actually works, thanks a lot !!!

from chrome-avgle-helper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.