Nexchan commited on
Commit
d126f19
1 Parent(s): bce427e

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +7 -1
index.js CHANGED
@@ -179,7 +179,13 @@ async function nhentai(url) {
179
  await fss.mkdir(tempDir);
180
  const title = url.split('g/').filter(part => part).pop();
181
  try {
182
- const response = await axios.get(url)
 
 
 
 
 
 
183
  const $ = cheerio.load(response.data);
184
  const scriptContent = $('script').filter((i, el) => {
185
  return $(el).html().includes('window._gallery = JSON.parse');
 
179
  await fss.mkdir(tempDir);
180
  const title = url.split('g/').filter(part => part).pop();
181
  try {
182
+ const response = await axios.get(url, {
183
+ headers: {
184
+ 'User-Agent': getRandomUserAgent() || 'Mozilla/5.0 (Linux; Android 6.0.1; SM-N916S Build/MMB29K; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/106.0.5249.126 Mobile Safari/537.36 [FB_IAB/FB4A;FBAV/389.0.0.42.111;]',
185
+ 'Referer': 'https://nhentai.net/',
186
+ 'X-Forwarded-For': generateRandomIP()
187
+ }
188
+ })
189
  const $ = cheerio.load(response.data);
190
  const scriptContent = $('script').filter((i, el) => {
191
  return $(el).html().includes('window._gallery = JSON.parse');