PandaAPI 1.0.8__tar.gz → 1.0.10__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: PandaAPI
3
- Version: 1.0.8
3
+ Version: 1.0.10
4
4
  Summary: Python utility hub by @ll_PANDA_BBY_ll
5
5
  Author: PANDA
6
6
  Author-email:
@@ -53,14 +53,23 @@ print(mail["email"])
53
53
  inbox = api.temp_mail_inbox(mail["sid_token"])
54
54
  if inbox["emails"]:
55
55
  msg = api.temp_mail_read(mail["sid_token"], inbox["emails"][0]["id"])
56
- print(msg["otp_codes"]) # extracted OTP codes
57
- print(msg["verify_links"]) # extracted verification links
56
+ print(msg["otp_codes"]) # extracted OTP codes
57
+ print(msg["verify_links"]) # extracted verification links
58
58
 
59
59
  # Fake Identity
60
- print(api.fake_identity("IN")) # Indian fake identity
60
+ print(api.fake_identity("IN")) # Indian fake identity
61
61
 
62
- # Lyrics
63
- print(api.lyrics("Kesariya", "Arijit Singh"))
62
+ # Media — YouTube
63
+ results = api.yt_search("Kesariya Arijit Singh")
64
+ print(results[0]["title"])
65
+ print(results[0]["url"])
66
+ print(api.yt_thumb(results[0]["id"]))
67
+
68
+ # Media — Lyrics (synced timestamps supported)
69
+ song = api.lyrics("Arijit Singh", "Tum Hi Ho")
70
+ print(song["lyrics"])
71
+ print(song["synced"]) # True = has [mm:ss] timestamps
72
+ print(song["source"]) # lyrics.ovh or lrclib.net
64
73
 
65
74
  # AI
66
75
  print(api.gemini("Hello!"))
@@ -74,11 +83,11 @@ print(api.chatgpt("Explain black holes"))
74
83
  | `tools` | `password`, `morse_encode`, `morse_decode`, `github`, `pypi`, `hashtag`, `chatbot`, `meme`, `unsplash`, `imdb`, `leetcode`, `bhagwatgita` |
75
84
  | `ai` | `gemini`, `chatgpt`, `blackbox` |
76
85
  | `telegram` | `tg_bot_info`, `tg_user` |
77
- | `media` | `yt_search`, `yt_thumb` |
86
+ | `media` | `yt_search`, `yt_thumb`, `lyrics` |
78
87
  | `osint` | `ip_lookup`, `phone_lookup`, `email_verify`, `username_search`, `breach_check`, `whois`, `dns_lookup`, `ssl_info`, `exif_read` |
79
88
  | `crypto` | `b64_encode`, `b64_decode`, `md5`, `sha256`, `sha512`, `rot13`, `caesar`, `xor_encrypt`, `xor_decrypt`, `jwt_decode` |
80
89
  | `network` | `ping`, `port_scan`, `headers`, `ssl_check`, `torcheck`, `reverse_ip`, `subdomain_scan` |
81
- | `dark` | `fake_identity`, `temp_mail_create`, `temp_mail_inbox`, `temp_mail_read`, `dark_joke`, `lyrics` |
90
+ | `dark` | `fake_identity`, `temp_mail_create`, `temp_mail_inbox`, `temp_mail_read`, `dark_joke` |
82
91
 
83
92
  ## License
84
93
 
@@ -52,6 +52,9 @@ class PandaAPI:
52
52
  def bhagwatgita(self, chapter: int, shalok: int = 1) -> dict:
53
53
  return tools.bhagwatgita(chapter, shalok)
54
54
 
55
+ def image_generate(self, prompt: str, width: int = 1024, height: int = 1024, model: str = "flux") -> dict:
56
+ return tools.image_generate(prompt, width, height, model)
57
+
55
58
  # ── AI ───────────────────────────────────────────────
56
59
  def gemini(self, prompt: str) -> dict:
57
60
  return ai.gemini(prompt)
@@ -76,6 +79,9 @@ class PandaAPI:
76
79
  def yt_thumb(self, video_id: str) -> str:
77
80
  return media.yt_thumb(video_id)
78
81
 
