-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Yusuf Usta
committed
Nov 18, 2021
1 parent
4fdbc32
commit 470ce4d
Showing
13 changed files
with
3,283 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
from ytstudio import Studio | ||
import asyncio | ||
import json | ||
import os | ||
|
||
if os.path.exists("./login.json"): | ||
LOGIN_FILE = json.loads(open("./login.json", "r")) | ||
else: | ||
exit("can't run example without login json") | ||
yt = Studio(LOGIN_FILE) | ||
|
||
|
||
async def edit_video(): | ||
await yt.login() | ||
sonuc = await yt.editVideo( | ||
video_id="aaaaaaaa", | ||
title="test", # new title | ||
description="test", # new description | ||
privacy="PUBLIC", # new privacy status (PUBLIC, PRIVATE, UNLISTER) | ||
tags=["test", "test2"], # new tags | ||
category=22, # new category | ||
thumb="./test.png", # new thumbnail (png, jpg, jpeg, <2MB) | ||
playlist=["aaaaa", "bbbbbb"], # new playlist | ||
monetization=True, # new monetization status (True, False) | ||
) | ||
print(f"successfully edited! videoId: {sonuc['videoId']}") | ||
|
||
|
||
async def delete_video(): | ||
await yt.login() | ||
sonuc = await yt.deleteVideo( | ||
video_id="aaaaaaaa", | ||
) | ||
print(f"successfully deleted! videoId: {sonuc['videoId']}") | ||
|
||
loop = asyncio.get_event_loop() | ||
loop.run_until_complete(edit_video()) | ||
loop.run_until_complete(delete_video()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from ytstudio import Studio | ||
import asyncio | ||
import json | ||
import os | ||
|
||
|
||
async def get_video_list(): | ||
if os.path.exists("./login.json"): | ||
LOGIN_FILE = json.loads(open("./login.json", "r")) | ||
else: | ||
exit("can't run example without login json") | ||
|
||
yt = Studio(LOGIN_FILE) | ||
|
||
await yt.login() | ||
sonuc = await yt.listVideos() | ||
print(sonuc) | ||
|
||
|
||
async def get_video(): | ||
if os.path.exists("./login.json"): | ||
LOGIN_FILE = json.loads(open("./login.json", "r")) | ||
else: | ||
exit("can't run example without login json") | ||
|
||
yt = Studio(LOGIN_FILE) | ||
|
||
await yt.login() | ||
sonuc = await yt.getVideo("aaaaaaa") | ||
print(sonuc) | ||
|
||
loop = asyncio.get_event_loop() | ||
loop.run_until_complete(get_video()) | ||
loop.run_until_complete(get_video_list()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"SESSION_TOKEN": "", | ||
"VISITOR_INFO1_LIVE": "", | ||
"PREF": "", | ||
"LOGIN_INFO": "", | ||
"SID": "", | ||
"__Secure-3PSID": "", | ||
"HSID": "", | ||
"SSID": "", | ||
"APISID": "", | ||
"SAPISID": "", | ||
"__Secure-3PAPISID": "", | ||
"YSC": "", | ||
"SIDCC": "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,26 @@ | ||
from ytstudio import Studio | ||
import asyncio | ||
from pyquery import PyQuery as pq | ||
import os | ||
import json | ||
|
||
|
||
def progress(yuklenen, toplam): | ||
#print(f"{yuklenen}/{toplam}", end="\r") | ||
print(f"{round(yuklenen / toplam) * 100}% upload", end="\r") | ||
pass | ||
|
||
|
||
if os.path.exists("./login.json"): | ||
LOGIN_FILE = json.loads(open("./login.json", "r")) | ||
else: | ||
exit("can't run example without login json") | ||
|
||
yt = Studio(LOGIN_FILE) | ||
|
||
|
||
async def main(): | ||
yt = Studio({'VISITOR_INFO1_LIVE': '', 'PREF': '', 'LOGIN_INFO': '', 'SID': '', '__Secure-3PSID': '', 'HSID': '', | ||
'SSID': '', 'APISID': '', 'SAPISID': '', '__Secure-3PAPISID': '', 'YSC': '', 'SIDCC': ''}, session_token="") | ||
await yt.login() | ||
sonuc = await yt.uploadVideo(os.path.join(os.getcwd(), "deneme.mp4"), progress=progress) | ||
print(sonuc['videoId']) | ||
sonuc = await yt.uploadVideo(os.path.join(os.getcwd(), "test_video.mp4"), progress=progress) | ||
print(f"successfully uploaded! videoId: {sonuc['videoId']}") | ||
|
||
loop = asyncio.get_event_loop() | ||
loop.run_until_complete(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
pytest | ||
pytest-asyncio | ||
pdoc3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
pdoc --html ytstudio | ||
pytest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import pytest | ||
import ytstudio | ||
import json | ||
import os | ||
|
||
if os.path.exists("./login.json"): | ||
LOGIN_FILE = json.loads(open("./login.json", "r")) | ||
else: | ||
exit("can't run test without login json") | ||
|
||
studio = ytstudio.Studio(LOGIN_FILE) | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_upload_video(): | ||
await studio.login() | ||
assert 'videoId' in (await studio.uploadVideo(os.path.join( | ||
os.getcwd(), "test.mp4"))) |
Oops, something went wrong.