Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adjust regex to handle youtube shorts #26

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
342 changes: 0 additions & 342 deletions package-lock.json

This file was deleted.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"name": "youtube-transcript",
"name": "youtube-transcript-shorts",
"version": "1.2.1",
"description": "Fetch transcript from a youtube video",
"description": "Fetch transcript from a youtube video or short",
"main": "dist/youtube-transcript.common.js",
"browser": "dist/youtube-transcript.esm.js",
"module": "dist/youtube-transcript.esm.js",
"types": "dist/index.d.ts",
"scripts": {
"build": "rollup -c"
},
"author": "Kakulukian",
"author": "taylorchance",
"keywords": [
"youtube",
"transcript"
Expand All @@ -25,11 +25,11 @@
"files": [
"dist/*"
],
"repository": "https://github.com/Kakulukian/youtube-transcript.git",
"repository": "https://github.com/taylorchance/youtube-transcript.git",
"publishConfig": {
"access": "public"
},
"homepage": "https://github.com/Kakulukian/youtube-transcript",
"homepage": "https://github.com/taylorchance/youtube-transcript",
"engines": {
"node": ">=18.0.0"
}
Expand Down
5 changes: 3 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const RE_YOUTUBE =
/(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^"&?\/\s]{11})/i;
const RE_YOUTUBE =
/(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/|youtube\.com\/shorts\/)([^"&?\/\s]{11})/i;

const USER_AGENT =
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36,gzip(gfe)';
const RE_XML_TRANSCRIPT =
Expand Down