YouTube Structured Transcript Extractor avatar

YouTube Structured Transcript Extractor

Try for free

1 day trial then $15.00/month - No credit card required now

View all Actors
YouTube Structured Transcript Extractor

YouTube Structured Transcript Extractor

karamelo/youtube-structured-transcript-extractor
Try for free

1 day trial then $15.00/month - No credit card required now

Extract 1 or 1000s of YouTube transcripts fast. Save time & effort . Get accurate structured transcripts or captions in seconds for each video. Export in various formats,, JSON, XML, HTML, CSV, EXCEL... Boost your productivity!

GC

dont work in this video

Closed

golden_chicken opened this issue
a month ago
karamelo avatar

Hi there, the captions are in Spanish, I will fix it ,I will notify you here

karamelo avatar

Hi there, its Ok I fixed the issue. Please try again :)

GC

golden_chicken

a month ago

Thanks mate, I'll keep testing, does it pull the audio and transcribe it or does it pick up the subtitles?

El lun, 19 ago 2024 a las 15:07, karamelo (< topic+isiekh6tgbrp6gxq5d@reply.apify.com>) escribió:

karamelo avatar

This actor is designed to extract the subtitles (closed captions) autogenerated or user generated

GC

golden_chicken

a month ago

It still fail: i use this json

{ "proxyOptions": { "useApifyProxy": true, "apifyProxyGroups": [ "BUYPROXIES94952" ] }, "urls": [ "https://www.youtube.com/watch?v=ATapsyGafXc" ] }

El mar, 20 ago 2024 a las 0:16, karamelo (< topic+isiekh6tgbrp6gxq5d@reply.apify.com>) escribió:

GC

golden_chicken

a month ago

i change the proxy : { "proxyOptions": { "useApifyProxy": true, "apifyProxyGroups": [ "RESIDENTIAL" ] }, "urls": [ "https://www.youtube.com/watch?v=ATapsyGafXc" ] } but in make still error: [image: image.png]

[image: image.png]

El mar, 20 ago 2024 a las 10:03, Golden Chicken (< goldenchickenchannels@gmail.com>) escribió:

karamelo avatar

maybe the error is in 'Make' because from the Actor's endpoint the json output is well formated! I will take a look again, please stay tuned

karamelo avatar

I tested the api endpoint and it works well, your json is valid { "proxyOptions": { "useApifyProxy": true, "apifyProxyGroups": [ "RESIDENTIAL" ] }, "urls": [ "https://www.youtube.com/watch?v=ATapsyGafXc" ] } I used VSCode with your json parameters and it works. I thing the issue is in Make and how it handles the received json file. here is the code i used to retrieve it. can you use VSCode? beacause it gives you more freedom for cusomisation code:

import fetch from 'node-fetch';

const apiUrl = 'https://api.apify.com/v2/acts/karamelo~test-youtube-structured-transcript-extractor/run-sync-get-dataset-items?token=apify_api_**************';

// Split the input URLs by comma and trim any whitespace 
const urlsList = 'https://www.youtube.com/watch?v=ATapsyGafXc';
const urls = urlsList.split(',').map(url => url.trim());

const input =  { "proxyOptions": { "useApifyProxy": true, "apifyProxyGroups": [ "RESIDENTIAL" ] }, "urls": [ "https://www.youtube.com/watch?v=ATapsyGafXc" ] };
//{ urls: urls };

const options = {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify(input)
};

async function fetchTranscripts() {
  try {
    const response = await fetch(apiUrl, options);
    if (!response.ok) {
      throw new Error(`Error fetching data from Apify: ${response.statusText}`);
    }

    let result = await response.json(); 
    //console.log('Result:', result);
    if (Array.isArray(result)) { 
      const transcript = result.reduce((fullTranscript, item) => {
        const text = item.captions
          .filter(segment => segment.trim() !== '')  
          //.map(segment => segment.text)  // No need for map() as segments are already strings
          .join(' '); 
        return `${fullTranscript} ${text}`;
      }, '').trim().replaceAll("&#39;", "\'");
    
      //console.log('Transcript:', transcript);

  return transcript;
} else {
  console.error('Result is not an array.');
}

  } catch (error) {
    console.error('Error fetching data from Apify:', error);
    return 'Error fetching data from Apify';
  }
}

console.log(await fetchTranscripts()) ;
Developer
Maintained by Community
Actor metrics
  • 24 monthly users
  • 4 stars
  • 100.0% runs succeeded
  • 1.6 hours response time
  • Created in Jun 2024
  • Modified 6 days ago