Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Processing browse request throws Error: illegal tag: field no 3 wire type 7 #54

Closed
FrontMage opened this issue May 28, 2024 · 2 comments

Comments

@FrontMage
Copy link

browse_reqeust.tar.gz

Hi, I've been trying to implement a surge alternative, when trying to process browse request with nodejs, I found that this browse request will throw Error: illegal tag: field no 3 wire type 7.

It seems that the protobuf types are mismatched, potentially causing the first ad when opening a video not to be blocked.

Here is the code I use to process the request:

const fs = require("fs");
var store = {};
var e = null;
var $persistentStore = {
  read: (key) => {
    return store[key];
  },
  write: (value, key) => {
    store[key] = value;
    return true;
  },
};
const res = fs.readFileSync(
  "./tp-dump-request-https___youtubei.googleapis.com_youtubei_v1_browse"
);
const req = fs.readFileSync(
  "./tp-dump-request-https___youtubei.googleapis.com_youtubei_v1_browse"
);
var $request = {
  url: "https://youtubei.googleapis.com/youtubei/v1/browse?key=AIzaSyB-63vPrdThhKuerbB2N_l7Kwwcxj6yUAc&retry=1",
  body: new Uint8Array(req),
};
var $response = {
  url: "https://youtubei.googleapis.com/youtubei/v1/browse?key=AIzaSyB-63vPrdThhKuerbB2N_l7Kwwcxj6yUAc&retry=1",
  body: new Uint8Array(res),
};
var v = null;
var $done = (obj) => {
  console.log("=======", obj);
  v = obj;
};
console.log("Before eval");
eval(fs.readFileSync("./youtube.request.beta.js").toString());
console.log("After eval");
console.log("Result: ", v);

Can you help me with why the video's first ad is still showing up?

@Maasea
Copy link
Owner

Maasea commented May 29, 2024

This error is generally a problem with deserializing the protobuf.

It could be because the data is not a protobuf, or the proto file was written incorrectly

@FrontMage
Copy link
Author

Thx! I guess the problem is that I assumed that whatever URL that matches the rule is protobuf, but that is not true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants