mirror of
https://github.com/intergalacticalvariable/reader.git
synced 2024-11-16 03:32:25 +08:00
manually set cookie
This commit is contained in:
parent
953429218a
commit
fc0023f381
|
@ -877,9 +877,15 @@ ${suffixMixins.length ? `\n${suffixMixins.join('\n\n')}\n` : ''}`;
|
||||||
this.threadLocal.set('timeout', opts.timeout * 1000);
|
this.threadLocal.set('timeout', opts.timeout * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const randomCookies = [
|
||||||
|
{ name: 'session_id', value: Math.random().toString(36).substring(7), url: 'https://hargup-ripeharlequincephalopod.web.val.run/' },
|
||||||
|
{ name: 'user_pref', value: 'dark_mode', url: 'https://hargup-ripeharlequincephalopod.web.val.run/' },
|
||||||
|
{ name: 'visit_count', value: Math.floor(Math.random() * 10).toString(), url: 'https://hargup-ripeharlequincephalopod.web.val.run/' }
|
||||||
|
];
|
||||||
|
|
||||||
const crawlOpts: ExtraScrappingOptions = {
|
const crawlOpts: ExtraScrappingOptions = {
|
||||||
proxyUrl: opts.proxyUrl,
|
proxyUrl: opts.proxyUrl,
|
||||||
cookies: opts.setCookies,
|
cookies: randomCookies,
|
||||||
favorScreenshot: ['screenshot', 'pageshot'].includes(opts.respondWith),
|
favorScreenshot: ['screenshot', 'pageshot'].includes(opts.respondWith),
|
||||||
removeSelector: opts.removeSelector,
|
removeSelector: opts.removeSelector,
|
||||||
targetSelector: opts.targetSelector,
|
targetSelector: opts.targetSelector,
|
||||||
|
|
|
@ -463,6 +463,7 @@ document.addEventListener('load', handlePageLoad);
|
||||||
|
|
||||||
async *scrap(parsedUrl: URL, options?: ScrappingOptions): AsyncGenerator<PageSnapshot | undefined> {
|
async *scrap(parsedUrl: URL, options?: ScrappingOptions): AsyncGenerator<PageSnapshot | undefined> {
|
||||||
// parsedUrl.search = '';
|
// parsedUrl.search = '';
|
||||||
|
console.log('Scraping options:', options);
|
||||||
const url = parsedUrl.toString();
|
const url = parsedUrl.toString();
|
||||||
|
|
||||||
let snapshot: PageSnapshot | undefined;
|
let snapshot: PageSnapshot | undefined;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user