Crawlee—A web scraping and browser automation library for Node.js to build reliable crawlers. In JavaScript and TypeScript. Extract data for AI, LLMs, RAG, or GPTs. Download HTML, PDF, JPG, PNG, and other files from websites. Works with Puppeteer, Playwright, Cheerio, JSDOM, and raw HTTP. Both headful and headless mode. With proxy rotation.
TypeScript apifyautomationcrawlercrawlingheadlessheadless-chromejavascriptnodejsnpmplaywrightpuppeteerscraperscrapingtypescriptweb-crawlerweb-crawlingweb-scraping
fix: decode special characters in proxy `username` and `password` (#2696)
Martin Adámek0f0fcc594685
diff --git a/packages/core/src/proxy_configuration.ts b/packages/core/src/proxy_configuration.tsindex c0a4e0bf1..6e0b8a8b3 100644--- a/packages/core/src/proxy_configuration.ts+++ b/packages/core/src/proxy_configuration.ts@@ -284,8 +284,8 @@ export class ProxyConfiguration {return {sessionId,url,- username,- password,+ username: decodeURIComponent(username),+ password: decodeURIComponent(password),hostname,port: port!,proxyTier: tier,diff --git a/test/core/proxy_configuration.test.ts b/test/core/proxy_configuration.test.tsindex 03acde760..d44468022 100644--- a/test/core/proxy_configuration.test.ts+++ b/test/core/proxy_configuration.test.ts@@ -24,6 +24,21 @@ describe('ProxyConfiguration', () => {expect(await proxyConfiguration.newProxyInfo(sessionId)).toEqual(proxyInfo);});+ test('newProxyInfo() works with special characters', async () => {+ const url = 'http://user%40name:pass%[email protected]:1111';+ const proxyConfiguration = new ProxyConfiguration({ proxyUrls: [url] });++ const proxyInfo = {+ sessionId: `${sessionId}`,+ url,+ hostname: 'proxy.com',+ username: 'user@name',+ password: 'pass@word',+ port: '1111',+ };+ expect(await proxyConfiguration.newProxyInfo(sessionId)).toEqual(proxyInfo);+ });+test('should throw on invalid newUrlFunction', async () => {const newUrlFunction = () => {return 'http://proxy.com:1111*invalid_url';