Skip to content

Commit

Permalink
fix lhh
Browse files Browse the repository at this point in the history
  • Loading branch information
woniuzfb committed May 27, 2024
1 parent 18fdd9d commit 70ecfc1
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 616 deletions.
6 changes: 3 additions & 3 deletions env
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ FFMPEG_ROOT="$HOME"

# node
NODE_ROOT="$HOME"/iptv_sh_node
NODE_TOUTIAO_LINK=https://raw.githubusercontent.com/woniuzfb/iptv/main/scripts/toutiao
NODE_SCRIPTS_LINK=https://raw.githubusercontent.com/woniuzfb/iptv/main/scripts
NODE_TOUTIAO_VER=1.0.0

# iptv
IPTV_ROOT="$AIOS_PREFIX"/iptv
Expand Down Expand Up @@ -71,7 +72,7 @@ MD5SUM_LINK_FALLBACK="$FFMPEG_MIRROR_LINK"/md5sum.c
DEFAULT_DEMOS=default.json
TS_CHANNELS=channels.json
XTREAM_CODES_CHANNELS=xtream_codes
USER_AGENT_BROWSER="Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36"
USER_AGENT_BROWSER="Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36"
USER_AGENT_TV="Mozilla/5.0 (QtEmbedded; U; Linux; C) AppleWebKit/533.3 (KHTML, like Gecko) MAG200 stbapp ver: 2 rev: 250 Safari/533.3"
USER_AGENT_PHONE="iPhone; CPU iPhone OS 15_2 like Mac OS X"

Expand Down Expand Up @@ -140,5 +141,4 @@ DOCKER_ROOT="$SERVICES_ROOT"/docker
DOCKER_CONFIG="$SERVICES_ROOT"/docker/docker-compose.yml

# HAProxy
HAPROXY_LINK=https://github.com/haproxy/haproxy
HAPROXY_FILE="$AIOS_PREFIX"/bin/ha
40 changes: 22 additions & 18 deletions scripts/toutiao/browser.js → scripts/browser.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const ver = "1.0.0";
const { chromium, devices } = require('playwright-chromium');
const desktop = devices["Desktop Chrome"];

Expand Down Expand Up @@ -27,7 +28,7 @@ class Utils {

class Signer {
userAgent =
"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36";
"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36";
args = [
"--disable-blink-features",
"--disable-blink-features=AutomationControlled",
Expand Down Expand Up @@ -113,25 +114,28 @@ class Signer {
return string ? window.byted_acrawler.sign("", string) : window.byted_acrawler.sign({ url: url });
};

window.generateBogus = function generateBogus(params) {
if (typeof window.byted_acrawler.generateBogus !== "function") {
throw "No X-Bogus function found";
}
return window.byted_acrawler.generateBogus(params);
};
// window.generateBogus = function generateBogus(params) {
// if (typeof window.byted_acrawler.generateBogus !== "function") {
// throw "No X-Bogus function found";
// }
// return window.byted_acrawler.generateBogus(params);
// };

return this;
});

let LOAD_SCRIPTS = ["xbogus.js"];
await Promise.all(LOAD_SCRIPTS.map(async (script) => {
await this.page.addScriptTag({
path: `${__dirname}/${script}`,
});
//console.log("[+] " + script + " loaded");
}));
// let LOAD_SCRIPTS = ["xbogus.js"];
// await Promise.all(LOAD_SCRIPTS.map(async (script) => {
// await this.page.addScriptTag({
// path: `${__dirname}/${script}`,
// });
// //console.log("[+] " + script + " loaded");
// }));

const a_bogus = new URL(feedRequest.url()).searchParams.get('a_bogus');

return {
"a-bogus": encodeURIComponent(a_bogus),
feed: {
url: feedRequest.url(),
headers: feedRequest.headers(),
Expand All @@ -152,12 +156,12 @@ class Signer {
if (Utils.isUrl(link)) {
token = await this.page.evaluate(`generateSignature("","${link}")`);
let signed_url = link + "&_signature=" + token;
let queryString = new URL(signed_url).searchParams.toString();
let bogus = await this.page.evaluate(`generateBogus("${queryString}","${this.userAgent}")`);
// let queryString = new URL(signed_url).searchParams.toString();
// let bogus = await this.page.evaluate(`generateBogus("${queryString}","${this.userAgent}")`);
return {
signature: token,
"x-bogus": bogus,
signed_url: signed_url,
// "x-bogus": bogus,
"signed-url": signed_url,
};
}
token = await this.page.evaluate(`generateSignature("${link}")`);
Expand Down
Loading

0 comments on commit 70ecfc1

Please sign in to comment.