Schroedinger-Hat / youtube-to-anchorfm

An automation process to convert YouTube video into audio file and uploading it to Anchor.fm podcast
MIT License
128 stars 71 forks source link

Error: Unable to post episode to anchorfm: TimeoutError: Waiting for selector `input[type=file]` failed: Waiting failed: 30000ms #87

Closed jordanscience closed 7 months ago

jordanscience commented 1 year ago

Hello, do you have an idea of this bug?

Running on MAC

Logged in Uploading audio file Error: Unable to post episode to anchorfm: TimeoutError: Waiting for selector input[type=file] failed: Waiting failed: 30000ms exceeded at postEpisode (/Users/jordan/perso/youtube-to-anchorfm/src/anchorfm-pupeteer/index.js:174:11) at async main (/Users/jordan/perso/youtube-to-anchorfm/src/index.js:36:3)

Thanks

abe-101 commented 1 year ago

Are running this on your local computer? I have yet to hear of anyone who's tried this project locally on a mac Could it be an issue may be related to that :shrug:

matevskial commented 1 year ago

This issue appears mostly locally(I run it on a Linux distribution - KDE Neon) and this issue is not consistent, sometiems it appears, sometimes it doesn't.

But when running as a GitHub action, the issue is not happening.

storrisi commented 1 year ago

@matevskial I actually faced the same issue a week ago running the Github action several times

LauPaSat-pl commented 1 year ago

@matevskial I also got very similar issue running it on Github Actions (2 times out of 21 runs). The only difference I see is that I got the error on title instead of input[type=file].

Here's my full error: Error: Unable to post episode to anchorfm: TimeoutError: Waiting for selector #title failed: Waiting failed: 30000ms exceeded at postEpisode (/src/anchorfm-pupeteer/index.js:174:11) at async main (/src/index.js:36:3)

marinbenc commented 1 year ago

Where are y'all located? My hunch is that this happens because of the EU cookies popup, but I'm not sure.

When I run outside of headless mode and manually click the "Accept Cookies" button, Puppeteer happily proceeds to upload the episode. I tried to spoof my geolocation to be in the US as follows:

src/anchorfm-pupeteer/index.js:82

async function postEpisode(youtubeVideoInfo) {
  let browser;
  try {
    console.log('Launching puppeteer');
    browser = await puppeteer.launch({ args: ['--no-sandbox'], headless: false });
    const page = await browser.newPage();

    const context = browser.defaultBrowserContext();
    await page.setGeolocation({latitude: 47.75, longitude: -120.74});

    const navigationPromise = page.waitForNavigation();
    await context.overridePermissions('https://anchor.fm/dashboard/episode/new', ['geolocation']);

    await page.goto('https://anchor.fm/dashboard/episode/new');
    await page.setViewport({ width: 1600, height: 789 });
    await navigationPromise;

    console.log('Trying to log in');
(...)

But this didn't work. If anyone understands Puppeteer better maybe they can chime in how to spoof the location to avoid the cookie popup. Or how to click the accept button if it appears.

abe-101 commented 1 year ago

I am in the us and also have this issue randomly.

I support your hunch that it may be related to the cookie pop up

We could have pupeteer to first except the cookies then proceed to login.

jordanscience commented 1 year ago

I have the same issue when running with GitHub Action ...

https://github.com/jordanscience/youtube-to-anchorfm/actions/runs/5073577077/jobs/9112763736

geeknarrator commented 1 year ago

I have had the same issues and I am in the EU.

shelomito12 commented 1 year ago

It happens to me today which brought me here. Tried to re-run the failed job but keep getting similar error:

Posting episode to anchorfm
Launching puppeteer
Trying to log in
Logged in
Uploading audio file
Waiting for upload to finish
-- Adding title
Error: Unable to post episode to anchorfm: TimeoutError: waiting for selector `#title` failed: timeout 30000ms exceeded
    at postEpisode (/src/anchorfm-pupeteer/index.js:1[57](https://github.com/jzvi12/youtube-to-anchorfm/actions/runs/5177297618/jobs/9327426723#step:4:58):15)
    at async main (/src/index.js:37:5)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! youtube-to-anchorfm@2.0.0 start: `node src/index.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the youtube-to-anchorfm@2.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /github/home/.npm/_logs/2023-06-05T13_03_15_839Z-debug.log
dav1403 commented 1 year ago

I am having the same issue, anyone found a fix or a workaround?

shelomito12 commented 1 year ago

This is the end for youtube-to-anchorfm. Every week we have a new YouTube video but the Action keep failing. Now we have to upload manually

matevskial commented 1 year ago

We are aware of the issue.

The issue is most likely due to the cookie popup.

We are going to try to tackle the problem.

TheJoin95 commented 11 months ago

Can we close this issue @matevskial ?

TheJoin95 commented 7 months ago

Is this issue still around?