mirror of
https://github.com/HappyTanuki/BumbleCee.git
synced 2025-10-26 09:55:14 +00:00
와! 소리가 나요! 근데 도당체 코루틴은 왜 안 되는데;
This commit is contained in:
@@ -12,11 +12,28 @@ def uri_validator(x):
|
||||
except AttributeError:
|
||||
return False
|
||||
|
||||
#URL인 경우
|
||||
if uri_validator(sys.argv[1]) == True:
|
||||
exit()
|
||||
result = urllib.parse.urlparse(sys.argv[1])
|
||||
|
||||
from youtube_search import YoutubeSearch
|
||||
#플레이리스트인 경우
|
||||
if result.path == '/playlist':
|
||||
import re, requests
|
||||
|
||||
results = YoutubeSearch(sys.argv[1], max_results=10).to_dict()
|
||||
response = requests.get("https://www.youtube.com/playlist?" + result.query)
|
||||
|
||||
print(results[0]["id"])
|
||||
pattern = re.compile('"videoId":"(.{11})"')
|
||||
|
||||
list = set(pattern.findall(response.text))
|
||||
for it in list:
|
||||
print(it)
|
||||
#영상인 경우
|
||||
elif result.path == '/watch':
|
||||
print(result.query[2:13])
|
||||
else:
|
||||
from youtube_search import YoutubeSearch
|
||||
|
||||
results = YoutubeSearch(sys.argv[1], max_results=10).to_dict()
|
||||
|
||||
#검색 결과가 없는 경우 확인 불가
|
||||
print(results[0]["id"])
|
||||
Reference in New Issue
Block a user