82
+ def lyrics(self, artist: str, title: str) -> dict:
83
+ return media.lyrics(artist, title)
84
+
79
85
  # ── OSINT ────────────────────────────────────────────
80
86
  def ip_lookup(self, ip: str) -> dict:
81
87
  return osint.ip_lookup(ip)
@@ -173,9 +179,5 @@ class PandaAPI:
173
179
  def dark_joke(self) -> dict:
174
180
  return dark.dark_joke()
175
181
 
176
- def lyrics(self, song: str, artist: str = "") -> dict:
177
- return dark.lyrics(song, artist)
178
-
179
182
 
180
183
  api = PandaAPI()
181
- from .modules.media import lyrics
@@ -105,80 +105,3 @@ def dark_joke() -> dict:
105
105
  return {"success": False, "error": str(e)}
106
106
 
107
107
 
108
- def lyrics(song: str, artist: str = "") -> dict:
109
- try:
110
- query = f"{artist} {song}".strip()
111
- headers = {
112
- "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
113
- }
114
-
115
- # Method 1: lyrics.ovh (English songs)
116
- if artist:
117
- r = requests.get(
118
- f"https://api.lyrics.ovh/v1/{requests.utils.quote(artist)}/{requests.utils.quote(song)}",
119
- timeout=10,
120
- )
121
- if r.status_code == 200:
122
- lyr = r.json().get("lyrics", "")
123
- if lyr:
124
- return {"song": song, "artist": artist, "lyrics": lyr, "source": "lyrics.ovh", "success": True}
125
-
126
- # Method 2: Genius search scrape
127
- search_r = requests.get(
128
- f"https://api.genius.com/search?q={requests.utils.quote(query)}",
129
- headers={**headers, "Authorization": "Bearer alXE5K2_D2ZJVMWKW7pWAbsOaOFWlEAzHmDNJY3CyGRTMh5z3HKFqSBJaWrHK2T9"},
130
- timeout=10,
131
- )
132
- if search_r.status_code == 200:
133
- hits = search_r.json().get("response", {}).get("hits", [])
134
- if hits:
135
- top = hits[0]["result"]
136
- song_title = top.get("title", song)
137
- artist_name = top.get("primary_artist", {}).get("name", artist)
138
- song_url = top.get("url", "")
139
- # scrape lyrics from genius page
140
- page = requests.get(song_url, headers=headers, timeout=10)
141
- from bs4 import BeautifulSoup
142
- soup = BeautifulSoup(page.text, "html.parser")
143
- # remove scripts
144
- for s in soup.find_all("script"):
145
- s.decompose()
146
- containers = soup.find_all("div", attrs={"data-lyrics-container": "true"})
147
- if containers:
148
- lyr_parts = []
149
- for c in containers:
150
- for br in c.find_all("br"):
151
- br.replace_with("\n")
152
- lyr_parts.append(c.get_text())
153
- lyr = "\n".join(lyr_parts).strip()
154
- return {
155
- "song": song_title,
156
- "artist": artist_name,
157
- "lyrics": lyr,
158
- "genius_url": song_url,
159
- "source": "genius",
160
- "success": True,
161
- }
162
-
163
- # Method 3: lyrics.ovh suggest fallback
164
- rs = requests.get(
165
- f"https://api.lyrics.ovh/suggest/{requests.utils.quote(query)}",
166
- timeout=10,
167
- ).json()
168
- results = rs.get("data", [])
169
- if results:
170
- top = results[0]
171
- artist_name = top.get("artist", {}).get("name", "")
172
- title = top.get("title", "")
173
- r2 = requests.get(
174
- f"https://api.lyrics.ovh/v1/{requests.utils.quote(artist_name)}/{requests.utils.quote(title)}",
175
- timeout=10,
176
- )
177
- if r2.status_code == 200:
178
- lyr = r2.json().get("lyrics", "")
179
- if lyr:
180
- return {"song": title, "artist": artist_name, "lyrics": lyr, "source": "lyrics.ovh", "success": True}
181
-
182
- return {"success": False, "error": "Lyrics not found — try English song name or add artist name"}
183
- except Exception as e:
184
- return {"success": False, "error": str(e)}
@@ -2,8 +2,12 @@ import requests
2
2
 
3
3
 
4
4
  def yt_search(query: str) -> list:
