Update rarbg.js
Browse files
rarbg.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
|
|
| 1 |
import { XMLParser } from 'fast-xml-parser';
|
|
|
|
| 2 |
|
| 3 |
// Single fetchRSSFeeds export for searching torrents on RARBG
|
| 4 |
async function fetchRSSFeeds(searchQuery) {
|
|
@@ -20,7 +22,9 @@ async function fetchRSSFeeds(searchQuery) {
|
|
| 20 |
}
|
| 21 |
|
| 22 |
const pageHtml = await response.text();
|
| 23 |
-
const
|
|
|
|
|
|
|
| 24 |
|
| 25 |
if (torrentLinks.length === 0) {
|
| 26 |
console.log('❌ No torrents found for:', searchQuery);
|
|
|
|
| 1 |
+
import fetch from 'node-fetch'; // Ensure you import fetch
|
| 2 |
import { XMLParser } from 'fast-xml-parser';
|
| 3 |
+
import cheerio from 'cheerio';
|
| 4 |
|
| 5 |
// Single fetchRSSFeeds export for searching torrents on RARBG
|
| 6 |
async function fetchRSSFeeds(searchQuery) {
|
|
|
|
| 22 |
}
|
| 23 |
|
| 24 |
const pageHtml = await response.text();
|
| 25 |
+
const $ = cheerio.load(pageHtml); // Load the page HTML into Cheerio
|
| 26 |
+
|
| 27 |
+
const torrentLinks = $('a[href^="/torrent/"]'); // Finding torrent links on the page
|
| 28 |
|
| 29 |
if (torrentLinks.length === 0) {
|
| 30 |
console.log('❌ No torrents found for:', searchQuery);
|