mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
open youtube transcript to public
This commit is contained in:
parent
648cbe18cf
commit
bc7e710835
1 changed files with 14 additions and 22 deletions
|
|
@ -4,7 +4,6 @@ import { parseHTML } from 'linkedom'
|
|||
import showdown from 'showdown'
|
||||
import { Chapter, Client as YouTubeClient } from 'youtubei'
|
||||
import { LibraryItem, LibraryItemState } from '../entity/library_item'
|
||||
import { FeatureName, findGrantedFeatureByName } from '../services/features'
|
||||
import {
|
||||
findLibraryItemById,
|
||||
updateLibraryItem,
|
||||
|
|
@ -282,30 +281,23 @@ export const processYouTubeVideo = async (
|
|||
updatedLibraryItem.publishedAt = new Date(video.uploadDate)
|
||||
}
|
||||
|
||||
if (
|
||||
await findGrantedFeatureByName(
|
||||
FeatureName.YouTubeTranscripts,
|
||||
jobData.userId
|
||||
if ('getTranscript' in video && duration > 0 && duration < 1801) {
|
||||
// If the video has a transcript available, put a placehold in and
|
||||
// enqueue a job to process the full transcript
|
||||
const updatedContent = await addTranscriptToReadableContent(
|
||||
libraryItem.originalUrl,
|
||||
libraryItem.readableContent,
|
||||
TRANSCRIPT_PLACEHOLDER_TEXT
|
||||
)
|
||||
) {
|
||||
if ('getTranscript' in video && duration > 0 && duration < 1801) {
|
||||
// If the video has a transcript available, put a placehold in and
|
||||
// enqueue a job to process the full transcript
|
||||
const updatedContent = await addTranscriptToReadableContent(
|
||||
libraryItem.originalUrl,
|
||||
libraryItem.readableContent,
|
||||
TRANSCRIPT_PLACEHOLDER_TEXT
|
||||
)
|
||||
|
||||
if (updatedContent) {
|
||||
updatedLibraryItem.readableContent = updatedContent
|
||||
}
|
||||
|
||||
await enqueueProcessYouTubeTranscript({
|
||||
videoId,
|
||||
...jobData,
|
||||
})
|
||||
if (updatedContent) {
|
||||
updatedLibraryItem.readableContent = updatedContent
|
||||
}
|
||||
|
||||
await enqueueProcessYouTubeTranscript({
|
||||
videoId,
|
||||
...jobData,
|
||||
})
|
||||
}
|
||||
|
||||
if (updatedLibraryItem !== {}) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue