Updated MG session acquisition.
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
|
||||
const unprint = require('unprint');
|
||||
|
||||
const qu = require('../utils/qu');
|
||||
const http = require('../utils/http');
|
||||
const slugify = require('../utils/slugify');
|
||||
|
||||
|
||||
@@ -185,10 +185,10 @@ function scrapeRelease(data, url, channel, networkName) {
|
||||
}
|
||||
|
||||
function getUrl(site) {
|
||||
const { searchParams } = new URL(site.url);
|
||||
const { searchParams, pathname } = new URL(site.url);
|
||||
|
||||
// if (search.match(/\?site=\d+/)) {
|
||||
if (searchParams.has('site')) {
|
||||
if (searchParams.has('site') || /\/site\/\d+/.test(pathname)) {
|
||||
return site.url;
|
||||
}
|
||||
|
||||
@@ -290,8 +290,12 @@ function scrapeProfile(data, releases = [], networkName) {
|
||||
|
||||
async function fetchLatest(site, page = 1, options) {
|
||||
const url = getUrl(site);
|
||||
const { searchParams } = new URL(url);
|
||||
const siteId = searchParams.get('site');
|
||||
const { searchParams, pathname } = new URL(url);
|
||||
const siteId = searchParams.get('site') || Number(pathname.match(/\/site\/(\d+)\//)?.[1]);
|
||||
|
||||
if (!siteId && !site.parameters?.native && !site.parameters?.extract) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const { session, instanceToken } = options.beforeNetwork?.headers?.Instance
|
||||
? options.beforeNetwork
|
||||
|
||||
Reference in New Issue
Block a user