From da29c289493532da722d4da692163521f696c491 Mon Sep 17 00:00:00 2001 From: sinkaroid Date: Tue, 18 Apr 2023 11:19:14 +0700 Subject: [PATCH] test: add some testing and prototype --- test/mock.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 test/mock.ts diff --git a/test/mock.ts b/test/mock.ts new file mode 100644 index 0000000..78a6e1b --- /dev/null +++ b/test/mock.ts @@ -0,0 +1,20 @@ +import p from "phin"; +import { load } from "cheerio"; + +const url = "https://www.pornhub.com/view_video.php?viewkey=ph63c4e1dc48fe7"; + +async function test() { + const res = await p({ + url: url, + "headers": { + "User-Agent": process.env.USER_AGENT || "lustpress/1.6.0 Node.js/16.9.1", + }, + }); + + const $ = load(res.body); + const title = $("meta[property='og:title']").attr("content"); + console.log(title); + console.log(res.statusCode); +} + +test().catch(console.error);