Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@hyrious/blivec

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hyrious/blivec - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

52

dist/bin.js

@@ -13,3 +13,25 @@ #!/usr/bin/env node

}
if (message) {
async function listen() {
function is_object(a) {
return typeof a === "object" && a !== null;
}
const con = new Connection(id, {
init({ title }) {
console.log(`listening ${title}`);
},
message(data) {
if (is_object(data) && data.cmd === "DANMU_MSG") {
const message2 = data.info[1];
const user = data.info[2][1];
console.log(">", `[${user}]`, message2);
}
},
error: console.error
});
process.on("SIGINT", () => {
console.log("closing...");
con.close();
});
}
async function send_message(message2) {
const tmpdir = getTempDir("blivec");

@@ -38,3 +60,3 @@ fs.mkdirSync(tmpdir, { recursive: true });

try {
const ret = await sendDanmaku(id, message, JSON.parse(cookie));
const ret = await sendDanmaku(id, message2, JSON.parse(cookie));
const json = JSON.parse(ret);

@@ -50,23 +72,9 @@ if (json.code != 0) {

}
}
let main;
if (message) {
main = send_message(message);
} else {
let is_object = function(a) {
return typeof a === "object" && a !== null;
};
const con = new Connection(id, {
init({ title }) {
console.log(`listening ${title}`);
},
message(data) {
if (is_object(data) && data.cmd === "DANMU_MSG") {
const message2 = data.info[1];
const user = data.info[2][1];
console.log(">", `[${user}]`, message2);
}
},
error: console.error
});
process.on("SIGINT", () => {
console.log("closing...");
con.close();
});
main = listen();
}
main.catch(console.error);

@@ -23,6 +23,16 @@ var __defProp = Object.defineProperty;

import { promisify } from "util";
const post = typeof fetch !== "undefined" ? (url, body, params) => fetch(url, __spreadValues({ method: "POST", body }, params)).then((r) => r.text()) : (url, body, params) => new Promise((resolve, reject) => https.request(url, __spreadValues({ method: "POST", timeout: 1e3 }, params), (res) => {
const inflateAsync = /* @__PURE__ */ promisify(inflate);
const brotliDecompressAsync = /* @__PURE__ */ promisify(brotliDecompress);
const EMPTY_BUFFER = /* @__PURE__ */ Buffer.alloc(0);
function noop(_arg0) {
}
const get = (url) => new Promise((resolve, reject) => https.get(url, (res) => {
const chunks = [];
res.on("data", chunks.push.bind(chunks));
res.on("end", () => resolve(Buffer.concat(chunks).toString("utf8")));
}).on("error", reject));
const post = (url, body, params) => new Promise((resolve, reject) => https.request(url, __spreadValues({ method: "POST", timeout: 1e3 }, params), (res) => {
const chunks = [];
res.on("data", chunks.push.bind(chunks));
res.on("end", () => resolve(Buffer.concat(chunks).toString("utf8")));
}).end(body).on("error", reject));

@@ -59,12 +69,2 @@ export function getTempDir(name) {

}
const inflateAsync = /* @__PURE__ */ promisify(inflate);
const brotliDecompressAsync = /* @__PURE__ */ promisify(brotliDecompress);
const EMPTY_BUFFER = /* @__PURE__ */ Buffer.alloc(0);
function noop(_arg0) {
}
const get = typeof fetch !== "undefined" ? (url) => fetch(url).then((r) => r.text()) : (url) => new Promise((resolve, reject) => https.get(url, (res) => {
const chunks = [];
res.on("data", chunks.push.bind(chunks));
res.on("end", () => resolve(Buffer.concat(chunks).toString("utf8")));
}).on("error", reject));
const api_index = "https://api.live.bilibili.com/xlive/web-room/v1/index";

@@ -71,0 +71,0 @@ export async function getDanmuInfo(id) {

{
"name": "@hyrious/blivec",
"version": "0.1.1",
"version": "0.1.2",
"description": "bilibili live danmaku cli",

@@ -5,0 +5,0 @@ "type": "module",

@@ -16,3 +16,28 @@ #!/usr/bin/env node

if (message) {
async function listen() {
function is_object(a: any) {
return typeof a === "object" && a !== null;
}
const con = new Connection(id, {
init({ title }) {
console.log(`listening ${title}`);
},
message(data) {
if (is_object(data) && data.cmd === "DANMU_MSG") {
const message = data.info[1];
const user = data.info[2][1];
console.log(">", `[${user}]`, message);
}
},
error: console.error,
});
process.on("SIGINT", () => {
console.log("closing...");
con.close();
});
}
async function send_message(message: string) {
const tmpdir = getTempDir("blivec");

@@ -51,25 +76,10 @@ fs.mkdirSync(tmpdir, { recursive: true });

}
}
let main: Promise<unknown>;
if (message) {
main = send_message(message);
} else {
function is_object(a: any) {
return typeof a === "object" && a !== null;
}
const con = new Connection(id, {
init({ title }) {
console.log(`listening ${title}`);
},
message(data) {
if (is_object(data) && data.cmd === "DANMU_MSG") {
const message = data.info[1];
const user = data.info[2][1];
console.log(">", `[${user}]`, message);
}
},
error: console.error,
});
process.on("SIGINT", () => {
console.log("closing...");
con.close();
});
main = listen();
}
main.catch(console.error);

@@ -8,27 +8,32 @@ import os from "os";

// since Node.js 17.5
// TODO: remove this declaration when @types/node is updated
declare function fetch(
url: string,
init?: { method: string; body: string }
): Promise<{ text: () => string }>;
const inflateAsync = /** @__PURE__ */ promisify(inflate);
const brotliDecompressAsync = /** @__PURE__ */ promisify(brotliDecompress);
const post =
typeof fetch !== "undefined"
? (url: string, body: string, params: any) =>
fetch(url, { method: "POST", body, ...params }).then(r => r.text())
: (url: string, body: string, params: any) =>
new Promise<string>((resolve, reject) =>
https
.request(url, { method: "POST", timeout: 1000, ...params }, res => {
const chunks: Buffer[] = [];
res.on("data", chunks.push.bind(chunks));
res.on("end", () =>
resolve(Buffer.concat(chunks).toString("utf8"))
);
})
.end(body)
.on("error", reject)
);
const EMPTY_BUFFER = /** @__PURE__ */ Buffer.alloc(0);
function noop(_arg0: any) {}
const get = (url: string) =>
new Promise<string>((resolve, reject) =>
https
.get(url, res => {
const chunks: Buffer[] = [];
res.on("data", chunks.push.bind(chunks));
res.on("end", () => resolve(Buffer.concat(chunks).toString("utf8")));
})
.on("error", reject)
);
const post = (url: string, body: string, params: any) =>
new Promise<string>((resolve, reject) =>
https
.request(url, { method: "POST", timeout: 1000, ...params }, res => {
const chunks: Buffer[] = [];
res.on("data", chunks.push.bind(chunks));
res.on("end", () => resolve(Buffer.concat(chunks).toString("utf8")));
})
.end(body)
.on("error", reject)
);
export function getTempDir(name: string) {

@@ -74,25 +79,2 @@ const tmpdir = os.tmpdir();

const inflateAsync = /** @__PURE__ */ promisify(inflate);
const brotliDecompressAsync = /** @__PURE__ */ promisify(brotliDecompress);
const EMPTY_BUFFER = /** @__PURE__ */ Buffer.alloc(0);
function noop(_arg0: any) {}
const get =
typeof fetch !== "undefined"
? (url: string) => fetch(url).then(r => r.text())
: (url: string) =>
new Promise<string>((resolve, reject) =>
https
.get(url, res => {
const chunks: Buffer[] = [];
res.on("data", chunks.push.bind(chunks));
res.on("end", () =>
resolve(Buffer.concat(chunks).toString("utf8"))
);
})
.on("error", reject)
);
const api_index = "https://api.live.bilibili.com/xlive/web-room/v1/index";

@@ -99,0 +81,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc