Skip to content

Commit

Permalink
Merge pull request #180 from vitalygashkov/next
Browse files Browse the repository at this point in the history
Improved `cookies.txt` parsing
  • Loading branch information
vitalygashkov authored Jul 20, 2024
2 parents 9e2e851 + 238e2f4 commit 513ee37
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "streamyx",
"version": "4.0.0-beta.46",
"version": "4.0.0-beta.47",
"author": "Vitaly Gashkov <[email protected]>",
"description": "Powerful media downloader",
"main": "dist/src/main.js",
Expand Down
9 changes: 5 additions & 4 deletions packages/core/lib/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -451,10 +451,11 @@ class Http implements IHttp {
const importCookies = async (cookiesTxtPath: string): Promise<string[]> => {
const text = await fs.readText(cookiesTxtPath).catch(() => '');
if (!text) return [];
const rows = text
.split(EOL)
.filter((line: string) => !!line && !line.startsWith('# '))
.map((line: string) => line.replace('\r', '').split('\t'));
const lines = text.split(EOL).flatMap((line) => line.split('\n'));
const linesWithoutComments = lines.filter(
(line: string) => !!line.trim() && !line.startsWith('# ')
);
const rows = linesWithoutComments.map((line: string) => line.split('\t'));
const cookies: any[] = [];
for (const row of rows) {
const [domain, includeSubdomains, path, secure, expires, name, value] = row;
Expand Down
2 changes: 1 addition & 1 deletion packages/esor
Submodule esor updated from 79220d to 8ece28

0 comments on commit 513ee37

Please sign in to comment.