-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d8036be
Showing
10 changed files
with
929 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
name: "Bug Report \U0001F41B" | ||
about: Create a bug report. | ||
title: 'Bug: ' | ||
labels: bug | ||
assignees: '' | ||
|
||
--- | ||
|
||
**Used `auepa` Version:** | ||
|
||
**Console Log:** | ||
```bash | ||
... | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
name: "Feature Request \U0001F4A1" | ||
about: Suggest a new idea for the project. | ||
title: 'Feature Request: ' | ||
labels: enhancement | ||
assignees: '' | ||
|
||
--- | ||
|
||
**Describe Your feature request:** | ||
|
||
|
||
**Why should I add that?:** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
## 0.1 | ||
Initial release. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from emoji import emojize, demojize, UNICODE_EMOJI | ||
|
||
class Emoji(object): | ||
def __init__(self, Name: str): | ||
self.unicode = [Emoji for Emoji in emojize(Name, use_aliases = True) if Emoji in UNICODE_EMOJI.keys()][0] | ||
self.shortcode = demojize(self.unicode) | ||
self.codepoints = [ | ||
emojize(self.unicode).encode("unicode-escape").upper(), | ||
"U+{0}".format(self.unicode).encode("unicode-escape").decode().upper().split("0")[-1], | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import re | ||
from requests import get | ||
|
||
class Meta(object): | ||
class Emoji: | ||
def __init__(self, Character: str): | ||
self.__emote = Character | ||
self.__meta = get("https://emojipedia.org/{0}".format(self.__emote)) | ||
self.name = self.__meta.text.split('"og:title" content="')[1].split('"')[0][2:] | ||
self.description = re.sub(re.compile("<.*?>|&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-f]{1,6});"), "", self.__meta.text.split('Emoji Meaning</h2>\n')[1].split("<h2>" | ||
)[0]).replace("\n\n", "").replace("\n", " ") | ||
self.aliases = [Element[1:].split("<")[0] for Element in self.__meta.text.split("</h2>\n<ul>\n")[1].split("</span>")[1:]] | ||
self.url = self.__meta.url |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import re | ||
from requests import get | ||
from emoji import emojize, demojize | ||
|
||
class Utils(object): | ||
def get_image(Character: str, Info: dict = {"Vendor": "Version"}): | ||
"""Gets an emoji image based on `Character` and `Info`.""" | ||
Character = emojize(Character, use_aliases = True) | ||
## | ||
Code = "" | ||
Vendor = list(Info.keys())[0].lower() | ||
Version = list(Info.values())[0] | ||
Image_Size = 144 | ||
#---# | ||
if Vendor == "vendor": Vendor = None | ||
if Version == "version": Version = None | ||
#---# | ||
##- Table -## | ||
# Replacements (Unused) | ||
if Vendor == "instagram": Vendor = "facebook" | ||
if Vendor == "linkedin": Vendor = "samsung" | ||
if Vendor == "nintendo": Vendor = "openmoji" | ||
if Vendor == "roblox": Vendor = "openmoji" | ||
# Replacements (Vendors) | ||
if Vendor == "discord": Vendor = "twitter"; Code = "windows-"; Version = "13.0.1" | ||
if Vendor == "skype": Vendor = "microsoft"; Code = "windows-"; Version = "10" | ||
if Vendor == "slack": Vendor = "google"; Code = "android-"; Version = "8.1" | ||
if Vendor == "snapchat": Vendor = "apple"; Code = "ios-"; Version = "9.3" | ||
if Vendor == "telegram": Vendor = "apple"; Code = "ios-"; Version = "9.3" | ||
# Aliases | ||
if Vendor == "android": Vendor = "google" | ||
if Vendor == "ios": Vendor = "apple" | ||
if Vendor == "windows": Vendor = "microsoft" | ||
if Vendor == "twemoji": Vendor = "twitter" | ||
# Auto-assigned | ||
if Vendor == "messenger": Version = "1.0" | ||
if Vendor == "mozilla": Version = "2.5" | ||
#---# | ||
if Vendor == "au-kddi": Code = "type-"; Version = "-".join(list(Version)) | ||
if Vendor == "htc": Code = "sense-" | ||
if Vendor == "lg": Code = "G" | ||
if Vendor == "twitter": Code = "twemoji-" | ||
#---# | ||
if Vendor == "apple": | ||
Vendor = Vendor; Code = "ios-" | ||
if Version == "2.2": Code = "iphone-os-" | ||
if Vendor == "google": | ||
Vendor = Vendor; Code = "android-" | ||
if Version.startswith("10.0-m20fd"): Version = "10.0-march-2020-feature-drop" | ||
if Version.startswith("gmail"): Code = ""; Version = "gmail" | ||
if Vendor == "microsoft": | ||
Vendor = Vendor; Code = "windows-" | ||
#---# | ||
if Version == "10may19":Version = "10-may-2019-update" | ||
if Version == "10oct18":Version = "10-october-2018-update" | ||
if Version == "10apr18":Version = "10-april-2018-update" | ||
if Version == "10fc": Version = "10-fall-creators-update" | ||
if Version == "10c": Version = "10-creators-update" | ||
if Version == "10a": Version = "10-anniversary-update" | ||
if Version == "10": Version = "10" | ||
if Version == "8.1": Version = "8.1" | ||
if Version == "8.0": Version = "8.0" | ||
if Vendor == "samsung": | ||
Vendor = Vendor; Code = "one-ui-" | ||
#---# | ||
if Version.startswith("experience"): Code = "experience-"; Version = Version.split("experience")[-1] | ||
if Version.startswith("touchwiz"): Code = "touchwiz-"; Version = Version.split("touchwiz")[-1] | ||
#-----# | ||
Style_Page = get("https://emojipedia.org/{0}/{1}{2}".format( | ||
Vendor, Code, Version if Version != "latest" else "")) | ||
if Style_Page.status_code != 200: raise ValueError(Info) | ||
|
||
for Link in re.findall("(?P<url>https?://[^\s]+)", Style_Page.text): | ||
if str(Image_Size) in Link: | ||
if Character.encode("unicode-escape").decode()[5:] in Link: | ||
return Link | ||
|
||
def center_image(Image_URL: str): | ||
"""Centers visible emoji image.""" | ||
from PIL import Image | ||
im = Image.open(get(Image_URL, stream = True).raw) | ||
im = im.crop(im.getbbox()) | ||
im2 = Image.new("RGBA", (im.size[0] if im.size[0] > im.size[1] else im.size[1],) * 2, (0,) * 4) | ||
im2.paste(im, ((im2.size[0] - im.size[0]) // 2, (im2.size[1] - im.size[1]) // 2), im) | ||
return im2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
"""Another Unofficial EmojiPedia API | ||
Simple API-like module providing basic | ||
EmojiPedia utilities. Mainly focuses on | ||
advanced emoji images scraping support.""" | ||
|
||
from .Emoji import * | ||
from .Meta import * | ||
from .Utils import * | ||
|
||
__author__ = "kubinka0505" | ||
__copyright__ = __author__ | ||
__credits__ = __author__ | ||
__version__ = "0.1" | ||
__date__ = "24.12.2020" | ||
__status__ = "Beta" | ||
__license__ = "GPL v2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
name = "auepa", | ||
version = "0.1", | ||
author = "kubinka0505", | ||
description = """Another Unofficial EmojiPedia API.""", | ||
license = "GPL V3", | ||
keywords = "auepa image emojipedia api api-wrapper", | ||
url = "https://github.com/kubinka0505/auepa", | ||
packages=setuptools.find_packages(), | ||
classifiers=[ | ||
"Development Status :: 4 - Beta", | ||
"Environment :: Console", | ||
"Intended Audience :: End Users/Desktop", | ||
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)", | ||
"Natural Language :: English", | ||
"Programming Language :: Python :: 3 :: Only", | ||
"Topic :: Utilities", | ||
], | ||
) |
Oops, something went wrong.