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

Idea: convert our episode audio files into mp4, then upload to YouTube automatically #244

Open
LinuxSuRen opened this issue Sep 27, 2023 · 17 comments
Labels
Hacktoberfest More details from https://hacktoberfest.digitalocean.com/ help wanted Extra attention is needed

Comments

@LinuxSuRen
Copy link
Member

LinuxSuRen commented Sep 27, 2023

YouTube already have the Postcast support. It would be great to convert our episode audio files into mp4, then upload to YouTube automatically. For example, we could find or create a CLI to do it. Then create a GitHub workflow to trigger it.

I found some potential tools could help us:

The steps might be:

  • Check if the episode exist in YouTube
  • Convert the mp3 to mp4 with a picture
  • Upload the mp4 file

See also the following example command:

ffmpeg -loop 1 -i logo.png -i osf2f-s01e21-richard.mp3 -vf "scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:-1:-1:color=black,setsar=1,format=yuv420p" -shortest -fflags +shortest osf2f-s01e21-richard.mp4
@LinuxSuRen LinuxSuRen added the help wanted Extra attention is needed label Sep 27, 2023
@wey-gu wey-gu added the Hacktoberfest More details from https://hacktoberfest.digitalocean.com/ label Sep 27, 2023
@MikeyWei
Copy link
Contributor

MikeyWei commented Sep 27, 2023

Although Google Podcasts has been merged into Youtube Music, Youtube is still a very important channel. And we look forward to someone someone with experience in service development to implement this feature.

@hellojukay
Copy link

What is the workflow? Where can I get the mp3 files and YouTube video title information? It seems that I only need to write some short scripts to achieve it.

@MikeyWei
Copy link
Contributor

What is the workflow? Where can I get the mp3 files and YouTube video title information? It seems that I only need to write some short scripts to achieve it.

I guess the workflow is like this. When the RSS is updated, get the mp3 file and transcode it (executed through GitHub action), and then upload the mp4 file through YouTube's API.

The mp3 files can be obtained from our RSS, and the video information is in shownotes.

@wjsvec
Copy link
Member

wjsvec commented Sep 29, 2023

Will there be such a risk?
image

@wey-gu
Copy link
Member

wey-gu commented Sep 29, 2023

Maybe the concern comes from running CPU-intensive tasks (i.e. FFmpeg converting job) with GH Action?

@yihong0618 had a lot of hacking GH action experiences to alert such concern, maybe please you could share more context?

@yihong0618
Copy link

@LinuxSuRen @wey-gu do some search, for this job I think its OK.
but what I am concern is that for a official account it still be risk, something like https://www.v2ex.com/t/874221

@wjsvec
Copy link
Member

wjsvec commented Sep 30, 2023

I will try to implement this issue. Here's a question.

The "Check if the episode exists in YouTube" step may cause problems due to anti-crawlers. Can we save a log file locally to record the uploaded videos?

@wey-gu
Copy link
Member

wey-gu commented Sep 30, 2023

I will try to implement this issue. Here's a question.

The "Check if the episode exists in YouTube" step may cause problems due to anti-crawlers. Can we save a log file locally to record the uploaded videos?

That will do!

Another mitigation to avoid being treated as malicious probe would be checking via rss interface/ proxied rss:

https://www.youtube.com/feeds/videos.xml?channel_id=THE_CHANNEL_ID_HERE

While, I agree with you that in current slo, maintain local state may be much better in many perspectives.

@wjsvec
Copy link
Member

wjsvec commented Oct 1, 2023

I will try to implement this issue. Here's a question.
The "Check if the episode exists in YouTube" step may cause problems due to anti-crawlers. Can we save a log file locally to record the uploaded videos?

That will do!

Another mitigation to avoid being treated as malicious probe would be checking via rss interface/ proxied rss:

https://www.youtube.com/feeds/videos.xml?channel_id=THE_CHANNEL_ID_HERE

