randydev commited on
Commit
fa32f5f
·
verified ·
1 Parent(s): 1122fa5

Create scrapper.js

Browse files
Files changed (1) hide show
  1. scrapper.js +34 -0
scrapper.js ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const axios = require('axios')
2
+
3
+ const OpenaiRes = async (prompt) => {
4
+ try {
5
+ const EncodeUrl = "aHR0cHM6Ly9vcGVuYWktZ3B0LnJlbWl4cHJvamVjdC5vcmcv"
6
+ let url;
7
+ try {
8
+ url = atob(EncodeUrl);
9
+ } catch (e) {
10
+ console.error("Could not decode the string! " + e);
11
+ }
12
+ const headers = {
13
+ "Accept": "application/json",
14
+ "Content-Type": "application/json",
15
+ "Accept-Language": "en",
16
+ "Connection": "keep-alive",
17
+ "Origin": "https://remix.ethereum.org",
18
+ "Referer": "https://remix.ethereum.org/",
19
+ "Sec-Fetch-Dest": "empty",
20
+ "Sec-Fetch-Mode": "cors",
21
+ "Sec-Fetch-Site": "cross-site",
22
+ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36 Edge/17.17134"
23
+ };
24
+ const response = await axios.post(url, GptModelOld(prompt), { headers, timeout: 50000 });
25
+ if (response.status === 200) {
26
+ return response.data.choices[0].message.content + "\n\nPowered By xtdevs";
27
+ }
28
+ } catch (error) {
29
+ console.error("Error:", error.message);
30
+ return null;
31
+ }
32
+ };
33
+
34
+ module.exports = { OpenaiRes };