Skip to content

Commit

Permalink
fix: rename authentication cookie
Browse files Browse the repository at this point in the history
  • Loading branch information
abdulrahman1s committed Dec 4, 2022
1 parent 30164ea commit 1825b46
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ export const SUPPORTED_FORMATS = [
'mp4',
'mkv'
]


export const USER_AGENT = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36'
7 changes: 3 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env node

import { FEM_ENDPOINT, FEM_API_ENDPOINT, FEM_CAPTIONS_ENDPOINT, CAPTION_EXT, PLAYLIST_EXT, QUALITY_FORMAT, FEM_COURSE_REG, SUPPORTED_FORMATS } from './constants.js'
import { FEM_ENDPOINT, FEM_API_ENDPOINT, FEM_CAPTIONS_ENDPOINT, CAPTION_EXT, PLAYLIST_EXT, QUALITY_FORMAT, FEM_COURSE_REG, SUPPORTED_FORMATS, USER_AGENT } from './constants.js'
import { sleep, isPathExists, ensureDir, extendedFetch, safeJoin, formatBytes } from './util/common.js'
import ffmpeg from './util/ffmpeg.js'
import fs from 'node:fs/promises'
Expand All @@ -21,7 +21,6 @@ const exitOnCancel = (state) => {
if (state.aborted) process.nextTick(() => process.exit(0))
}

const USER_AGENT = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36'

const {
COURSE_SLUG,
Expand All @@ -41,7 +40,7 @@ const {
}, {
type: 'password',
name: 'TOKEN',
message: 'Paste the value of "wordpress_logged_in_xxx" cookie (visit: https://frontendmasters.com)',
message: 'Paste the value of "fem_auth_mod" cookie (visit: https://frontendmasters.com)',
format: v => decodeURIComponent(v) === v ? encodeURIComponent(v) : v,
initial: env['FEM_DL_COOKIES'],
onState: exitOnCancel
Expand Down Expand Up @@ -84,7 +83,7 @@ const headers = {

const cookies = new extendFetchCookie.toughCookie.CookieJar()

await cookies.setCookie(`wordpress_logged_in_323a64690667409e18476e5932ed231e=${TOKEN}; Path=/; Domain=frontendmasters.com; HttpOnly; Secure`, FEM_ENDPOINT)
await cookies.setCookie(`fem_auth_mod=${TOKEN}; Path=/; Domain=frontendmasters.com; HttpOnly; Secure`, FEM_ENDPOINT)

const fetch = extendedFetch({
headers,
Expand Down

0 comments on commit 1825b46

Please sign in to comment.