PandaAPI 1.0.0__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.
- pandaapi-1.0.0/PKG-INFO +69 -0
- pandaapi-1.0.0/PandaAPI/__init__.py +80 -0
- pandaapi-1.0.0/PandaAPI/func.py +18 -0
- pandaapi-1.0.0/PandaAPI/modules/__init__.py +1 -0
- pandaapi-1.0.0/PandaAPI/modules/ai.py +59 -0
- pandaapi-1.0.0/PandaAPI/modules/media.py +35 -0
- pandaapi-1.0.0/PandaAPI/modules/telegram.py +23 -0
- pandaapi-1.0.0/PandaAPI/modules/tools.py +248 -0
- pandaapi-1.0.0/PandaAPI.egg-info/PKG-INFO +69 -0
- pandaapi-1.0.0/PandaAPI.egg-info/SOURCES.txt +15 -0
- pandaapi-1.0.0/PandaAPI.egg-info/dependency_links.txt +1 -0
- pandaapi-1.0.0/PandaAPI.egg-info/requires.txt +5 -0
- pandaapi-1.0.0/PandaAPI.egg-info/top_level.txt +2 -0
- pandaapi-1.0.0/README.md +51 -0
- pandaapi-1.0.0/pyproject.toml +29 -0
- pandaapi-1.0.0/setup.cfg +4 -0
- pandaapi-1.0.0/setup.py +43 -0
pandaapi-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: PandaAPI
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Python utility hub by @ll_PANDA_BBY_ll
|
|
5
|
+
Author: PANDA
|
|
6
|
+
Author-email:
|
|
7
|
+
License: MIT
|
|
8
|
+
Keywords: python,PandaAPI,telegram,bot
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.8
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
Requires-Dist: requests
|
|
14
|
+
Requires-Dist: beautifulsoup4
|
|
15
|
+
Provides-Extra: media
|
|
16
|
+
Requires-Dist: yt-dlp; extra == "media"
|
|
17
|
+
Dynamic: requires-python
|
|
18
|
+
|
|
19
|
+
# PandaAPI
|
|
20
|
+
|
|
21
|
+
**PandaAPI** — Python utility hub by [@ll_PANDA_BBY_ll](https://t.me/ll_PANDA_BBY_ll)
|
|
22
|
+
|
|
23
|
+
## Install
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pip install PandaAPI
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
With media support (yt-dlp):
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pip install PandaAPI[media]
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Usage
|
|
36
|
+
|
|
37
|
+
```python
|
|
38
|
+
from PandaAPI import api
|
|
39
|
+
|
|
40
|
+
# Password generator
|
|
41
|
+
print(api.password(16))
|
|
42
|
+
|
|
43
|
+
# GitHub user info
|
|
44
|
+
print(api.github("nikhil390u8o"))
|
|
45
|
+
|
|
46
|
+
# AI
|
|
47
|
+
print(api.gemini("Hello!"))
|
|
48
|
+
print(api.chatgpt("Explain black holes"))
|
|
49
|
+
|
|
50
|
+
# YouTube
|
|
51
|
+
results = api.yt_search("lofi chill beats")
|
|
52
|
+
print(results)
|
|
53
|
+
|
|
54
|
+
# Telegram bot info
|
|
55
|
+
print(api.tg_bot_info("YOUR_BOT_TOKEN"))
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Modules
|
|
59
|
+
|
|
60
|
+
| Module | Functions |
|
|
61
|
+
|--------|-----------|
|
|
62
|
+
| `tools` | `password`, `morse_encode`, `morse_decode`, `github`, `pypi`, `hashtag`, `chatbot`, `meme`, `unsplash`, `imdb`, `leetcode`, `bhagwatgita` |
|
|
63
|
+
| `ai` | `gemini`, `chatgpt`, `blackbox` |
|
|
64
|
+
| `telegram` | `tg_bot_info`, `tg_user` |
|
|
65
|
+
| `media` | `yt_search`, `yt_thumb` |
|
|
66
|
+
|
|
67
|
+
## License
|
|
68
|
+
|
|
69
|
+
MIT
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import random
|
|
2
|
+
import string
|
|
3
|
+
import requests
|
|
4
|
+
from .modules import telegram, media, tools, ai
|
|
5
|
+
|
|
6
|
+
__version__ = "1.0.0"
|
|
7
|
+
__all__ = ["PandaAPI"]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class PandaAPI:
|
|
11
|
+
"""
|
|
12
|
+
PandaAPI — Python utility hub by @ll_PANDA_BBY_ll
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
def __init__(self) -> None:
|
|
16
|
+
pass
|
|
17
|
+
|
|
18
|
+
# ── Tools ────────────────────────────────────
|
|
19
|
+
def password(self, length: int = 12) -> str:
|
|
20
|
+
return tools.password(length)
|
|
21
|
+
|
|
22
|
+
def morse_encode(self, text: str) -> dict:
|
|
23
|
+
return tools.morse_encode(text)
|
|
24
|
+
|
|
25
|
+
def morse_decode(self, code: str) -> dict:
|
|
26
|
+
return tools.morse_decode(code)
|
|
27
|
+
|
|
28
|
+
def github(self, username: str) -> dict:
|
|
29
|
+
return tools.github(username)
|
|
30
|
+
|
|
31
|
+
def pypi(self, package: str) -> dict:
|
|
32
|
+
return tools.pypi(package)
|
|
33
|
+
|
|
34
|
+
def hashtag(self, keyword: str) -> dict:
|
|
35
|
+
return tools.hashtag(keyword)
|
|
36
|
+
|
|
37
|
+
def chatbot(self, text: str) -> dict:
|
|
38
|
+
return tools.chatbot(text)
|
|
39
|
+
|
|
40
|
+
def meme(self) -> dict:
|
|
41
|
+
return tools.meme()
|
|
42
|
+
|
|
43
|
+
def unsplash(self, query: str) -> dict:
|
|
44
|
+
return tools.unsplash(query)
|
|
45
|
+
|
|
46
|
+
def imdb(self, query: str) -> dict:
|
|
47
|
+
return tools.imdb(query)
|
|
48
|
+
|
|
49
|
+
def leetcode(self, username: str) -> dict:
|
|
50
|
+
return tools.leetcode(username)
|
|
51
|
+
|
|
52
|
+
def bhagwatgita(self, chapter: int, shalok: int = 1) -> dict:
|
|
53
|
+
return tools.bhagwatgita(chapter, shalok)
|
|
54
|
+
|
|
55
|
+
# ── AI ───────────────────────────────────────
|
|
56
|
+
def gemini(self, prompt: str) -> dict:
|
|
57
|
+
return ai.gemini(prompt)
|
|
58
|
+
|
|
59
|
+
def chatgpt(self, prompt: str) -> dict:
|
|
60
|
+
return ai.chatgpt(prompt)
|
|
61
|
+
|
|
62
|
+
def blackbox(self, prompt: str) -> dict:
|
|
63
|
+
return ai.blackbox(prompt)
|
|
64
|
+
|
|
65
|
+
# ── Telegram ─────────────────────────────────
|
|
66
|
+
def tg_bot_info(self, bot_token: str) -> dict:
|
|
67
|
+
return telegram.get_bot_info(bot_token)
|
|
68
|
+
|
|
69
|
+
def tg_user(self, user_id: int, bot_token: str) -> dict:
|
|
70
|
+
return telegram.get_user(user_id, bot_token)
|
|
71
|
+
|
|
72
|
+
# ── Media ────────────────────────────────────
|
|
73
|
+
def yt_search(self, query: str) -> list:
|
|
74
|
+
return media.yt_search(query)
|
|
75
|
+
|
|
76
|
+
def yt_thumb(self, video_id: str) -> str:
|
|
77
|
+
return media.yt_thumb(video_id)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
api = PandaAPI()
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
MORSE_CODE_DICT = {
|
|
2
|
+
"A": ".-", "B": "-...", "C": "-.-.", "D": "-..",
|
|
3
|
+
"E": ".", "F": "..-.", "G": "--.", "H": "....",
|
|
4
|
+
"I": "..", "J": ".---", "K": "-.-", "L": ".-..",
|
|
5
|
+
"M": "--", "N": "-.", "O": "---", "P": ".--.",
|
|
6
|
+
"Q": "--.-", "R": ".-.", "S": "...", "T": "-",
|
|
7
|
+
"U": "..-", "V": "...-", "W": ".--", "X": "-..-",
|
|
8
|
+
"Y": "-.--", "Z": "--..",
|
|
9
|
+
"1": ".----", "2": "..---", "3": "...--", "4": "....-",
|
|
10
|
+
"5": ".....", "6": "-....", "7": "--...", "8": "---..",
|
|
11
|
+
"9": "----.", "0": "-----",
|
|
12
|
+
",": "--..--","." : ".-.-.-","?" : "..--..",
|
|
13
|
+
"'" : ".----.","/": "-..-.", "(": "-.--.", ")": "-.--.-",
|
|
14
|
+
"&": ".-...", ":": "---...", ";": "-.-.-.",
|
|
15
|
+
"=": "-...-", "+": ".-.-.", "-": "-....-",
|
|
16
|
+
"_": "..__.-", '"': ".-..-.", "$": "...-..-",
|
|
17
|
+
"!": "-.-.--", "@": ".--.-.",
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from . import telegram, media, tools, ai
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
import json
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def gemini(prompt: str) -> dict:
|
|
6
|
+
url = (
|
|
7
|
+
"https://generativelanguage.googleapis.com/v1beta/models/"
|
|
8
|
+
"gemini-pro:generateContent"
|
|
9
|
+
"?key=AIzaSyBQaoUF-KWjPV_4ABtSN0DQ0RPkNeCh4tM"
|
|
10
|
+
)
|
|
11
|
+
payload = {"contents": [{"parts": [{"text": prompt}]}]}
|
|
12
|
+
try:
|
|
13
|
+
r = requests.post(url, headers={"Content-Type": "application/json"},
|
|
14
|
+
data=json.dumps(payload))
|
|
15
|
+
if r.status_code == 200:
|
|
16
|
+
text = r.json()["candidates"][0]["content"]["parts"][0]["text"]
|
|
17
|
+
return {"result": text, "success": True}
|
|
18
|
+
return {"success": False, "error": r.text}
|
|
19
|
+
except Exception as e:
|
|
20
|
+
return {"success": False, "error": str(e)}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def chatgpt(prompt: str) -> dict:
|
|
24
|
+
"""Uses free exh.ai endpoint (same as BadAPI)."""
|
|
25
|
+
try:
|
|
26
|
+
url = "https://api.exh.ai/chatbot/v1/get_response"
|
|
27
|
+
headers = {
|
|
28
|
+
"Authorization": (
|
|
29
|
+
"Bearer eyJhbGciOiJIUzUxMiJ9"
|
|
30
|
+
".eyJ1c2VybmFtZSI6ImJvdGlmeS13ZWItdjMifQ"
|
|
31
|
+
".O-w89I5aX2OE_i4k6jdHZJEDWECSUfOb1lr9UdVH4oT"
|
|
32
|
+
"PMkFGUNm9BNzoQjcXOu8NEiIXq64-481hnenHdUrXfg"
|
|
33
|
+
),
|
|
34
|
+
"Content-Type": "application/json",
|
|
35
|
+
}
|
|
36
|
+
payload = {
|
|
37
|
+
"messages": [{"role": "user", "content": prompt}],
|
|
38
|
+
"model": "gpt-3.5-turbo",
|
|
39
|
+
}
|
|
40
|
+
r = requests.post(url, headers=headers, data=json.dumps(payload))
|
|
41
|
+
return {"result": r.json().get("response", ""), "success": True}
|
|
42
|
+
except Exception as e:
|
|
43
|
+
return {"success": False, "error": str(e)}
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def blackbox(prompt: str) -> dict:
|
|
47
|
+
try:
|
|
48
|
+
url = "https://www.blackbox.ai/api/chat"
|
|
49
|
+
headers = {"Content-Type": "application/json"}
|
|
50
|
+
payload = {
|
|
51
|
+
"messages": [{"role": "user", "content": prompt}],
|
|
52
|
+
"agentMode": {},
|
|
53
|
+
"trendingAgentMode": {},
|
|
54
|
+
"isMicMode": False,
|
|
55
|
+
}
|
|
56
|
+
r = requests.post(url, headers=headers, json=payload)
|
|
57
|
+
return {"result": r.text, "success": True}
|
|
58
|
+
except Exception as e:
|
|
59
|
+
return {"success": False, "error": str(e)}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def yt_search(query: str) -> list:
|
|
5
|
+
"""
|
|
6
|
+
Uses yt-dlp's ytsearch via a simple scrape-free approach.
|
|
7
|
+
Returns list of dicts with title, url, duration, channel.
|
|
8
|
+
"""
|
|
9
|
+
try:
|
|
10
|
+
import yt_dlp
|
|
11
|
+
|
|
12
|
+
ydl_opts = {
|
|
13
|
+
"quiet": True,
|
|
14
|
+
"skip_download": True,
|
|
15
|
+
"extract_flat": True,
|
|
16
|
+
}
|
|
17
|
+
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
|
18
|
+
info = ydl.extract_info(f"ytsearch5:{query}", download=False)
|
|
19
|
+
entries = info.get("entries", [])
|
|
20
|
+
return [
|
|
21
|
+
{
|
|
22
|
+
"title": e.get("title"),
|
|
23
|
+
"url": f"https://youtube.com/watch?v={e.get('id')}",
|
|
24
|
+
"duration": e.get("duration"),
|
|
25
|
+
"channel": e.get("channel"),
|
|
26
|
+
"id": e.get("id"),
|
|
27
|
+
}
|
|
28
|
+
for e in entries
|
|
29
|
+
]
|
|
30
|
+
except ImportError:
|
|
31
|
+
return [{"error": "yt_dlp not installed", "success": False}]
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def yt_thumb(video_id: str) -> str:
|
|
35
|
+
return f"https://img.youtube.com/vi/{video_id}/maxresdefault.jpg"
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
|
|
3
|
+
BASE = "https://api.telegram.org/bot{token}/{method}"
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def _call(token: str, method: str, **params) -> dict:
|
|
7
|
+
url = BASE.format(token=token, method=method)
|
|
8
|
+
r = requests.get(url, params=params)
|
|
9
|
+
return r.json()
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def get_bot_info(token: str) -> dict:
|
|
13
|
+
r = _call(token, "getMe")
|
|
14
|
+
if r.get("ok"):
|
|
15
|
+
return {"result": r["result"], "success": True}
|
|
16
|
+
return {"error": r.get("description"), "success": False}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def get_user(user_id: int, token: str) -> dict:
|
|
20
|
+
r = _call(token, "getChat", chat_id=user_id)
|
|
21
|
+
if r.get("ok"):
|
|
22
|
+
return {"result": r["result"], "success": True}
|
|
23
|
+
return {"error": r.get("description"), "success": False}
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import random
|
|
2
|
+
import string
|
|
3
|
+
import re
|
|
4
|
+
import requests
|
|
5
|
+
from bs4 import BeautifulSoup
|
|
6
|
+
from requests_html import HTMLSession
|
|
7
|
+
from ..func import MORSE_CODE_DICT
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def password(length: int = 12) -> str:
|
|
11
|
+
chars = string.ascii_letters + string.punctuation + string.digits
|
|
12
|
+
return "".join(random.sample(chars, length))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def morse_encode(text: str) -> dict:
|
|
16
|
+
cipher = ""
|
|
17
|
+
for ch in text.upper():
|
|
18
|
+
if ch == " ":
|
|
19
|
+
cipher += " "
|
|
20
|
+
elif ch in MORSE_CODE_DICT:
|
|
21
|
+
cipher += MORSE_CODE_DICT[ch] + " "
|
|
22
|
+
return {"input": text, "result": cipher.strip(), "success": True}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def morse_decode(code: str) -> dict:
|
|
26
|
+
code += " "
|
|
27
|
+
decipher = ""
|
|
28
|
+
citext = ""
|
|
29
|
+
i = 0
|
|
30
|
+
for ch in code:
|
|
31
|
+
if ch != " ":
|
|
32
|
+
i = 0
|
|
33
|
+
citext += ch
|
|
34
|
+
else:
|
|
35
|
+
i += 1
|
|
36
|
+
if i == 2:
|
|
37
|
+
decipher += " "
|
|
38
|
+
else:
|
|
39
|
+
key = next(
|
|
40
|
+
(k for k, v in MORSE_CODE_DICT.items() if v == citext), "?"
|
|
41
|
+
)
|
|
42
|
+
decipher += key
|
|
43
|
+
citext = ""
|
|
44
|
+
return {"input": code.strip(), "result": decipher, "success": True}
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def github(username: str) -> dict:
|
|
48
|
+
r = requests.get(f"https://api.github.com/users/{username}").json()
|
|
49
|
+
return {
|
|
50
|
+
"name": r.get("name"),
|
|
51
|
+
"username": r.get("login"),
|
|
52
|
+
"id": r.get("id"),
|
|
53
|
+
"bio": r.get("bio"),
|
|
54
|
+
"location": r.get("location"),
|
|
55
|
+
"repos": r.get("public_repos"),
|
|
56
|
+
"followers": r.get("followers"),
|
|
57
|
+
"following": r.get("following"),
|
|
58
|
+
"avatar": r.get("avatar_url"),
|
|
59
|
+
"url": r.get("html_url"),
|
|
60
|
+
"success": True,
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def pypi(package: str) -> dict:
|
|
65
|
+
r = requests.get(f"https://pypi.org/pypi/{package}/json").json()
|
|
66
|
+
info = r.get("info", {})
|
|
67
|
+
return {
|
|
68
|
+
"name": info.get("name"),
|
|
69
|
+
"version": info.get("version"),
|
|
70
|
+
"summary": info.get("summary"),
|
|
71
|
+
"author": info.get("author"),
|
|
72
|
+
"license": info.get("license"),
|
|
73
|
+
"home_page": info.get("home_page"),
|
|
74
|
+
"success": True,
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def hashtag(keyword: str) -> dict:
|
|
79
|
+
url = "https://all-hashtag.com/library/contents/ajax_generator.php"
|
|
80
|
+
data = {"keyword": keyword, "filter": "top"}
|
|
81
|
+
response = requests.post(url, data=data).text
|
|
82
|
+
soup = BeautifulSoup(response, "html.parser")
|
|
83
|
+
div = soup.find("div", {"class": "copy-hashtags"})
|
|
84
|
+
if not div:
|
|
85
|
+
return {"success": False, "error": "No hashtags found"}
|
|
86
|
+
tags = div.string.split()
|
|
87
|
+
return {"input": keyword, "results": tags, "success": True}
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def chatbot(text: str) -> dict:
|
|
91
|
+
try:
|
|
92
|
+
url = (
|
|
93
|
+
"https://fallenxbot.vercel.app/api"
|
|
94
|
+
f"?apikey=593560829-fallen-usbk33kbsu"
|
|
95
|
+
f"&group-controller/mukesh/message={text}"
|
|
96
|
+
)
|
|
97
|
+
r = requests.get(url).json()
|
|
98
|
+
return {"result": r.get("reply", ""), "success": True}
|
|
99
|
+
except Exception as e:
|
|
100
|
+
return {"success": False, "error": str(e)}
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def meme() -> dict:
|
|
104
|
+
try:
|
|
105
|
+
r = requests.get("https://meme-api.com/gimme").json()
|
|
106
|
+
return {
|
|
107
|
+
"title": r.get("title"),
|
|
108
|
+
"url": r.get("url"),
|
|
109
|
+
"subreddit": r.get("subreddit"),
|
|
110
|
+
"author": r.get("author"),
|
|
111
|
+
"success": True,
|
|
112
|
+
}
|
|
113
|
+
except Exception as e:
|
|
114
|
+
return {"success": False, "error": str(e)}
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
def unsplash(query: str) -> dict:
|
|
118
|
+
url = (
|
|
119
|
+
f"https://www.istockphoto.com/search/2/image"
|
|
120
|
+
f"?alloweduse=availableforalluses&phrase={query}&sort=best"
|
|
121
|
+
)
|
|
122
|
+
headers = {
|
|
123
|
+
"User-Agent": (
|
|
124
|
+
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
|
|
125
|
+
"AppleWebKit/537.36 (KHTML, like Gecko) "
|
|
126
|
+
"Chrome/121.0.0.0 Safari/537.36"
|
|
127
|
+
),
|
|
128
|
+
"Accept-Language": "en-US,en;q=0.9",
|
|
129
|
+
"Referer": "https://unsplash.com/",
|
|
130
|
+
}
|
|
131
|
+
r = requests.get(url, headers=headers)
|
|
132
|
+
if r.status_code != 200:
|
|
133
|
+
return {"success": False, "error": f"Status {r.status_code}"}
|
|
134
|
+
soup = BeautifulSoup(r.content, "html.parser")
|
|
135
|
+
imgs = [
|
|
136
|
+
img["src"]
|
|
137
|
+
for img in soup.find_all("img")
|
|
138
|
+
if img.get("src", "").startswith("https://media.istockphoto.com")
|
|
139
|
+
]
|
|
140
|
+
return {"results": imgs, "success": True}
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def imdb(query: str) -> dict:
|
|
144
|
+
try:
|
|
145
|
+
session = HTMLSession()
|
|
146
|
+
r = session.get(f"https://www.imdb.com/find?q={query}")
|
|
147
|
+
results = r.html.xpath(
|
|
148
|
+
"//section[@data-testid='find-results-section-title']/div/ul/li"
|
|
149
|
+
)
|
|
150
|
+
if not results:
|
|
151
|
+
return {"success": False, "error": "No results"}
|
|
152
|
+
first_url = results[0].find("a")[0].attrs["href"]
|
|
153
|
+
headers = {
|
|
154
|
+
"User-Agent": (
|
|
155
|
+
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
|
|
156
|
+
"AppleWebKit/537.36"
|
|
157
|
+
)
|
|
158
|
+
}
|
|
159
|
+
page = requests.get(f"https://www.imdb.com/{first_url}", headers=headers)
|
|
160
|
+
soup = BeautifulSoup(page.text, "html.parser")
|
|
161
|
+
import json as _json
|
|
162
|
+
ld = _json.loads(soup.find("script", type="application/ld+json").string)
|
|
163
|
+
return {
|
|
164
|
+
"name": soup.title.text.strip(),
|
|
165
|
+
"url": ld.get("url"),
|
|
166
|
+
"image": ld.get("image"),
|
|
167
|
+
"description": ld.get("description"),
|
|
168
|
+
"genre": ld.get("genre"),
|
|
169
|
+
"actors": [a["name"] for a in ld.get("actor", [])],
|
|
170
|
+
"review": ld.get("review", {}).get("reviewBody"),
|
|
171
|
+
"rating": ld.get("review", {}).get("reviewRating", {}).get("ratingValue"),
|
|
172
|
+
"trailer": ld.get("trailer"),
|
|
173
|
+
"success": True,
|
|
174
|
+
}
|
|
175
|
+
except Exception as e:
|
|
176
|
+
return {"success": False, "error": str(e)}
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
def leetcode(username: str) -> dict:
|
|
180
|
+
url = "https://leetcode.com/graphql/"
|
|
181
|
+
q1 = {
|
|
182
|
+
"operationName": "userProfileCalendar",
|
|
183
|
+
"query": """
|
|
184
|
+
query userProfileCalendar($username: String!, $year: Int) {
|
|
185
|
+
matchedUser(username: $username) {
|
|
186
|
+
userCalendar(year: $year) {
|
|
187
|
+
streak
|
|
188
|
+
totalActiveDays
|
|
189
|
+
activeYears
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}""",
|
|
193
|
+
"variables": {"username": username, "year": 2024},
|
|
194
|
+
}
|
|
195
|
+
q2 = {
|
|
196
|
+
"operationName": "userPublicProfile",
|
|
197
|
+
"query": """
|
|
198
|
+
query userPublicProfile($username: String!) {
|
|
199
|
+
matchedUser(username: $username) {
|
|
200
|
+
username
|
|
201
|
+
githubUrl
|
|
202
|
+
twitterUrl
|
|
203
|
+
linkedinUrl
|
|
204
|
+
profile {
|
|
205
|
+
ranking
|
|
206
|
+
userAvatar
|
|
207
|
+
realName
|
|
208
|
+
countryName
|
|
209
|
+
company
|
|
210
|
+
jobTitle
|
|
211
|
+
skillTags
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}""",
|
|
215
|
+
"variables": {"username": username},
|
|
216
|
+
}
|
|
217
|
+
try:
|
|
218
|
+
r1 = requests.post(url, json=q1).json()
|
|
219
|
+
r2 = requests.post(url, json=q2).json()
|
|
220
|
+
d1 = r1["data"]["matchedUser"]
|
|
221
|
+
d2 = r2["data"]["matchedUser"]
|
|
222
|
+
return {**d1, **d2, "success": True}
|
|
223
|
+
except Exception as e:
|
|
224
|
+
return {"success": False, "error": str(e)}
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
def bhagwatgita(chapter: int, shalok: int = 1) -> dict:
|
|
228
|
+
try:
|
|
229
|
+
url = f"https://www.holy-bhagavad-gita.org/chapter/{chapter}/hi"
|
|
230
|
+
r = requests.get(url)
|
|
231
|
+
soup = BeautifulSoup(r.text, "html.parser")
|
|
232
|
+
intro_div = soup.find("div", class_="chapterIntro")
|
|
233
|
+
verses = soup.find_all("section", class_="listItem")
|
|
234
|
+
texts = [
|
|
235
|
+
v.text.strip()
|
|
236
|
+
.replace("View commentary »", "")
|
|
237
|
+
.replace("Bhagavad Gita ", "")
|
|
238
|
+
.strip()
|
|
239
|
+
for v in verses
|
|
240
|
+
]
|
|
241
|
+
return {
|
|
242
|
+
"chapter": chapter,
|
|
243
|
+
"chapter_intro": intro_div.text if intro_div else "",
|
|
244
|
+
"shalok": texts[shalok] if shalok < len(texts) else "",
|
|
245
|
+
"success": True,
|
|
246
|
+
}
|
|
247
|
+
except Exception as e:
|
|
248
|
+
return {"success": False, "error": str(e)}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: PandaAPI
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Python utility hub by @ll_PANDA_BBY_ll
|
|
5
|
+
Author: PANDA
|
|
6
|
+
Author-email:
|
|
7
|
+
License: MIT
|
|
8
|
+
Keywords: python,PandaAPI,telegram,bot
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.8
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
Requires-Dist: requests
|
|
14
|
+
Requires-Dist: beautifulsoup4
|
|
15
|
+
Provides-Extra: media
|
|
16
|
+
Requires-Dist: yt-dlp; extra == "media"
|
|
17
|
+
Dynamic: requires-python
|
|
18
|
+
|
|
19
|
+
# PandaAPI
|
|
20
|
+
|
|
21
|
+
**PandaAPI** — Python utility hub by [@ll_PANDA_BBY_ll](https://t.me/ll_PANDA_BBY_ll)
|
|
22
|
+
|
|
23
|
+
## Install
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pip install PandaAPI
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
With media support (yt-dlp):
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pip install PandaAPI[media]
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Usage
|
|
36
|
+
|
|
37
|
+
```python
|
|
38
|
+
from PandaAPI import api
|
|
39
|
+
|
|
40
|
+
# Password generator
|
|
41
|
+
print(api.password(16))
|
|
42
|
+
|
|
43
|
+
# GitHub user info
|
|
44
|
+
print(api.github("nikhil390u8o"))
|
|
45
|
+
|
|
46
|
+
# AI
|
|
47
|
+
print(api.gemini("Hello!"))
|
|
48
|
+
print(api.chatgpt("Explain black holes"))
|
|
49
|
+
|
|
50
|
+
# YouTube
|
|
51
|
+
results = api.yt_search("lofi chill beats")
|
|
52
|
+
print(results)
|
|
53
|
+
|
|
54
|
+
# Telegram bot info
|
|
55
|
+
print(api.tg_bot_info("YOUR_BOT_TOKEN"))
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Modules
|
|
59
|
+
|
|
60
|
+
| Module | Functions |
|
|
61
|
+
|--------|-----------|
|
|
62
|
+
| `tools` | `password`, `morse_encode`, `morse_decode`, `github`, `pypi`, `hashtag`, `chatbot`, `meme`, `unsplash`, `imdb`, `leetcode`, `bhagwatgita` |
|
|
63
|
+
| `ai` | `gemini`, `chatgpt`, `blackbox` |
|
|
64
|
+
| `telegram` | `tg_bot_info`, `tg_user` |
|
|
65
|
+
| `media` | `yt_search`, `yt_thumb` |
|
|
66
|
+
|
|
67
|
+
## License
|
|
68
|
+
|
|
69
|
+
MIT
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
setup.py
|
|
4
|
+
PandaAPI/__init__.py
|
|
5
|
+
PandaAPI/func.py
|
|
6
|
+
PandaAPI.egg-info/PKG-INFO
|
|
7
|
+
PandaAPI.egg-info/SOURCES.txt
|
|
8
|
+
PandaAPI.egg-info/dependency_links.txt
|
|
9
|
+
PandaAPI.egg-info/requires.txt
|
|
10
|
+
PandaAPI.egg-info/top_level.txt
|
|
11
|
+
PandaAPI/modules/__init__.py
|
|
12
|
+
PandaAPI/modules/ai.py
|
|
13
|
+
PandaAPI/modules/media.py
|
|
14
|
+
PandaAPI/modules/telegram.py
|
|
15
|
+
PandaAPI/modules/tools.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
pandaapi-1.0.0/README.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# PandaAPI
|
|
2
|
+
|
|
3
|
+
**PandaAPI** — Python utility hub by [@ll_PANDA_BBY_ll](https://t.me/ll_PANDA_BBY_ll)
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install PandaAPI
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
With media support (yt-dlp):
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pip install PandaAPI[media]
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```python
|
|
20
|
+
from PandaAPI import api
|
|
21
|
+
|
|
22
|
+
# Password generator
|
|
23
|
+
print(api.password(16))
|
|
24
|
+
|
|
25
|
+
# GitHub user info
|
|
26
|
+
print(api.github("nikhil390u8o"))
|
|
27
|
+
|
|
28
|
+
# AI
|
|
29
|
+
print(api.gemini("Hello!"))
|
|
30
|
+
print(api.chatgpt("Explain black holes"))
|
|
31
|
+
|
|
32
|
+
# YouTube
|
|
33
|
+
results = api.yt_search("lofi chill beats")
|
|
34
|
+
print(results)
|
|
35
|
+
|
|
36
|
+
# Telegram bot info
|
|
37
|
+
print(api.tg_bot_info("YOUR_BOT_TOKEN"))
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Modules
|
|
41
|
+
|
|
42
|
+
| Module | Functions |
|
|
43
|
+
|--------|-----------|
|
|
44
|
+
| `tools` | `password`, `morse_encode`, `morse_decode`, `github`, `pypi`, `hashtag`, `chatbot`, `meme`, `unsplash`, `imdb`, `leetcode`, `bhagwatgita` |
|
|
45
|
+
| `ai` | `gemini`, `chatgpt`, `blackbox` |
|
|
46
|
+
| `telegram` | `tg_bot_info`, `tg_user` |
|
|
47
|
+
| `media` | `yt_search`, `yt_thumb` |
|
|
48
|
+
|
|
49
|
+
## License
|
|
50
|
+
|
|
51
|
+
MIT
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "PandaAPI"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
authors = [
|
|
9
|
+
{ name = "PANDA" }
|
|
10
|
+
]
|
|
11
|
+
description = "Python utility hub by @ll_PANDA_BBY_ll"
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
license = { text = "MIT" }
|
|
14
|
+
requires-python = ">=3.8"
|
|
15
|
+
keywords = ["python", "PandaAPI", "telegram", "bot"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Programming Language :: Python :: 3",
|
|
18
|
+
"Operating System :: OS Independent",
|
|
19
|
+
]
|
|
20
|
+
dependencies = [
|
|
21
|
+
"requests",
|
|
22
|
+
"beautifulsoup4",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
[project.optional-dependencies]
|
|
26
|
+
media = ["yt-dlp"]
|
|
27
|
+
|
|
28
|
+
[tool.setuptools.packages.find]
|
|
29
|
+
where = ["."]
|
pandaapi-1.0.0/setup.cfg
ADDED
pandaapi-1.0.0/setup.py
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
import re
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def get_version():
|
|
6
|
+
with open("PandaAPI/__init__.py", encoding="utf-8") as f:
|
|
7
|
+
match = re.search(r'^__version__ = [\'"]([\'"]*)[\'"]', f.read(), re.M)
|
|
8
|
+
if not match:
|
|
9
|
+
raise RuntimeError("Version not found")
|
|
10
|
+
return match.group(1)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
try:
|
|
14
|
+
with open("README.md", encoding="utf-8") as f:
|
|
15
|
+
long_desc = f.read()
|
|
16
|
+
except FileNotFoundError:
|
|
17
|
+
long_desc = "PandaAPI — Python utility hub"
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
setup(
|
|
21
|
+
name="PandaAPI",
|
|
22
|
+
version="1.0.0",
|
|
23
|
+
author="PANDA",
|
|
24
|
+
author_email="",
|
|
25
|
+
description="Python utility hub by @ll_PANDA_BBY_ll",
|
|
26
|
+
long_description=long_desc,
|
|
27
|
+
long_description_content_type="text/markdown",
|
|
28
|
+
packages=find_packages(),
|
|
29
|
+
license="MIT",
|
|
30
|
+
install_requires=[
|
|
31
|
+
"requests",
|
|
32
|
+
"beautifulsoup4",
|
|
33
|
+
],
|
|
34
|
+
extras_require={
|
|
35
|
+
"media": ["yt-dlp"],
|
|
36
|
+
},
|
|
37
|
+
python_requires=">=3.8",
|
|
38
|
+
keywords=["python", "PandaAPI", "telegram", "bot"],
|
|
39
|
+
classifiers=[
|
|
40
|
+
"Programming Language :: Python :: 3",
|
|
41
|
+
"Operating System :: OS Independent",
|
|
42
|
+
],
|
|
43
|
+
)
|