├── .github
└── FUNDING.yml
├── LICENSE
├── README.md
├── main.py
└── requirements.txt
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | patreon: cactochan
4 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023 Cactochan
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Ytmaker v 1.0.0
2 |
3 | Makes compilation videos and upload them to Youtube
4 |
5 |
6 |
7 | ## Table Of Contents
8 |
9 | * [Getting Started](#getting-started)
10 | * [General Information](#general-information)
11 | * [Warnings N Note](#warnings-n-note)
12 | * [Installation](#install-and-run)
13 |
14 |
15 | ## Getting Started
16 |
17 |
18 | ### General Information
19 |
20 | The compilation maker scrapes videos uploaded by the people who you follow using the provided instagram account.
21 |
22 | - You can also post shorts, for that scrape videos from people who upload videos which are shot in vertical orientation with a 9:16 aspect ratio and 1920 pixels by 1080 pixels resolution.
23 |
24 | - Reffer to this video for making you application https://www.youtube.com/watch?v=aFwZgth790Q , so that we can make you of the Youtube API
25 |
26 | This project was inspired from https://github.com/nathan-149/automated_youtube_channel, But it doesnt work any longer ig (concludes after trying it out and going through the issues in the repo)
27 |
28 |
29 | ### Warnings N Note
30 | - Don't use the tool on any instagram accounts with out their allowance
31 | - The CPU will go brrrr.. When the video is being compiled , So there are chances things get hot etc and etc
32 | - You need to wait for about 10 days for getting your application verrified, after that your yt vids be public
33 | - You need to have a intro.mp4 for the videos intro
34 |
35 | ### Install and Run
36 |
37 | - You need python and pip installed
38 |
39 |
40 | ```sh
41 | git clone https://github.com/merwin-asm/Ytmaker.git
42 | ```
43 |
44 | ```sh
45 | cd Ytmaker
46 | ```
47 |
48 | ```sh
49 | pip install -r requirements.txt
50 | ```
51 |
52 | ```sh
53 | python3 main.py
54 | ```
55 |
--------------------------------------------------------------------------------
/main.py:
--------------------------------------------------------------------------------
1 | """
2 | YtMaker v 1.0.0
3 |
4 | Autogenerate compilation videos,
5 | by getting videos from Instagram
6 | and upload it to Youtube.
7 | """
8 |
9 |
10 |
11 | from youtube_upload.client import YoutubeUploader
12 | from instagrapi import Client
13 | from rich import print
14 | from moviepy.editor import *
15 | import time
16 | import random
17 | import os
18 |
19 |
20 |
21 |
22 | print("\n[blue] [?] The Number of videos to be compiled ?[/blue]", end="")
23 | NUM_OF_VIDS_USED = int(input(" "))
24 |
25 | print("[blue] [?] The current number of videos in youtube channel ?[/blue]", end="")
26 | VID_NUM = int(input(" ")) + 1
27 |
28 | print("[blue] [?] The Insta username ?[/blue]", end="")
29 | INSTA_USERNAME = input(" ")
30 |
31 | print("[blue] [?] The Insta pwd ?[/blue]", end="")
32 | INSTA_PWD = input(" ")
33 |
34 | print("[blue] [?] Client ID (yt API) ?[/blue]", end="")
35 | ci = input(" ")
36 |
37 | print("[blue] [?] Client secret (yt API) ?[/blue]", end="")
38 | cs = input(" ")
39 |
40 | print("[blue] [?] Title for the videos ?[/blue]", end="")
41 | TITLE = input(" ")
42 |
43 | print("[blue] [?] Description for the videos ?[/blue]", end="")
44 | DESC = input(" ")
45 |
46 | print("[blue] [?] Tags for the videos (separate using ',') ?[/blue]", end="")
47 | TAGS = input(" ")
48 |
49 | print("[blue] [?] Time delay between each videos in minutes ? [/blue]", end="")
50 | TIME_DELAY = int(input(" "))
51 |
52 |
53 |
54 | uploader = YoutubeUploader(ci,cs)
55 |
56 | uploader.authenticate()
57 |
58 |
59 |
60 | def Download():
61 |
62 | cl = Client()
63 |
64 | cl.request_timeout = 20
65 |
66 | cl.login(INSTA_USERNAME, INSTA_PWD)
67 |
68 | print("[green] [+] LOGGED IN TO INSTAGRAM[\green]")
69 |
70 |
71 | user_id = cl.user_id_from_username(INSTA_USERNAME)
72 |
73 | z = cl.user_following(user_id)
74 |
75 | time.sleep(4)
76 |
77 | URLS = []
78 |
79 | N_URLS = []
80 |
81 | FILES = []
82 |
83 | for e in z:
84 |
85 | time.sleep(4+random.randint(1,60)*0.05)
86 |
87 | medias = cl.user_medias(e, 25)
88 |
89 | for e in medias:
90 |
91 | if e.dict()["media_type"] == 2:
92 | URLS.append(e.dict()["video_url"])
93 |
94 |
95 | for e in range(0, NUM_OF_VIDS_USED):
96 | N_URLS.append(random.choice(URLS))
97 |
98 |
99 | for e in N_URLS:
100 | time.sleep(5+random.randint(1,60)*0.05)
101 |
102 | FILES.append(cl.video_download_by_url(e, str(random.randint(1000000000000000,10000000000000000000000))))
103 |
104 | return FILES
105 |
106 |
107 |
108 |
109 | def make_video(files):
110 | clips = []
111 |
112 | clips.append("intro.mp4")
113 |
114 | for e in files:
115 | clips.append(str(e))
116 |
117 | # concatenating both the clips
118 | concatenate(clips,f"videos/vid_{VID_NUM}.mp4")
119 |
120 |
121 |
122 |
123 |
124 | def concatenate(video_clip_paths, output_path, method="compose"):
125 |
126 | # create VideoFileClip object for each video file
127 | clips = [VideoFileClip(c) for c in video_clip_paths]
128 |
129 | if method == "reduce":
130 | # calculate minimum width & height across all clips
131 | min_height = min([c.h for c in clips])
132 | min_width = min([c.w for c in clips])
133 | # resize the videos to the minimum
134 | clips = [c.resize(newsize=(min_width, min_height)) for c in clips]
135 | # concatenate the final video
136 | final_clip = concatenate_videoclips(clips)
137 |
138 | elif method == "compose":
139 | # concatenate the final video with the compose method provided by moviepy
140 | final_clip = concatenate_videoclips(clips, method="compose")
141 |
142 | # write the output video file
143 | final_clip.write_videofile(output_path)
144 |
145 |
146 |
147 |
148 | while True:
149 |
150 | print("\n\n[green] [+] DOWNLOADING VIDEOs [/green]")
151 | files = Download()
152 |
153 | print("[green] [+] MAKING VIDEO [/green]")
154 |
155 | make_video(files)
156 |
157 | for e in files:
158 | os.system(f"rm {e}")
159 |
160 |
161 | print("[green] [+] UPLOADING TO YT [/green]")
162 |
163 |
164 | options = {
165 | "title" : f"{TITLE} - {VID_NUM}" ,
166 | "description" : DESC,
167 | "tags" : TAGS.split(","),
168 | "categoryId" : "22",
169 | "privacyStatus" : "public",
170 | "kids" : False}
171 |
172 |
173 | # upload video
174 | uploader.upload(f"videos/vid_{VID_NUM}.mp4",options)
175 |
176 |
177 | print("[dark_orange] [+] UPLOADED [/dark_orange]")
178 |
179 | VID_NUM += 1
180 |
181 | print(f"\n[yellow] [~] Next Upload In {TIME_DELAY} Mins[/yellow]")
182 |
183 | time.sleep(TIME_DELAY*60)
184 |
185 |
186 |
187 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | instagrapi
2 | rich
3 | moviepy
4 | pillar-youtube-upload
5 |
--------------------------------------------------------------------------------