playrip 2.2.2__tar.gz → 2.2.4__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: playrip
3
- Version: 2.2.2
3
+ Version: 2.2.4
4
4
  Summary: Esse projeto é usado para abaixar musicas tanto no spotify e no Youtube
5
5
  Author: IyinG
6
6
  Author-email: 165347923+Blackgnr7@users.noreply.github.com
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "playrip"
3
- version = "2.2.2"
3
+ version = "2.2.4"
4
4
  description = "Esse projeto é usado para abaixar musicas tanto no spotify e no Youtube"
5
5
  authors = [
6
6
  {name = "IyinG",email = "165347923+Blackgnr7@users.noreply.github.com"}
@@ -6,14 +6,13 @@ from pytubefix import YouTube
6
6
  from bs4 import BeautifulSoup
7
7
  import requests
8
8
 
9
- diretorio_destino = os.path.expanduser("~/Downloads")
10
-
11
- def Youtube(url, formato_do_audio, thumbnail):
9
+ def Youtube(url:str, formato_do_audio:str, thumbnail:str,diretorio_destino=os.path.expanduser("~/Downloads")):
12
10
  if formato_do_audio.lower() == "mp3":
13
11
  yt = YouTube(url)
14
12
  artist = yt.author
15
13
  titulo = yt.title
16
14
  print(f"titulo do video do Youtube: {titulo}")
15
+ print(f"diretorio escolhido foi: {diretorio_destino}\n")
17
16
  titulo_novo1 = (
18
17
  titulo.replace("/", "")
19
18
  .replace("|", "")
@@ -41,7 +40,8 @@ def Youtube(url, formato_do_audio, thumbnail):
41
40
  yt = YouTube(url)
42
41
  artist = yt.author
43
42
  titulo = yt.title
44
- print(f"titulo do video do Youtube: {titulo}\n")
43
+ print(f"titulo do video do Youtube: {titulo}")
44
+ print(f"diretorio escolhido foi: {diretorio_destino}\n")
45
45
  titulo_novo1 = (
46
46
  titulo.replace("/", "")
47
47
  .replace("|", "")
@@ -65,7 +65,7 @@ def Youtube(url, formato_do_audio, thumbnail):
65
65
  os.remove(f"{diretorio_destino}/capa.jpg")
66
66
 
67
67
 
68
- def Spotify(url, thumbnail):
68
+ def Spotify(url:str, thumbnail:str, diretorio_destino=os.path.expanduser("~/Downloads")):
69
69
  headers = {"User-Agent": "Mozilla/5.0"}
70
70
  res = requests.get(url, headers=headers)
71
71
  soup = BeautifulSoup(res.text, "html.parser")
@@ -74,7 +74,6 @@ def Spotify(url, thumbnail):
74
74
  artista = soup.find("meta", property="og:description")["content"].split(" · ")[0]
75
75
  if ", " in artista:
76
76
  artista = artista.split(", ")[0]
77
- print(artista)
78
77
  Novo_titulo_spotify = (
79
78
  titulo_spotify.replace("/", "")
80
79
  .replace("|", "")
@@ -87,7 +86,8 @@ def Spotify(url, thumbnail):
87
86
  )
88
87
  if f" - Single by {artista} Spotify" in Novo_titulo_spotify:
89
88
  Novo_titulo_spotify = Novo_titulo_spotify.replace(f" - Single by {artista} Spotify", "")
90
- print(f"titulo da musica do spotify: {titulo_spotify}\n")
89
+ print(f"titulo da musica do spotify: {titulo_spotify}")
90
+ print(f"diretorio escolhido foi: {diretorio_destino}\n")
91
91
  get.audio(artista=artista, titulo_da_musica=Novo_titulo_spotify, diretorio_destino=diretorio_destino)
92
92
  audiofile = eyed3.load(f"{diretorio_destino}/{Novo_titulo_spotify}.mp3")
93
93
  if not audiofile.tag:
@@ -0,0 +1,46 @@
1
+ from playrip import Dowload
2
+ import sys
3
+ import os
4
+
5
+ directorio = os.path.expanduser("~/Downloads")
6
+
7
+ def main():
8
+ url = sys.argv[1]
9
+ if("youtu" in url):
10
+ print("\n------Abaixando video do Youtube------")
11
+ if(len(sys.argv) > 2):
12
+ tipo = sys.argv[2]
13
+ try:
14
+ directorio = sys.argv[3]
15
+ except IndexError:
16
+ pass
17
+ if("~" in directorio):
18
+ Dowload.Youtube(url=url, formato_do_audio=tipo, thumbnail=True, diretorio_destino=os.path.expanduser(directorio))
19
+ else:
20
+ if(os.path.isdir(directorio)):
21
+ Dowload.Youtube(url=url, formato_do_audio=tipo, thumbnail=True, diretorio_destino=directorio)
22
+ else:
23
+ print("\npasta não achada")
24
+ return
25
+ elif("spotify" in url):
26
+ print("\n------Abaixando musica do spotify------")
27
+ try:
28
+ directorio = sys.argv[2]
29
+ except IndexError:
30
+ pass
31
+ if("~" in directorio):
32
+ directorio = os.path.expanduser(directorio)
33
+ if(not os.path.exists(directorio)):
34
+ print("pasta não achada")
35
+ return
36
+ else:
37
+ Dowload.Spotify(url=url,thumbnail=True, diretorio_destino=os.path.expanduser(directorio))
38
+ else:
39
+ if(os.path.isdir(directorio)):
40
+ Dowload.Spotify(url=url,thumbnail=True, diretorio_destino=directorio)
41
+ else:
42
+ print("pasta não achada")
43
+ return
44
+ else:
45
+ print("\npf coloque um link no spotify ou youtube\n")
46
+ return
@@ -1,18 +0,0 @@
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
- return
12
- elif("spotify" in url):
13
- print("\n------Abaixando musica do spotify------")
14
- Dowload.Spotify(url=url, thumbnail=True)
15
- return
16
- else:
17
- print("\npf coloque um link no spotify ou youtube")
18
- return
File without changes
File without changes
File without changes