5
+ """
6
+ Uses yt-dlp ytsearch. Returns list of dicts with title, url, duration, channel.
7
+ """
5
8
  try:
6
9
  import yt_dlp
10
+
7
11
  ydl_opts = {
8
12
  "quiet": True,
9
13
  "skip_download": True,
@@ -24,6 +28,8 @@ def yt_search(query: str) -> list:
24
28
  ]
25
29
  except ImportError:
26
30
  return [{"error": "yt_dlp not installed", "success": False}]
31
+ except Exception as e:
32
+ return [{"error": str(e), "success": False}]
27
33
 
28
34
 
29
35
  def yt_thumb(video_id: str) -> str:
@@ -31,6 +37,12 @@ def yt_thumb(video_id: str) -> str:
31
37
 
32
38
 
33
39
  def lyrics(artist: str, title: str) -> dict:
40
+ """
41
+ Fetch lyrics for a song.
42
+ Primary: lyrics.ovh (plain text)
43
+ Fallback: lrclib.net (synced + plain)
44
+ """
45
+ # --- Primary: lyrics.ovh ---
34
46
  try:
35
47
  url = f"https://api.lyrics.ovh/v1/{artist}/{title}"
36
48
  r = requests.get(url, timeout=8)
@@ -48,6 +60,7 @@ def lyrics(artist: str, title: str) -> dict:
48
60
  except Exception:
49
61
  pass
50
62
 
63
+ # --- Fallback: lrclib.net ---
51
64
  try:
52
65
  url = "https://lrclib.net/api/get"
53
66
  params = {"artist_name": artist, "track_name": title}
@@ -75,7 +75,6 @@ def pypi(package: str) -> dict:
75
75
 
76
76
  def hashtag(keyword: str) -> dict:
77
77
  try:
78
- # using ritetag API (no auth needed for basic)
79
78
  url = f"https://ritetag.com/best-hashtags-for/{requests.utils.quote(keyword)}"
80
79
  headers = {"User-Agent": "Mozilla/5.0"}
81
80
  r = requests.get(url, headers=headers, timeout=10)
@@ -86,7 +85,6 @@ def hashtag(keyword: str) -> dict:
86
85
  if t.startswith("#"):
87
86
  tags.append(t)
88
87
  if not tags:
89
- # fallback: generate basic hashtags
90
88
  words = keyword.lower().split()
