playrip 2.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
playrip-2.0.1/PKG-INFO ADDED
@@ -0,0 +1,71 @@
1
+ Metadata-Version: 2.4
2
+ Name: playrip
3
+ Version: 2.0.1
4
+ Summary: Esse projeto é usado para abaixar musicas tanto no spotify e no Youtube
5
+ Author: IyinG
6
+ Author-email: 165347923+Blackgnr7@users.noreply.github.com
7
+ Requires-Python: >=3.10,<4.0
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.10
10
+ Classifier: Programming Language :: Python :: 3.11
11
+ Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: Programming Language :: Python :: 3.13
13
+ Classifier: Programming Language :: Python :: 3.14
14
+ Requires-Dist: eyeD3 (>=0.9.7)
15
+ Requires-Dist: mutagen (>=1.47.0)
16
+ Requires-Dist: pydub (>=0.25.1)
17
+ Requires-Dist: pytubefix (>=10.3.6)
18
+ Requires-Dist: requests (>=2.32.0)
19
+ Requires-Dist: spotipy (>=2.24.0)
20
+ Description-Content-Type: text/markdown
21
+
22
+ # PlayRip
23
+
24
+ ![GitHub repo size](https://img.shields.io/github/repo-size/Blackgnr7/PlayRip?style=flat-square)
25
+ ![GitHub language count](https://img.shields.io/github/languages/count/Blackgnr7/PlayRip?style=for-the-badge)
26
+ ![GitHub forks](https://img.shields.io/github/forks/Blackgnr7/PlayRip?style=for-the-badge)
27
+ ![Bitbucket open issues](https://img.shields.io/bitbucket/issues/Blackgnr7/PlayRip?style=for-the-badge)
28
+ ![Bitbucket open pull requests](https://img.shields.io/bitbucket/pr-raw/iBlackgnr7/PlayRip?style=for-the-badge)
29
+
30
+ ### Ajustes e melhorias
31
+
32
+ O projeto ainda está em desenvolvimento e as próximas atualizações serão voltadas para as seguintes tarefas:
33
+
34
+ - [x] Dowload de mp3,qualidade 320Kps, e tambem a thumbnail e o nome do artista
35
+ - [x] Ser capaz de escolher se quer em mp4 ou em mp3
36
+ - [x] dowloader automatico em qualquer sistema operacional
37
+ - [x] capaz de abaixar no spotify
38
+ - [x] ser capaz de usar em blibioteca python
39
+ - [ ] Ser capaz de instalar uma playlist inteira
40
+
41
+ ## 💻 Pré-requisitos
42
+
43
+ Antes de começar, verifique se você atendeu aos seguintes requisitos:
44
+
45
+ - Você instalou a versão mais recente de `Python / Requests,eyed3,mutagen,FFmpeg,pydub,pytubefix,spotipy`
46
+ - Você tem uma máquina `Linux,Macos,Windows`.
47
+
48
+ ## 🚀 Instalando playrip manualmente
49
+
50
+ Para instalar o PlayRip, siga estas etapas:
51
+
52
+ ```
53
+ pip install playrip
54
+ ```
55
+
56
+ ## ☕ Usando playrip
57
+
58
+ Para usar PlayRip para abaixar videos do youtube, siga estas etapas:
59
+
60
+ ```
61
+ playrip <url-Video-youtube> <mp4-or-mp3>
62
+ ```
63
+
64
+ Para usar PlayRip para abaixar musicas do spotify, e siga estas etapas:
65
+
66
+ ```
67
+ playrip <url-musica-spotify>
68
+ ```
69
+
70
+ Adicione comandos de execução e exemplos que você acha que os usuários acharão úteis. Forneça uma referência de opções para pontos de bônus!
71
+
@@ -0,0 +1,49 @@
1
+ # PlayRip
2
+
3
+ ![GitHub repo size](https://img.shields.io/github/repo-size/Blackgnr7/PlayRip?style=flat-square)
4
+ ![GitHub language count](https://img.shields.io/github/languages/count/Blackgnr7/PlayRip?style=for-the-badge)
5
+ ![GitHub forks](https://img.shields.io/github/forks/Blackgnr7/PlayRip?style=for-the-badge)
6
+ ![Bitbucket open issues](https://img.shields.io/bitbucket/issues/Blackgnr7/PlayRip?style=for-the-badge)
7
+ ![Bitbucket open pull requests](https://img.shields.io/bitbucket/pr-raw/iBlackgnr7/PlayRip?style=for-the-badge)
8
+
9
+ ### Ajustes e melhorias
10
+
11
+ O projeto ainda está em desenvolvimento e as próximas atualizações serão voltadas para as seguintes tarefas:
12
+
13
+ - [x] Dowload de mp3,qualidade 320Kps, e tambem a thumbnail e o nome do artista
14
+ - [x] Ser capaz de escolher se quer em mp4 ou em mp3
15
+ - [x] dowloader automatico em qualquer sistema operacional
16
+ - [x] capaz de abaixar no spotify
17
+ - [x] ser capaz de usar em blibioteca python
18
+ - [ ] Ser capaz de instalar uma playlist inteira
19
+
20
+ ## 💻 Pré-requisitos
21
+
22
+ Antes de começar, verifique se você atendeu aos seguintes requisitos:
23
+
24
+ - Você instalou a versão mais recente de `Python / Requests,eyed3,mutagen,FFmpeg,pydub,pytubefix,spotipy`
25
+ - Você tem uma máquina `Linux,Macos,Windows`.
26
+
27
+ ## 🚀 Instalando playrip manualmente
28
+
29
+ Para instalar o PlayRip, siga estas etapas:
30
+
31
+ ```
32
+ pip install playrip
33
+ ```
34
+
35
+ ## ☕ Usando playrip
36
+
37
+ Para usar PlayRip para abaixar videos do youtube, siga estas etapas:
38
+
39
+ ```
40
+ playrip <url-Video-youtube> <mp4-or-mp3>
41
+ ```
42
+
43
+ Para usar PlayRip para abaixar musicas do spotify, e siga estas etapas:
44
+
45
+ ```
46
+ playrip <url-musica-spotify>
47
+ ```
48
+
49
+ Adicione comandos de execução e exemplos que você acha que os usuários acharão úteis. Forneça uma referência de opções para pontos de bônus!
@@ -0,0 +1,27 @@
1
+ [project]
2
+ name = "playrip"
3
+ version = "2.0.1"
4
+ description = "Esse projeto é usado para abaixar musicas tanto no spotify e no Youtube"
5
+ authors = [
6
+ {name = "IyinG",email = "165347923+Blackgnr7@users.noreply.github.com"}
7
+ ]
8
+ readme = "README.md"
9
+ requires-python = ">=3.10,<4.0"
10
+ dependencies = [
11
+ "requests>=2.32.0",
12
+ "mutagen>=1.47.0",
13
+ "eyeD3>=0.9.7",
14
+ "spotipy>=2.24.0",
15
+ "pytubefix>=10.3.6",
16
+ "pydub>=0.25.1"
17
+ ]
18
+
19
+ [tool.poetry]
20
+ packages = [{ include = "playrip", from = "src" }]
21
+
22
+ [project.scripts]
23
+ playrip = "playrip.cli:main"
24
+
25
+ [build-system]
26
+ requires = ["poetry-core>=2.0.0,<3.0.0"]
27
+ build-backend = "poetry.core.masonry.api"
@@ -0,0 +1,108 @@
1
+ import os
2
+ from mutagen.mp4 import MP4, MP4Cover
3
+ from playrip import get
4
+ import eyed3
5
+ import spotipy
6
+ from spotipy.oauth2 import SpotifyClientCredentials
7
+ from pytubefix import YouTube
8
+ from pydub import AudioSegment
9
+
10
+ diretorio_destino = os.path.expanduser("~/Downloads")
11
+ client_id = "82190b6d4e6d4250a7e8d5a16a29443c"
12
+ client_secret = "eb3c7e469f40400b941dc05116cfc55b"
13
+
14
+
15
+ def Youtube(url, formato_do_audio, thumbnail):
16
+ if formato_do_audio.lower() == "mp3":
17
+ yt = YouTube(url, use_oauth=True, allow_oauth_cache=True)
18
+ artist = yt.author
19
+ titulo = yt.title
20
+ print(f"titulo do video do Youtube: {titulo}")
21
+ caminho_arquivo = f"{diretorio_destino}/{titulo_novo1}.m4a"
22
+ titulo_novo1 = (
23
+ titulo.replace("/", "")
24
+ .replace("|", "")
25
+ .replace("?", "")
26
+ .replace("*", "")
27
+ .replace("<", "")
28
+ .replace(">", "")
29
+ .replace(":", "")
30
+ .replace("\\", "")
31
+ )
32
+ get.audio(url=url,diretorio_destino=diretorio_destino)
33
+ audiofile = eyed3.load(f"{diretorio_destino}/{titulo_novo1}.mp3")
34
+ if not audiofile.tag:
35
+ audiofile.initTag()
36
+ audiofile.tag.artist = artist
37
+ if thumbnail:
38
+ get.thumbnail(url=url,diretorio_destino=diretorio_destino)
39
+ with open(f"{diretorio_destino}/capa.jpg", "rb") as img_file:
40
+ img_data = img_file.read()
41
+ audiofile.tag.images.set(3, img_data, "image/jpeg")
42
+ audiofile.tag.save()
43
+ os.remove(f"{diretorio_destino}/capa.jpg")
44
+ os.remove(f"{caminho_arquivo}")
45
+ if formato_do_audio.lower() == "mp4":
46
+ yt = YouTube(url, use_oauth=True, allow_oauth_cache=True)
47
+ artist = yt.author
48
+ titulo = yt.title
49
+ print(f"titulo do video do Youtube: {titulo}")
50
+ titulo_novo1 = (
51
+ titulo.replace("/", "")
52
+ .replace("|", "")
53
+ .replace("?", "")
54
+ .replace("*", "")
55
+ .replace("<", "")
56
+ .replace(">", "")
57
+ .replace(":", "")
58
+ .replace("\\", "")
59
+ )
60
+ get.video(url=url,diretorio_destino=diretorio_destino)
61
+ caminho_arquivo = f"{diretorio_destino}/{titulo_novo1}.mp4"
62
+ video = MP4(caminho_arquivo)
63
+ video["\xa9ART"] = artist
64
+ if thumbnail:
65
+ get.thumbnail(url=url,diretorio_destino=diretorio_destino)
66
+ with open(f"{diretorio_destino}/capa.jpg", "rb") as img_file:
67
+ img_data = img_file.read()
68
+ video["covr"] = [MP4Cover(img_data, imageformat=MP4Cover.FORMAT_JPEG)]
69
+ video.save()
70
+ os.remove(f"{diretorio_destino}/capa.jpg")
71
+ os.remove(f"{caminho_arquivo}")
72
+
73
+
74
+ def Spotify(url, thumbnail):
75
+ auth_manager = SpotifyClientCredentials(
76
+ client_id=client_id, client_secret=client_secret
77
+ )
78
+ sp = spotipy.Spotify(auth_manager=auth_manager)
79
+ track_info = sp.track(url)
80
+ titulo_spotify = str(track_info["name"])
81
+ Novo_titulo_spotify = (
82
+ titulo_spotify.replace("/", "")
83
+ .replace("|", "")
84
+ .replace("?", "")
85
+ .replace("*", "")
86
+ .replace("<", "")
87
+ .replace(">", "")
88
+ .replace(":", "")
89
+ .replace("\\", "")
90
+ )
91
+ print(f"titulo da musica do spotify: {titulo_spotify}\n")
92
+ get.audio(url=url, diretorio_destino=diretorio_destino)
93
+ audiofile = eyed3.load(f"{diretorio_destino}/{Novo_titulo_spotify}.mp3")
94
+ if not audiofile.tag:
95
+ audiofile.initTag()
96
+ audiofile.tag.artist = track_info["album"]["artists"][0]["name"]
97
+ if thumbnail:
98
+ get.thumbnail(url=url, info=track_info, diretorio_destino=diretorio_destino)
99
+ with open(f"{diretorio_destino}/capa.jpg", "rb") as img_file:
100
+ img_data = img_file.read()
101
+ audiofile.tag.images.set(3, img_data, "image/jpeg")
102
+ audiofile.tag.save()
103
+ os.remove(f"{diretorio_destino}/capa.jpg")
104
+ os.remove(f"{diretorio_destino}/{Novo_titulo_spotify}.m4a")
105
+ try:
106
+ os.remove(".cache")
107
+ except Exception as e:
108
+ pass
@@ -0,0 +1,4 @@
1
+ from .cli import main
2
+
3
+ if(__name__ == "__main__"):
4
+ main()
@@ -0,0 +1,15 @@
1
+ from playrip import Dowload
2
+ import sys
3
+
4
+ def main():
5
+ url = sys.argv[1]
6
+ if("youtu" in url):
7
+ print("\n------Abaixando video do Youtube------")
8
+ if(len(sys.argv) > 2):
9
+ tipo = sys.argv[2]
10
+ Dowload.Youtube(url=url, formato_do_audio=tipo, thumbnail=True)
11
+ if("spotify" in url):
12
+ print("\n------Abaixando musica do spotify------")
13
+ Dowload.Spotify(url=url, thumbnail=True)
14
+ else:
15
+ print("\npf coloque um link no spotify ou youtube")
@@ -0,0 +1,91 @@
1
+ import requests
2
+ import shutil
3
+ import spotipy
4
+ from spotipy.oauth2 import SpotifyClientCredentials
5
+ import re
6
+ from pydub import AudioSegment
7
+ from pytubefix import Search,YouTube
8
+
9
+ client_id = "82190b6d4e6d4250a7e8d5a16a29443c"
10
+ client_secret = "eb3c7e469f40400b941dc05116cfc55b"
11
+
12
+ def id(url):
13
+ patterns = [r"(?:youtu\.be/)([^?&]+)", r"(?:v=)([^?&]+)"]
14
+ for pattern in patterns:
15
+ match = re.search(pattern, url)
16
+ if match:
17
+ return match.group(1)
18
+ return None
19
+
20
+
21
+ def thumbnail(url, info, diretorio_destino):
22
+ if "spotify" in url:
23
+ res = requests.get(info["album"]["images"][0]["url"], stream=True)
24
+ with open(f"{diretorio_destino}/capa.jpg", "wb") as out_file:
25
+ shutil.copyfileobj(res.raw, out_file)
26
+ if "youtu" in url:
27
+ codigo = id(url=url)
28
+ thumbnail_para_abaixar = (
29
+ "https://i.ytimg.com/vi_webp/" + codigo + "/maxresdefault.webp"
30
+ )
31
+ res = requests.get(thumbnail_para_abaixar, stream=True)
32
+ with open(f"{diretorio_destino}/capa.jpg", "wb") as out_file:
33
+ shutil.copyfileobj(res.raw, out_file)
34
+
35
+
36
+ def audio(url, diretorio_destino):
37
+ if "spotify" in url:
38
+ auth_manager = SpotifyClientCredentials(
39
+ client_id=client_id, client_secret=client_secret
40
+ )
41
+ sp = spotipy.Spotify(auth_manager=auth_manager)
42
+ track_info = sp.track(url)
43
+ Novo_titulo_spotify = (
44
+ str(track_info["name"]).replace("/", "")
45
+ .replace("|", "")
46
+ .replace("?", "")
47
+ .replace("*", "")
48
+ .replace("<", "")
49
+ .replace(">", "")
50
+ .replace(":", "")
51
+ .replace("\\", "")
52
+ )
53
+ results = Search(
54
+ f"{track_info["name"]}, {track_info["album"]["artists"][0]["name"]}"
55
+ )
56
+ if results.videos:
57
+ while True:
58
+ i = 0
59
+ try:
60
+ results.videos[i].streams.get_audio_only().download(
61
+ output_path=diretorio_destino
62
+ )
63
+ except Exception as e:
64
+ i += 1
65
+ else:
66
+ break
67
+ sound = AudioSegment.from_file(
68
+ f"{diretorio_destino}/{Novo_titulo_spotify}.m4a", format="m4a"
69
+ )
70
+ sound.export(f"{diretorio_destino}/{Novo_titulo_spotify}.mp3", format="mp3")
71
+ if "youtu" in url:
72
+ yt = YouTube(url, use_oauth=True, allow_oauth_cache=True)
73
+ titulo = yt.title
74
+ titulo_novo1 = (
75
+ titulo.replace("/", "")
76
+ .replace("|", "")
77
+ .replace("?", "")
78
+ .replace("*", "")
79
+ .replace("<", "")
80
+ .replace(">", "")
81
+ .replace(":", "")
82
+ .replace("\\", "")
83
+ )
84
+ caminho_arquivo = f"{diretorio_destino}/{titulo_novo1}.m4a"
85
+ yt.streams.get_audio_only().download(output_path=diretorio_destino)
86
+ sound = AudioSegment.from_file(caminho_arquivo, format="m4a")
87
+ sound.export(f"{diretorio_destino}/{titulo_novo1}.mp3", format="mp3")
88
+
89
+ def video(url,diretorio_destino):
90
+ yt = YouTube(url, use_oauth=True, allow_oauth_cache=True)
91
+ yt.streams.get_highest_resolution().download(output_path=diretorio_destino)