Skip to content

Instantly share code, notes, and snippets.

@gelehrtecrest
Created November 8, 2024 00:13
Show Gist options
  • Select an option

  • Save gelehrtecrest/a2d5a98a1ee6272dd294338af8c818fe to your computer and use it in GitHub Desktop.

Select an option

Save gelehrtecrest/a2d5a98a1ee6272dd294338af8c818fe to your computer and use it in GitHub Desktop.
var title = Youtube.newVideoUploadedYt.Title;
var url = Youtube.newVideoUploadedYt.Url;
if(title.indexOf("フクロモモンガ") == -1){
Twitter.postNewTweetWithImage1.skip()
Twitter.postNewTweetWithImage2.skip()
MakerWebhooks.makeWebRequest.skip()
}
var index = url.indexOf("?v=");
var id = "";
if(index != -1){
id = url.slice(index + 3);
} else {
index = url.indexOf("youtu.be/");
id = url.slice(index + 9);
}
//ショート動画用のURLに切り替える
//#short もしくは #shorts がタイトルに入っていたらショート動画URLにする
if(title.indexOf("#short") != -1){
url = "https://www.youtube.com/shorts/" + id
}
var comment1_1 = "おはようですよーノ`・ω・)ノ";
var comment1_2 = "今日もお疲れ様ですノ`・ω・)ノ"
var comment2 = "今日のフクロモモンガです。高画質動画はリンク先からどうぞ";
var description = Youtube.newVideoUploadedYt.Description;
var description_top_index = description.indexOf("-----");
if(description_top_index !== -1){
comment1_1 = description.substr( 0, description_top_index );
comment1_2 = comment1_1;
}
if(Meta.currentUserTime.hour() < 10){
Twitter.postNewTweetWithImage1.setTweet(comment1_1 + "\n\n" + comment2 + "\n\n" + title + " \n" + url);
Twitter.postNewTweetWithImage2.setTweet(comment1_1 + "\n\n" + comment2 + "\n\n" + title + " \n" + url);
} else {
Twitter.postNewTweetWithImage1.setTweet(comment1_2 + "\n\n" + comment2 + "\n\n" + title + " \n" + url);
Twitter.postNewTweetWithImage2.setTweet(comment1_2 + "\n\n" + comment2 + "\n\n" + title + " \n" + url);
}
Twitter.postNewTweetWithImage1.setPhotoUrl("https://img.youtube.com/vi/" + id + "/hqdefault.jpg");
Twitter.postNewTweetWithImage2.setPhotoUrl("https://img.youtube.com/vi/" + id + "/hqdefault.jpg");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment