diff --git a/package.json b/package.json index 71ead3a..f3c1b69 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "enjinscraper", - "version": "1.1.0", + "version": "1.1.1", "description": "Scrapes an Enjin site via the Enjin API", "repository": "https://github.com/Kas-tle/EnjinScraper.git", "author": "Joshua Castle { - const loginResponse = await getRequest(domain, '/login', {}, '/auth'); + const loginResponse = await getRequest(domain, '/login', {}, '/authenticateSite/loginResponse'); const setCookie = loginResponse.headers['set-cookie']; const cf_bm_token = setCookie!.find((cookie: string) => cookie.includes('__cf_bm'))!.split(';')[0]; const lastviewed = setCookie!.find((cookie: string) => cookie.includes('lastviewed'))!.split(';')[0]; @@ -45,13 +45,13 @@ export async function authenticateSite(domain: string, email: string, password: const postLoginResponse = await postRequest(domain, '/login', formData, { Cookie: `${lastviewed}; enjin_browsertype=web; ${cf_bm_token}`, - }, '/auth'); + }, '/authenticateSite'); const phpSessID = postLoginResponse.headers['set-cookie']!.find((cookie: string) => cookie.includes('PHPSESSID'))!.split(';')[0]; const homeResponse = await getRequest(domain, '/', { Cookie: `${lastviewed}; ${phpSessID}; enjin_browsertype=web; ${cf_bm_token}; login_temp=1`, - }, '/auth'); + }, '/authenticateSite/homeResponse'); const csrfToken = homeResponse.headers['set-cookie']!.find((cookie: string) => cookie.includes('csrf_token'))!.split(';')[0]; diff --git a/src/scrapers/comments.ts b/src/scrapers/comments.ts index 1e5019c..a3e1982 100644 --- a/src/scrapers/comments.ts +++ b/src/scrapers/comments.ts @@ -38,7 +38,7 @@ export async function getComments(database: Database, domain: string, siteAuth: for (let i = commentCidsCount[0]; i < totalCommentCids; i++) { const commentResponse = await getRequest(domain, `/ajax.php?s=comments&op=load&start=0&comment_cid=${commentCids[i]}&pageSize=-1&subPageSize=-1`, { Cookie: `${siteAuth.phpSessID}; ${siteAuth.csrfToken}`, - }, '/comments'); + }, '/getComments'); const response: CommentResponse = commentResponse.data; const commentsDB: CommentsDB[] = []; diff --git a/src/scrapers/files.ts b/src/scrapers/files.ts index 61b665a..b575d95 100644 --- a/src/scrapers/files.ts +++ b/src/scrapers/files.ts @@ -19,7 +19,7 @@ async function getDirectoryListing(domain: string, siteAuth: SiteAuth, token: st Cookie: `${siteAuth.phpSessID}; ${siteAuth.csrfToken}`, Origin: `https://${domain}`, Referer: `https://${domain}/admin/files`, - }, '/files'); + }, '/getDirectoryListing'); const dirListing: DirectoryListing = dirResponse.data.result; return dirListing; @@ -165,7 +165,7 @@ export async function getFiles(domain: string, database: Database, siteAuth: Sit Cookie: `${siteAuth.phpSessID}; ${siteAuth.csrfToken}`, Origin: `https://${domain}`, Referer: `https://${domain}/admin/files`, - }, '/files') + }, '/getFiles') const token = tokenResponse.data.token; const s3FileUrls: FileData[] = await getS3FileUrls(domain, siteAuth, token, `/${siteID}`); diff --git a/src/scrapers/news.ts b/src/scrapers/news.ts index 8b4bf45..2d0a192 100644 --- a/src/scrapers/news.ts +++ b/src/scrapers/news.ts @@ -71,7 +71,7 @@ async function getModuleNews(domain: string, sessionID: string, siteAuth: SiteAu async function getNewsCommentsCid(domain: string, siteAuth: SiteAuth, moduleID: string, articleID: string): Promise { const newsArticleResonse = await throttledGetRequest(domain, `/home/m/${moduleID}/article/${articleID}`, { Cookie: `${siteAuth.phpSessID}; ${siteAuth.csrfToken}`, - }, '/news') + }, '/getNewsCommentsCid') const $ = cheerio.load(newsArticleResonse.data); let commentCid = null; diff --git a/src/scrapers/sitedata.ts b/src/scrapers/sitedata.ts index 6729f4f..c333216 100644 --- a/src/scrapers/sitedata.ts +++ b/src/scrapers/sitedata.ts @@ -12,7 +12,7 @@ import { MessageType, statusMessage } from '../util/console'; async function fetchSiteDataObject(domain: string, siteAuth: SiteAuth): Promise { const siteResponse = await getRequest(domain, `/admin/modules/index`, { Cookie: `${siteAuth.phpSessID}; ${siteAuth.csrfToken}` - }, '/sitedata'); + }, '/fetchSiteDataObject'); const $ = cheerio.load(siteResponse.data); diff --git a/src/scrapers/tickets.ts b/src/scrapers/tickets.ts index 16b09bc..46e42f3 100644 --- a/src/scrapers/tickets.ts +++ b/src/scrapers/tickets.ts @@ -220,7 +220,7 @@ async function getTicketsByModule(database: Database, domain: string, sessionID: async function getTicketUploads(domain: string, siteAuth: SiteAuth, ticketCode: string, ticketModule: String): Promise { const homeResponse = await getRequest(domain, `/ajax.php?code=${ticketCode}&s=editmodule_tickets&cmd=ticket_html&preset_id=${ticketModule}&saved_data%5Bmode%5D=public`, { Cookie: `${siteAuth.phpSessID}; ${siteAuth.csrfToken}`, - }, '/tickets'); + }, '/getTicketUploads'); const uploads: TicketUpload[] = []; const $ = cheerio.load(homeResponse.data); diff --git a/src/scrapers/users.ts b/src/scrapers/users.ts index 7577ae0..ae6ffac 100644 --- a/src/scrapers/users.ts +++ b/src/scrapers/users.ts @@ -44,7 +44,7 @@ export async function getAdditionalUserData(domain: string, sessionID: string, s const userIPsResponse = await throttledGetRequest(domain, `/ajax.php?s=admin_users&cmd=getUserAdditionalData&user_id=${userIDs[i]}`, { Cookie: `${siteAuth.phpSessID}; ${siteAuth.csrfToken}`, Referer: `Referer https://${domain}/admin/users` - }, '/userips'); + }, '/getAdditionalUserData'); const userIPs: UserIPs = userIPsResponse.data; await updateRow(database, 'users', 'user_id', userIDs[i], ['ip_history'], [JSON.stringify(userIPs.ips_history)]); diff --git a/src/scrapers/wiki.ts b/src/scrapers/wiki.ts index 5c106b2..1185c8c 100644 --- a/src/scrapers/wiki.ts +++ b/src/scrapers/wiki.ts @@ -215,7 +215,7 @@ async function getModuleUploads(database: Database, domain: string, moduleID: st export async function getWikis(domain: string, database: Database, wikiModuleIDs: string[]) { // We'll just get a temp token for this - const cfbmTokenResponse = await getRequest(domain, `/wiki/m/${wikiModuleIDs[0]}`, {}, '/wiki') + const cfbmTokenResponse = await getRequest(domain, `/wiki/m/${wikiModuleIDs[0]}`, {}, '/getWikis') const setCookie = cfbmTokenResponse.headers['set-cookie']; const cfbmToken = setCookie!.find((cookie: string) => cookie.includes('__cf_bm'))!.split(';')[0]; const lastviewed = setCookie!.find((cookie: string) => cookie.includes('lastviewed'))!.split(';')[0];