Skip to content

Commit

Permalink
refactor: replace doctype to case insensitive variant
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyhalight committed Jan 2, 2025
1 parent d78cb28 commit 132d42c
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/node/src/helpers/incestflix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default class IncestflixHelper extends BaseHelper {
try {
const res = await this.fetch(this.service?.url + videoId);
const content = await res.text();
const doc = parseFromString(content.replace("<!DOCTYPE html>", ""));
const doc = parseFromString(content.replace(/<!DOCTYPE html>/i, ""));
const videoEl = doc.getElementById("incflix-stream");
if (!videoEl) {
throw new VideoHelperError(
Expand Down
2 changes: 1 addition & 1 deletion packages/node/src/helpers/linkedin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default class LinkedinHelper extends BaseHelper {
try {
const res = await this.fetch(`${this.API_ORIGIN}/${videoId}`);
const content = await res.text();
const doc = parseFromString(content.replace("<!DOCTYPE html>", ""));
const doc = parseFromString(content.replace(/<!DOCTYPE html>/i, ""));
const videoEl = doc.getElementsByClassName("video-js")?.[0];
if (!videoEl) {
throw new VideoHelperError(
Expand Down
2 changes: 1 addition & 1 deletion packages/node/src/helpers/porntn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default class PornTNHelper extends BaseHelper {
try {
const res = await this.fetch(this.service?.url + videoId);
const content = await res.text();
const doc = parseFromString(content.replace("<!DOCTYPE html>", ""));
const doc = parseFromString(content.replace(/<!DOCTYPE html>/i, ""));
const varDelimiter = /var flashvars\s=\s/;
const dataScript = doc
.getElementsByTagName("script")
Expand Down
2 changes: 1 addition & 1 deletion packages/node/src/helpers/sap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export default class SapHelper extends BaseHelper {
}

const [, kalturaDomain, partnerId] = sapData;
const doc = parseFromString(content.replace("<!DOCTYPE html>", ""));
const doc = parseFromString(content.replace(/<!DOCTYPE html>/i, ""));
let entryId = doc
.getElementById("shadow")
?.firstChild?.getAttribute("id");
Expand Down
2 changes: 1 addition & 1 deletion packages/node/src/helpers/vimeo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export default class VimeoHelper extends BaseHelper {
});

const content = await res.text();
const doc = parseFromString(content.replace("<!DOCTYPE html>", ""));
const doc = parseFromString(content.replace(/<!DOCTYPE html>/i, ""));
const playerConfigScript = doc
.getElementsByTagName("script")
.filter((s) => s.innerHTML.startsWith(`window.playerConfig`))?.[0];
Expand Down

0 comments on commit 132d42c

Please sign in to comment.