91
89
  tags = [
92
90
  f"#{keyword.replace(' ', '')}",
@@ -128,9 +126,7 @@ def unsplash(query: str) -> dict:
128
126
  try:
129
127
  url = f"https://source.unsplash.com/featured/?{requests.utils.quote(query)}"
130
128
  r = requests.get(url, timeout=10, allow_redirects=True)
131
- # unsplash source redirects to actual image
132
129
  final_url = r.url
133
- # also fetch a few via scraping picsum/unsplash search
134
130
  search_url = f"https://unsplash.com/s/photos/{requests.utils.quote(query)}"
135
131
  headers = {"User-Agent": "Mozilla/5.0"}
136
132
  rs = requests.get(search_url, headers=headers, timeout=10)
@@ -149,13 +145,39 @@ def unsplash(query: str) -> dict:
149
145
  return {"success": False, "error": str(e)}
150
146
 
151
147
 
148
+ def image_generate(prompt: str, width: int = 1024, height: int = 1024, model: str = "flux") -> dict:
149
+ """
150
+ Generate an AI image using Pollinations.ai (free, no API key needed).
151
+ Models: flux, flux-realism, flux-anime, flux-3d, turbo
152
+ Returns direct image URL + base64 bytes.
153
+ """
154
+ try:
155
+ encoded = requests.utils.quote(prompt)
156
+ url = f"https://image.pollinations.ai/prompt/{encoded}?width={width}&height={height}&model={model}&nologo=true"
157
+ r = requests.get(url, timeout=60)
158
+ if r.status_code == 200 and "image" in r.headers.get("Content-Type", ""):
159
+ import base64
160
+ b64 = base64.b64encode(r.content).decode()
161
+ return {
162
+ "prompt": prompt,
163
+ "url": url,
164
+ "model": model,
165
+ "width": width,
166
+ "height": height,
167
+ "base64": b64,
168
+ "success": True,
169
+ }
170
+ return {"success": False, "error": f"Status {r.status_code}"}
171
+ except Exception as e:
172
+ return {"success": False, "error": str(e)}
173
+
174
+
152
175
  def imdb(query: str) -> dict:
153
176
  try:
154
177
  headers = {
155
178
  "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36",
156
179
  "Accept-Language": "en-US,en;q=0.9",
157
180
  }
158
- # use OMDB-style scrape via IMDB search JSON endpoint
159
181
  search_url = f"https://v2.sg.media-imdb.com/suggestion/x/{requests.utils.quote(query)}.json"
160
182
  r = requests.get(search_url, headers=headers, timeout=10)
161
183
  data = r.json()
@@ -167,8 +189,6 @@ def imdb(query: str) -> dict:
167
189
  title = top.get("l", "")
168
190
  year = top.get("y", "")
169
191
  image = top.get("i", {}).get("imageUrl", "") if isinstance(top.get("i"), dict) else ""
170
- rank = top.get("rank", "")
171
- # fetch detail page for more info
172
192
  detail_url = f"https://www.imdb.com/title/{imdb_id}/"
173
193
  rd = requests.get(detail_url, headers=headers, timeout=10)
174
194
  soup = BeautifulSoup(rd.text, "html.parser")
@@ -243,9 +263,6 @@ def leetcode(username: str) -> dict:
243
263
 
244
264
  def bhagwatgita(chapter: int, shalok: int = 1) -> dict:
245
265
  try:
246
- # use bhagavad-gita.org API
247
- url = f"https://bhagavad-gita3.p.rapidapi.com/v2/chapters/{chapter}/verses/{shalok}/"
248
- # fallback to free API
249
266
  url = f"https://vedicscriptures.github.io/slok/{chapter}/{shalok}/"
250
267
  r = requests.get(url, timeout=10)
251
268
  data = r.json()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PandaAPI
3
- Version: 1.0.8
3
+ Version: 1.0.10
4
4
  Summary: Python utility hub by @ll_PANDA_BBY_ll
5
5
  Author: PANDA
6
6
  Author-email:
@@ -53,14 +53,23 @@ print(mail["email"])
53
53
  inbox = api.temp_mail_inbox(mail["sid_token"])
54
54
  if inbox["emails"]:
55
55
  msg = api.temp_mail_read(mail["sid_token"], inbox["emails"][0]["id"])
56
- print(msg["otp_codes"]) # extracted OTP codes
57
- print(msg["verify_links"]) # extracted verification links
56
+ print(msg["otp_codes"]) # extracted OTP codes
57
+ print(msg["verify_links"]) # extracted verification links
58
58
 
59
59
  # Fake Identity
60
- print(api.fake_identity("IN")) # Indian fake identity
60
+ print(api.fake_identity("IN")) # Indian fake identity
61
61
 
62
- # Lyrics
63
- print(api.lyrics("Kesariya", "Arijit Singh"))
62
+ # Media — YouTube
63
+ results = api.yt_search("Kesariya Arijit Singh")
64
+ print(results[0]["title"])
65
+ print(results[0]["url"])
66
+ print(api.yt_thumb(results[0]["id"]))
67
+
68
+ # Media — Lyrics (synced timestamps supported)
69
+ song = api.lyrics("Arijit Singh", "Tum Hi Ho")
70
+ print(song["lyrics"])
71
+ print(song["synced"]) # True = has [mm:ss] timestamps
72
+ print(song["source"]) # lyrics.ovh or lrclib.net
64
73
 
65
74
  # AI
66
75
  print(api.gemini("Hello!"))
@@ -74,11 +83,11 @@ print(api.chatgpt("Explain black holes"))
74
83
  | `tools` | `password`, `morse_encode`, `morse_decode`, `github`, `pypi`, `hashtag`, `chatbot`, `meme`, `unsplash`, `imdb`, `leetcode`, `bhagwatgita` |
75
84
  | `ai` | `gemini`, `chatgpt`, `blackbox` |
76
85
  | `telegram` | `tg_bot_info`, `tg_user` |
77
- | `media` | `yt_search`, `yt_thumb` |
86
+ | `media` | `yt_search`, `yt_thumb`, `lyrics` |
78
87
  | `osint` | `ip_lookup`, `phone_lookup`, `email_verify`, `username_search`, `breach_check`, `whois`, `dns_lookup`, `ssl_info`, `exif_read` |
79
88
  | `crypto` | `b64_encode`, `b64_decode`, `md5`, `sha256`, `sha512`, `rot13`, `caesar`, `xor_encrypt`, `xor_decrypt`, `jwt_decode` |
80
89
  | `network` | `ping`, `port_scan`, `headers`, `ssl_check`, `torcheck`, `reverse_ip`, `subdomain_scan` |
81
- | `dark` | `fake_identity`, `temp_mail_create`, `temp_mail_inbox`, `temp_mail_read`, `dark_joke`, `lyrics` |
90
+ | `dark` | `fake_identity`, `temp_mail_create`, `temp_mail_inbox`, `temp_mail_read`, `dark_joke` |
82
91
 
83
92
  ## License
84
93
 
@@ -33,14 +33,23 @@ print(mail["email"])
33
33
  inbox = api.temp_mail_inbox(mail["sid_token"])
34
34
  if inbox["emails"]:
35
35
  msg = api.temp_mail_read(mail["sid_token"], inbox["emails"][0]["id"])
36
- print(msg["otp_codes"]) # extracted OTP codes
37
- print(msg["verify_links"]) # extracted verification links
36
+ print(msg["otp_codes"]) # extracted OTP codes
37
+ print(msg["verify_links"]) # extracted verification links
38
38
 
39
39
  # Fake Identity
40
- print(api.fake_identity("IN")) # Indian fake identity
40
+ print(api.fake_identity("IN")) # Indian fake identity
41
41
 
42
- # Lyrics
43
- print(api.lyrics("Kesariya", "Arijit Singh"))
42
+ # Media — YouTube
43
+ results = api.yt_search("Kesariya Arijit Singh")
44
+ print(results[0]["title"])
45
+ print(results[0]["url"])
46
+ print(api.yt_thumb(results[0]["id"]))
47
+
48
+ # Media — Lyrics (synced timestamps supported)
49
+ song = api.lyrics("Arijit Singh", "Tum Hi Ho")
50
+ print(song["lyrics"])
51
+ print(song["synced"]) # True = has [mm:ss] timestamps
52
+ print(song["source"]) # lyrics.ovh or lrclib.net
44
53
 
45
54
  # AI
46
55
  print(api.gemini("Hello!"))
@@ -54,11 +63,11 @@ print(api.chatgpt("Explain black holes"))
54
63
  | `tools` | `password`, `morse_encode`, `morse_decode`, `github`, `pypi`, `hashtag`, `chatbot`, `meme`, `unsplash`, `imdb`, `leetcode`, `bhagwatgita` |
55
64
  | `ai` | `gemini`, `chatgpt`, `blackbox` |
56
65
  | `telegram` | `tg_bot_info`, `tg_user` |
57
- | `media` | `yt_search`, `yt_thumb` |
66
+ | `media` | `yt_search`, `yt_thumb`, `lyrics` |
58
67
  | `osint` | `ip_lookup`, `phone_lookup`, `email_verify`, `username_search`, `breach_check`, `whois`, `dns_lookup`, `ssl_info`, `exif_read` |
59
68
  | `crypto` | `b64_encode`, `b64_decode`, `md5`, `sha256`, `sha512`, `rot13`, `caesar`, `xor_encrypt`, `xor_decrypt`, `jwt_decode` |
60
69
  | `network` | `ping`, `port_scan`, `headers`, `ssl_check`, `torcheck`, `reverse_ip`, `subdomain_scan` |
61
- | `dark` | `fake_identity`, `temp_mail_create`, `temp_mail_inbox`, `temp_mail_read`, `dark_joke`, `lyrics` |
70
+ | `dark` | `fake_identity`, `temp_mail_create`, `temp_mail_inbox`, `temp_mail_read`, `dark_joke` |
62
71
 
63
72
  ## License
64
73
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "PandaAPI"
7
- version = "1.0.8"
7
+ version = "1.0.10"
8
8
  authors = [
9
9
  { name = "PANDA" }
10
10
  ]
File without changes
File without changes
File without changes