While, I agree with you that in current slo, maintain local state may be much better in many perspectives.

aha, what is the channel ID of osf2f? It seems that only the author can see this ID himself.

@LinuxSuRen
Copy link
Member Author

aha, what is the channel ID of osf2f? It seems that only the author can see this ID himself.

Here is the channel. https://www.youtube.com/channel/UCV7Ibg1k_aMSEcDFgJvuvdg

But please make sure that everything is ok before using it. And thanks for your effort.

@hellojukay
Copy link

我尝试去解决这个问题,但是遇到了2个问题 https://github.com/hellojukay/episode/actions

  1. 在 github action 里面进行 mp3 转 mp4 速度非常慢,一个视频大概需要 40 多分钟
  2. 上传 mp4 到 youtube 认证需要浏览器重定向点击认证,也可以使用 token , 但是 token 七天会过期
  3. 判断 mp4 在 youtube 是否已经存在,可能比较麻烦,需要调用 api 之类的,也存在应用认证的问题。

@wey-gu
Copy link
Member

wey-gu commented Oct 13, 2023

  1. 上传 mp4 到 youtube 认证需要浏览器重定向点击认证,也可以使用 token , 但是 token 七天会过期

It seems it was in status "Testing" causing the refresh token expiring in 7 days, for production refresh token, it's longer, someone said it's like 1 year?

  1. 判断 mp4 在 youtube 是否已经存在,可能比较麻烦,需要调用 api 之类的,也存在应用认证的问题。

As I mentioned above, we may leverage the RSS of the channel to probe content without auth?

@LinuxSuRen
Copy link
Member Author

在 github action 里面进行 mp3 转 mp4 速度非常慢,一个视频大概需要 40 多分钟

This is not a big problem. We can wait.

Acrrroding to @wey-gu comment, one year's token seem be acceptable.

By the way, the RSS address of YouTube seems not available. See also https://www.youtube.com/feeds/videos.xml?channel_id=UCV7Ibg1k_aMSEcDFgJvuvdg

@wey-gu
Copy link
Member

wey-gu commented Oct 13, 2023

在 github action 里面进行 mp3 转 mp4 速度非常慢,一个视频大概需要 40 多分钟

This is not a big problem. We can wait.

Acrrroding to @wey-gu comment, one year's token seem be acceptable.

By the way, the RSS address of YouTube seems not available. See also https://www.youtube.com/feeds/videos.xml?channel_id=UCV7Ibg1k_aMSEcDFgJvuvdg

https://www.youtube.com/feeds/videos.xml?channel_id=UCV7Ibg1k_aMSEcDFgJvuvdg” should be the one, maybe just accessing via browser is not allowed, I checked via feedly it's fine.

Screenshot 2023-10-13 at 15 45 48
<link rel="alternate" type="application/rss+xml" title="RSS" href="https://www.youtube.com/feeds/videos.xml?channel_id=UCV7Ibg1k_aMSEcDFgJvuvdg">

@wey-gu
Copy link
Member

wey-gu commented Oct 13, 2023

update: it seems rss for youtube is full of problems, we could think of it doesnt support rss at all :(

@LinuxSuRen
Copy link
Member Author

I cannot get the correct RSS content even via the following command:

curl https://www.youtube.com/feeds/videos.xml?channel_id=UCV7Ibg1k_aMSEcDFgJvuvdg \
  -H "Content-Type: application/rss+xml" -H 'Accept: application/rss+xml'

@wey-gu
Copy link
Member

wey-gu commented Oct 13, 2023

I cannot get the correct RSS content even via the following command:

curl https://www.youtube.com/feeds/videos.xml?channel_id=UCV7Ibg1k_aMSEcDFgJvuvdg \
  -H "Content-Type: application/rss+xml" -H 'Accept: application/rss+xml'

Yeah, i have done the equivalent via python and encountered 404, too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Hacktoberfest More details from https://hacktoberfest.digitalocean.com/ help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

6 participants