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

Upload failed with status 404 #603

Closed
4 tasks done
3IMAD69 opened this issue Feb 22, 2024 · 2 comments
Closed
4 tasks done

Upload failed with status 404 #603

3IMAD69 opened this issue Feb 22, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@3IMAD69
Copy link

3IMAD69 commented Feb 22, 2024

Steps to reproduce

example of code

`import { readFileSync, writeFileSync, existsSync } from 'fs';
import { Innertube, UniversalCache } from 'youtubei.js';
import { DeleteLink } from './db/WaitList';

const creds_path = './client_secret.json';
const creds = existsSync(creds_path) ? JSON.parse(readFileSync(creds_path).toString()) : undefined;

export async function UploadShorts (filename:string,ShortTitle:string,desc:string | undefined,LinkID:string) {
  const yt = await Innertube.create({ cache: new UniversalCache(false) });
  
  yt.session.on('auth-pending', (data) => {
    console.info(`Hello!\nOn your phone or computer, go to ${data.verification_url} and enter the code ${data.user_code}`);
  });

  yt.session.on('auth', (data) => {
    writeFileSync(creds_path, JSON.stringify(data.credentials));
    console.info('Successfully signed in!');
  });

  yt.session.on('update-credentials', (data) => {
    writeFileSync(creds_path, JSON.stringify(data.credentials));
    console.info('Credentials updated!', data);
  });

  await yt.session.signIn(creds);
  
  const file = readFileSync('./ffmpeg-auto/'+filename+'.mp4');
  

  console.log(`UPLOADING ...`);
  try{
    const upload = await yt.studio.upload(file.buffer, {
      title: ShortTitle,
      description: desc || hashtags,
      privacy: 'PUBLIC'
    });
    
  
    console.info('Done!', upload);
    if(upload.success){
      console.log('Uploaded Succesfully')
      await DeleteLink(LinkID);
      return true
  
    }else{
      console.log('eerror while uploading')
      return false
    }
  }catch(error){
      console.log('Error While Uploading , '+error)
      UploadShorts(filename,ShortTitle,desc,LinkID)
  }
 
  //delete file
}

Failure Logs

Successfully signed in!
UPLOADING ...
Error While Uploading , Error: Request to https://www.youtube.com/youtubei/vtrue/upload/createvideo?prettyPrint=false&alt=json failed with status 400

Expected behavior

Uploaded Succesfully + some metadata about the video
i've been testing this library for so long , everyday , this morning is the first time i see this issue

Current behavior

failed to fetch

Version

Default

Anything else?

.

Checklist

  • I am running the latest version.
  • I checked the documentation and found no answer.
  • I have searched the existing issues and made sure this is not a duplicate.
  • I have provided sufficient information.
@3IMAD69 3IMAD69 added the bug Something isn't working label Feb 22, 2024
@antidiestro
Copy link

Having the same issue with a search request. Been working for years and just now it's broken. Seems like something has broken/changed on YouTube's end.

LuanRT added a commit that referenced this issue Feb 23, 2024
It doesn't make sense to do this anyway because if it ever changed, we'd probably have to refactor the entire library.

Closes #602, #603, #604
@LuanRT
Copy link
Owner

LuanRT commented Feb 23, 2024

Fixed in 2068dfb.

@LuanRT LuanRT closed this as completed Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants