コード例 #1
0
ファイル: aniname.py プロジェクト: s1as3r/Skripts
def get_all_eps(name: str, select: int = 0) -> Dict[int, Tuple[str, bool]]:
    """
    `str` `name`: Name of the anime.
    `bool` `select_first`: Instead of showing the prompt, select the `select` result.

    RETURNS `Dict<int, Tuple<str, bool>>`: A dictionary containing an
    episode's name and filler info.

    Get all the episodes of an anime.
    """
    client = Jikan()

    results = client.search("anime", name)["results"][:10]
    anime = {i: j for i, j in enumerate(results, 1)}
    if select == 0:
        prompt = "\n".join(f"{n:0>2} => {t['title']}"
                           for n, t in anime.items())
        select = input(prompt + "\nSelect Anime: ")
    anime_id = anime[int(select)]["mal_id"]
    selected_anime = client.anime(anime_id, extension="episodes")
    eps = selected_anime["episodes"]
    eps_len = selected_anime["episodes_last_page"]
    if eps_len != 1:
        for i in range(2, eps_len + 1):
            eps.extend(
                client.anime(anime_id, extension="episodes",
                             page=i)["episodes"])

    ep_dict = {i["episode_id"]: [i["title"], i["filler"]] for i in eps}
    return ep_dict
コード例 #2
0
ファイル: scraping.py プロジェクト: afifmj/MyNetlfixList
    def handle(self, *args, **options):
        links = []
        jikan = Jikan()

        driver = webdriver.Chrome(
            "C:/Users/AFIF/Downloads/chromedriver_win32/chromedriver.exe")

        # driver = webdriver.Chrome()
        url = "https://www.justwatch.com/in/provider/netflix/tv-shows?genres=ani&sort_by=release_year"
        driver.maximize_window()
        driver.get(url)
        time.sleep(5)
        count = 0
        #Scrolling _____________________________________________________________________
        from selenium.webdriver.common.action_chains import ActionChains
        i = 1
        for i in range(15):
            ActionChains(driver).move_to_element(
                driver.find_element_by_class_name(
                    'jw-app-footer__link')).perform()
            time.sleep(1.5)
            content = driver.page_source.encode('utf-8').strip()
            soup1 = BeautifulSoup(content, "html.parser")
            anime1 = soup1.find_all(class_="title-list-grid__item")
            for div in anime1:
                links.append(div.a['href'])
                l = []
                l = div.a['href'].split('/')
                l2 = []
                l2 = l[3].split('-')
                s = ""
                for i in l2:
                    s += i
                    s += " "
                # try:
                # save in db
                if Anime.objects.filter(anime_name=s).exists():
                    print("{} contained in queryset".format(s))
                else:
                    try:

                        search_result = jikan.search('anime', s)
                        p = Anime(
                            anime_name=s,
                            score=search_result['results'][0]['score'],
                            synopsis=search_result['results'][0]['synopsis'],
                            url=search_result['results'][0]['url'],
                            image_url=search_result['results'][0]['image_url'])
                        p.save()
                        print('%s added' % (s))
                        count += 1
                    except:
                        print("{} COULD NOT BE ADDED".format(s))

                    time.sleep(4)
        print(count)
        # print(AnimeNames.objects.get(anime_name='ergo proxy'))
        driver.quit()

        self.stdout.write('job complete')
コード例 #3
0
ファイル: main.py プロジェクト: ammo414/Fuwa
def vrv(vrvlink):
    jikan = Jikan()
    page = requests.get(vrvlink)
    soup = bs(page.content, 'html.parser')
    title = str(soup.find_all('title'))[8:-9]
    mallink = jikan.search('anime', title)['results'][0]['url']
    return mallink
コード例 #4
0
class MyAnimeList(AnimeInformationProvider):
    def __init__(self):
        self.jikan = Jikan()
        self.logger = logging.getLogger(self.__class__.__name__)

    def anime_to_characters_names(self, anime_name: str):
        animes = self.jikan.search('anime', anime_name)['results']
        if not animes:
            raise Exception('Could not find anime: {}'.format(anime_name))
        anime = animes[0]
        anime_title = anime['title']
        self.logger.debug('Found anime: %s.', anime_title)

        characters = self.jikan.anime(
            anime['mal_id'], extension='characters_staff')['characters']
        self.logger.debug('Found %s characters for the anime: %s.',
                          len(characters), anime_title)
        names = []
        for character in characters:
            full_name = character['name']
            name_parts = full_name.split(',')
            if len(name_parts) == 2:
                last_name = name_parts[0]
                first_name = name_parts[1]
                names.append(Name(last_name=last_name, first_name=first_name))
        return names
コード例 #5
0
def malSearch(name):
    print()
    print('Initial title: ' + name)

    #Initiate Jikan
    jikan = Jikan()

    if len(name) < 3:
        log(1, name)
        return False

    rname = name.replace('&', 'and')

    try:
        jfile = jikan.search('anime', rname)
    except:
        log(2, name)
        return False

    jdata = json.loads(json.dumps(jfile))
    jver = jverify(name, jdata)

    if jver == False:
        log(2, name)
        return False

    return [str(jdata['results'][jver[1]]['mal_id']), jver[0]]
コード例 #6
0
ファイル: myanimelist.py プロジェクト: yftachsh/MyAnimeFeed
class MyAnimeListAPI(object):
    def __init__(self, username):
        self._instance = Jikan()
        self._user = username

    def search(self, title):
        search_results = self._instance.search('anime', title)['results']
        entries = []

        for result in search_results:
            entries.append(AnimeEntry(result))

        return entries

    def currently_watching(self):
        response = self._instance.user(username=self._user,
                                       request="animelist",
                                       argument="watching")
        anime_list = []
        for anime in response['anime']:
            anime_list.append(AnimeEntry(anime))

        return anime_list

    def plan_to_watch(self):
        response = self._instance.user(username=self._user,
                                       request="animelist",
                                       argument="plantowatch")
        anime_list = []
        for anime in response['anime']:
            anime_list.append(AnimeEntry(anime))

        return anime_list
コード例 #7
0
ファイル: main.py プロジェクト: ammo414/Fuwa
def netflix(netflixlink):
    url = re.findall('https:.*$', netflixlink)
    jikan = Jikan()
    page = requests.get(url[0])
    soup = bs(page.content, 'html.parser')
    title = str(soup.find_all('title'))[8:-19]
    mallink = jikan.search('anime', title)['results'][0]['url']
    return mallink
コード例 #8
0
def searchMAL(title, imgList, sleep):
    jikan = Jikan()

    result = jikan.search('anime', title)
    firstResult = result["results"][0]
    imgList.append(firstResult["image_url"])
    print(firstResult["title"])
    time.sleep(sleep)
コード例 #9
0
 def series_memo_identifier(id=None, *, name=None):
     jikan = Jikan()
     if id:
         mal_id = id
     elif name:
         mal_id = jikan.search('anime', name)['results'][0]['mal_id']
     else:
         raise ValueError('You must specify an ID or name.')
     return mal_id
コード例 #10
0
ファイル: searchanime.py プロジェクト: sankalpsagar/mai
def search_anime(s):
    jikan = Jikan()
    results = jikan.search('anime', s)

    result = {}

    print(CGREEN + "[Mai] These are the top results I found." + CEND)

    for idx, resultitems in enumerate(results['results'], start=1):
        print("\t" + CRED + str(idx) + ". " +
              wrapper.fill(resultitems['title']) + CEND)
        # storing mal_id for later use
        result[idx] = resultitems['mal_id']

    # to check if everything is working as expected
    # print(result)

    print(
        CGREEN +
        "[Mai] Type the index of the anime you want information on or type 0 to exit: "
        + CEND,
        end=' ')
    idx = int(input())

    if (idx == 0):
        return

    results = jikan.anime(result[idx])
    print(
        CGREEN +
        "[Mai] This is the information I found on the requested anime (press q to exit imageviewer)"
        + CEND)

    # sanity check
    # print(results)

    # downloading image and storing in cache
    f = open('cachepic.jpg', 'wb')
    f.write(urllib.request.urlopen(results['image_url']).read())
    f.close()

    # ugh i don't like this hack. depends too much on system and imageviewer installed. try to fix this later.
    subprocess.call(["feh", "-x", "cachepic.jpg"])

    title = results['title']
    episodes = results['episodes']
    status = results['status']
    # returns as list
    title_syns = results['title_synonyms']
    date = results['aired']['string']
    syn = results['synopsis']
    score = results['score']

    printnicely(title, title_syns, score, status, syn, episodes, date)
コード例 #11
0
ファイル: ScanShows.py プロジェクト: Paul-Austria/streaming
def getInfoFromDatabase(allShows):

    jikan = Jikan()
    Database = mysql.connector.connect(host="127.0.0.1",
                                       user="******",
                                       passwd="python",
                                       database="streaming")

    cursor = Database.cursor(buffered=True)
    c = 0

    for CShows in allShows:
        print("current: " + CShows)
        cursor.execute("SELECT * FROM series WHERE SeriesName=%s", (CShows, ))
        fetch = cursor.fetchone()
        if getIFCheck(fetch):
            search_result = jikan.search('anime', CShows)
            try:
                if len(search_result) >= 1:

                    Mal_id = str(search_result['results'][0]['mal_id'])
                    anime = jikan.anime(Mal_id)
                    sql = ""
                    execute = True
                    val = None
                    if fetch != None:
                        if anime['status'] == "Currently Airing":
                            execute = False
                        sql = "UPDATE customers SET seriesStatus = %s WHERE id = %s"
                        val = (anime['status'], fetch[0])
                        print("Show Updated !")

                    else:
                        sql = "INSERT INTO series (seriesName, JapaneseName, genres, seriesStatus, Description, episodeCount, ImageURL, LargeImageURL, malID, trailer, aired, duration, type ) VALUES (%s, %s, %s, %s,%s,%s,%s,%s,%s,%s,%s,%s,%s)"
                        val = (CShows, anime['title_japanese'],
                               GetGenres(anime), anime['status'],
                               anime['synopsis'], anime['episodes'],
                               anime['image_url'], anime['image_url'].replace(
                                   ".jpg", "l.jpg"), Mal_id,
                               anime['trailer_url'], anime['premiered'],
                               anime['duration'], anime['type'])

                    if execute:
                        cursor.execute(sql, val)
                        Database.commit()
            except:
                print("error at: " + CShows)

    getSchedule(cursor, Database)
コード例 #12
0
class MTJikan(API):
    calls_minute = None
    calls_second = None
    last_api_call = None

    def __init__(
        self,
        selected_base: Optional[str] = None,
        session: Optional[requests.Session] = None,
    ) -> None:
        self.jikan = Jikan()

    @classmethod
    def initialize(cls):
        super().__init__(2, 30)

    def search(
        self,
        search_type: str,
        query: str,
        page: Optional[int] = None,
        parameters: Optional[Mapping[str, Optional[Union[int, str,
                                                         float]]]] = None,
    ) -> Dict[str, Any]:
        super()._check_rate_seconds()
        super()._check_rate_minutes()

        MTJikan.calls_second += 1
        MTJikan.calls_minute += 1
        MTJikan.last_api_call = datetime.now()
        search_results = self.jikan.search(search_type, query, page,
                                           parameters)
        return search_results["results"]

    def manga(self,
              id: int,
              extension: Optional[str] = None,
              page: Optional[int] = None) -> Dict[str, Any]:
        super()._check_rate_seconds()
        super()._check_rate_minutes()

        MTJikan.calls_second += 1
        MTJikan.calls_minute += 1
        MTJikan.last_api_call = datetime.now()
        search_results = self.jikan.manga(id, extension, page)
        search_results["source"] = "MAL"
        search_results["id"] = str(id)
        search_results["url"] = r"https://myanimelist.net/manga/" + str(id)
        return search_results
コード例 #13
0
ファイル: main.py プロジェクト: Cyust3/MediaSoft-2020
def repeat_all_messages(message):
    request = message.text
    jikan = Jikan()
    apiResult = jikan.search('anime', request)
    listResult = apiResult['results'][:5]
    keyboard: InlineKeyboardMarkup = types.InlineKeyboardMarkup()
    for item in listResult:
        btn = types.InlineKeyboardButton(text=item['title'], url=item['url'])
        keyboard.add(btn)
    if not listResult:
        bot.send_message(message.chat.id, "Ошибка, введите название аниме:")
    else:
        bot.send_message(message.chat.id,
                         'Нажми на кнопку и перейди по ссылки.',
                         reply_markup=keyboard)
コード例 #14
0
    async def execute_command(self, client, msg, content):
        if not content:
            await utils.delay_send(msg.channel, f"Usage: {self.usage}")
            return

        jikan = Jikan()
        show = jikan.search("anime", content)["results"][1]

        if show["rated"] == "Rx" or show["rated"] == "R+":
            await utils.delay_send(msg.channel,
                                   "Sorry, I can't give info on NSFW shows.")
            if msg.channel.type is not discord.ChannelType.private:
                await msg.delete()
            return

        embed = discord.Embed(title=show["title"],
                              url=show["url"],
                              description=show["synopsis"])
        embed.set_image(url=show["image_url"])

        await utils.delay_send(msg.channel, "", embed=embed)
コード例 #15
0
ファイル: bot.py プロジェクト: fangyman/Anime-bot-v2
async def anime(ctx, *, message=" "):
    jikan = Jikan()
    if message == " ":
        await ctx.send("Please enter an anime: ?anime <anime name>")
    else:
        temp_lst = []
        new_dict = jikan.search('anime', query=message)
        counter = 1
        for info in new_dict['results']:
            embed_anime = Embed(title="Search", color=Colour.dark_red())
            embed_anime.add_field(name="Title",
                                  value=info['title'],
                                  inline=False)
            embed_anime.add_field(name="Score",
                                  value=info['score'],
                                  inline=False)
            embed_anime.add_field(name="Synopsis",
                                  value=info['synopsis'],
                                  inline=False)
            if info['airing'] is True:
                embed_anime.add_field(name="Airing Now",
                                      value="Yes",
                                      inline=False)
            else:
                embed_anime.add_field(name="Airing Now",
                                      value="No",
                                      inline=False)
            embed_anime.add_field(name="More info",
                                  value=info['url'],
                                  inline=False)
            embed_anime.set_thumbnail(url=info['image_url'])
            embed_anime.set_footer(text="Time: " +
                                   today_date.strftime("%m/%d/%Y, %H:%M:%S"))
            temp_lst.append(embed_anime)
            counter += 1
            if counter == 11:
                break
        page_cont = BotEmbedPaginator(ctx, temp_lst)
        await page_cont.run()
コード例 #16
0
class MyAnimeListService():
    def __init__(self):
        self.jk = Jikan()
    def get_anime(self,anime_name):
        # BUSCAMOS EL ANIME
        result = self.jk.search("anime",anime_name,parameters={"limit": 1})
        anime_data = self.jk.anime(result["results"][0]["mal_id"])
        anime = {}
        ## OBTENEMOS NADA MAS LA INOFMRACIÓN QUE NECESITAMOS
        anime["title"] = anime_data["title"] # TITULO
        anime["episodes"] = anime_data["episodes"] # EPISODIOS
        anime["airing"] = "🔴 Finished Airing" if not anime_data["airing"] else "✅ Currently Airing" # Al aire
        ## SCORE con emoji
        if anime_data["score"]>7.5:
            score = "%s 😍"%anime_data["score"]
        elif 5<anime_data["score"]<=7.5:
            score = "%s 🙂"%anime_data["score"]
        elif 2.5<anime_data["score"]<=5:
            score = "%s 😞"%anime_data["score"]
        elif anime_data["score"]<=2.5:
            score = "%s 😠"%anime_data["score"]
        anime["score"] = score # Score
        anime["date"] = "%s"%anime_data["aired"]["from"][:10] #Fecha en que se publico
        anime["rated"] = anime_data["rating"] # Rating
        anime["synopsis"] = anime_data["synopsis"] # Sinpopsis
        anime["background"] = anime_data["background"] # Contexto
        anime["genres"] = ", ".join([x["name"] for x in anime_data["genres"] ]) # Generos
        anime["ranked"] = str(anime_data["rank"]) # Rank en MAL
        anime["trailer"] = anime_data["trailer_url"] # URL del trailer
        # Tratamos de obtener su imagen
        try:
            regex = re.search(r"\.jpg",anime_data["image_url"])
            anime["image"] = anime_data["image_url"][:regex.end()]
        except:
            anime["image"] = None
        return anime
コード例 #17
0
ファイル: animedetail.py プロジェクト: saswat761026/ManageHDD
from jikanpy import Jikan

jikan = Jikan()

mushishi = jikan.anime(39617)
mushishi_with_eps = jikan.anime(21, extension='episodes', page=10)

search_result = jikan.search('anime', 'One Piece', page=1)

winter_2018_anime = jikan.season(year=2021, season='winter')

archive = jikan.season_archive()

for anime in winter_2018_anime['anime']:
    if anime['title'] == 'One Piece':
        print(anime)

print(archive)
print(winter_2018_anime)
print(search_result)
コード例 #18
0
ファイル: sort_ptw.py プロジェクト: A-Baji/MAL-PTW-Sort
with open("animelist.xml") as xml_file:
    data_dict = xmltodict.parse(xml_file.read())
xml_file.close()
ani_list = json.dumps(data_dict)
ani_list = json.loads(ani_list)

ptw = []
for i in ani_list['myanimelist']['anime']:
    if i['my_status'] == 'Plan to Watch':
        ptw.append(i['series_title'])

jikan = Jikan()
ptw_scores = []
for i in ptw:
    anime_name = i
    anime = jikan.search(search_type="anime", query=anime_name)
    for k in anime['results']:
        if k['title'].lower() == anime_name.lower():
            ptw_scores.append({'title': i, 'score': k['score']})
            break
    time.sleep(4)

list = {
    'sorted_ptw': sorted(ptw_scores,
                         key=lambda ani: ani['score'],
                         reverse=True)
}

f = open("sorted PTW list.txt", "w")
f.write(json.dumps(list, indent=4, sort_keys=True))
f.close()
コード例 #19
0
def fetch_anime_data(metadata_list, mediainfo_list, file_paths, log):
    try:
        import settings
    except ModuleNotFoundError:
        log.error(
            "Settings file not found! Something has gone terribly wrong!")
        raise SettingsVanishedError

    filedata_list = []
    anime_data = {}
    jikan = Jikan()

    client = yumemi.Client()
    client.auth(settings.login, settings.password)
    if settings.key:
        client.encrypt(settings.key, settings.login)

    log.info("Querying hashes to AniDB...")

    for counter, metadata in enumerate(metadata_list):
        log.info(metadata['filename'] + " is being processed..." +
                 " (File {} out of {})".format(counter +
                                               1, len(metadata_list)))

        file_size = metadata['size']
        file_hash = metadata['hash']

        if not client.ping():
            log.error("Client ping failed.")
            raise ExceptionHandlers.AniDBDown

        response = client.call(
            'FILE', {
                'size': file_size,
                'ed2k': file_hash,
                'fmask': '720A7FC000',
                'amask': '00000080',
                's': 'xxxxxx'
            })
        if response.code != 220:
            log.error("Wrong response! File was not found.")
            raise ExceptionHandlers.AniDBResponseException(response.code)

        response.data[0].extend(mediainfo_list[counter])

        file_data = FileResponseData(*response.data[0])

        if file_data.is_deprecated != "0":
            log.warning(
                "File seems to be deprecated! is_depracated field from AniDB is {}!"
                .format(file_data.is_deprecated))

        # Small workaround for files with multiple audio tracks. Makes it easier to parse those later.

        file_data = file_data._replace(
            audio_language=file_data.audio_language.split('\''))
        file_data = file_data._replace(
            audio_bitrate=file_data.audio_bitrate.split('\''))

        log.debug("file id: {}, video bitrate: {}"
                  ", audio bitrate: {}, audio language: {}"
                  ",is deprecated: {}".format(file_data.file_id,
                                              file_data.video_bitrate,
                                              file_data.audio_bitrate,
                                              file_data.audio_language,
                                              file_data.is_deprecated))
        filedata_list.append(file_data)
    if not ReleaseParser.release_check(filedata_list, log):
        log.error("Release check failed.")
        raise ExceptionHandlers.ReleaseCheckException
    else:
        log.info("Release check successful.")

    anime_id = file_data.anime_id

    response = client.call("ANIME", {
        'aid': anime_id,
        'amask': 'B2A08000400000',
        's': 'xxxxx'
    })

    if response.code != 230:
        log.error("Wrong response! Anime was not found")
        raise AniDBResponseException(response.code)

    mal_search_result = jikan.search(
        'anime', response.data[0][5])['results'][0]['mal_id']

    director_link, studio_links = get_creator_links(response.data[0][0], log)

    response.data[0].append(mal_search_result)
    response.data[0].append(director_link)
    response.data[0].append(studio_links)

    anime_data = AnimeResponseData(*response.data[0])

    log.debug(studio_links)

    if len(metadata_list) < int(anime_data.episode_count):
        log.error("File count is lower than expected.")
        raise ExceptionHandlers.FileCountError

    client.logout()
    if client.is_logged_in():
        log.error("Logout failed")
        raise ExceptionHandlers.LogoutError

    for filedata in filedata_list:
        if filedata.sub_format == "Not Found.":
            log.warning(
                "One or more files has missing subtitle format information! Check log for detailed information."
            )
            break
    return filedata_list, anime_data
コード例 #20
0
ファイル: examples.py プロジェクト: CodeDoes/jikanpy
jikan = Jikan()

mushishi = jikan.anime(457)
pprint(mushishi)

fma = jikan.manga(25)
pprint(fma)

ginko = jikan.character(425)
pprint(ginko)

kana_hanazawa = jikan.person(189)
pprint(kana_hanazawa)

naruto = jikan.search(search_type='anime', query='naruto')
pprint(naruto)

winter_2018 = jikan.season(year=2018, season='winter')
pprint(winter_2018)

archive = jikan.season_archive()
pprint(archive)

later = jikan.season_later()
pprint(later)

monday = jikan.schedule(day='monday')
pprint(monday)

top_anime = jikan.top(type='anime')
コード例 #21
0
		#printing all the stuff
		for items in top_anime['top']:
			print("\nRank: ", items['rank'])
			print("Title: ", items['title'])
			print("Score: ", items['score'])
			print("Type: ", items['type'])
			print("Episodes: ", items['episodes'])

	elif choice == 3:
		#search anime
		print("\nEnter search term: ")
		search = input();

		#getting dict
		search_result = jikan.search('anime', search)

		#to weedout unneccessary animes
		count = 0

		#printing results (only top 10)
		for items in search_result['results']:
			#display only 10 animes
			if count == 10:
				break
			print("\nTitle: ", items['title'])
			print("Episodes: ", items['episodes'])
			print("Score: ", items['score'])
			print("Synopsis: ", items['synopsis'])
			count+=1
コード例 #22
0
jikan = Jikan()

mushishi = jikan.anime(457)
pprint(mushishi)

fma = jikan.manga(25)
pprint(fma)

ginko = jikan.character(425)
pprint(ginko)

kana_hanazawa = jikan.person(189)
pprint(kana_hanazawa)

naruto = jikan.search(search_type="anime", query="naruto")
pprint(naruto)

winter_2018 = jikan.season(year=2018, season="winter")
pprint(winter_2018)

archive = jikan.season_archive()
pprint(archive)

later = jikan.season_later()
pprint(later)

monday = jikan.schedule(day="monday")
pprint(monday)

top_anime = jikan.top(type="anime")
コード例 #23
0
ファイル: mal.py プロジェクト: JackCloudman/MAGIBOT
class MyAnimeListService():
    def __init__(self):
        self.jk = Jikan()

    def search(self, m):
        m.m_type = "text"
        print("searching %s" % m.text)
        result = self.jk.search("anime", m.text, parameters={"limit": 5})
        print("finish")
        names = ["- %s\n" % x["title"] for x in result["results"]]
        m.text = "Resultados:\n" + "".join(names)
        return m

    def getAnime(self, m):
        result = self.jk.search("anime", m.text, parameters={"limit": 1})
        anime = result["results"][0]
        title = "*%s*" % anime["title"]
        episodes = "Episodes: %s" % anime["episodes"]
        airing = "🔴 Finished Airing" if not anime[
            "airing"] else "✅ Currently Airing"
        if anime["score"] > 7.5:
            score = "Score: %s 😍" % anime["score"]
        elif 5 < anime["score"] <= 7.5:
            score = "Score: %s 🙂" % anime["score"]
        elif 2.5 < anime["score"] <= 5:
            score = "Score: %s 😞" % anime["score"]
        elif anime["score"] <= 2.5:
            score = "Score: %s 😠" % anime["score"]
        date = "Date: %s" % anime["start_date"][:10]
        rated = "Rated: %s" % anime["rated"]
        synopsis = "Synopsis: %s" % anime["synopsis"]
        m.text = "%s\n%s\n%s\n%s\n%s\n%s\n%s\n" % (
            title, episodes, airing, score, date, rated, synopsis)
        try:
            regex = re.search(r"\.jpg", anime["image_url"])
            m.img = anime["image_url"][:regex.end()]
            m.m_type = "img"
        except:
            m.m_type = "text"
        return m

    def getAllInfo(self, m):
        result = self.jk.search("anime", m.text, parameters={"limit": 1})
        anime = self.jk.anime(result["results"][0]["mal_id"])
        title = "*%s*" % anime["title"]
        episodes = "Episodes: %s" % anime["episodes"]
        airing = "🔴 Finished Airing" if not anime[
            "airing"] else "✅ Currently Airing"
        if anime["score"] > 7.5:
            score = "Score: %s 😍" % anime["score"]
        elif 5 < anime["score"] <= 7.5:
            score = "Score: %s 🙂" % anime["score"]
        elif 2.5 < anime["score"] <= 5:
            score = "Score: %s 😞" % anime["score"]
        elif anime["score"] <= 2.5:
            score = "Score: %s 😠" % anime["score"]
        date = "Date: %s" % anime["aired"]["from"][:10]
        rated = "Rated: %s" % anime["rating"]
        synopsis = "Synopsis: %s" % anime["synopsis"]
        background = "Background: %s" % anime["background"]
        genres = "Genres:" + ", ".join([x["name"] for x in anime["genres"]])
        ranked = "Ranked: " + str(anime["rank"])
        trailer = "Trailer: " + anime["trailer_url"]
        data = (title, genres, episodes, airing, score, ranked, date, rated,
                synopsis, background, trailer)
        m.text = "%s\n" * len(data)
        m.text = m.text % data
        try:
            regex = re.search(r"\.jpg", anime["image_url"])
            m.img = anime["image_url"][:regex.end()]
            m.m_type = "img"
        except:
            m.m_type = "text"
        return m
コード例 #24
0
ファイル: main.py プロジェクト: ammo414/Fuwa
def crunchyroll(crunchylink):
    jikan = Jikan()
    title = crunchylink.replace('https://www.crunchyroll.com/',
                                '').replace('-', ' ').strip()
    mallink = jikan.search('anime', title)['results'][0]['url']
    return mallink
コード例 #25
0
class Container:

    def __init__(self, id: str, shared_info):
        self.shared_info = shared_info
        self.shared_info.pending_updates_main = True
        self.names_list = []
        self.graphs_list = []
        self.jikan = Jikan()
        self.div = html.Div(id="graphcontainer")

        self.status_children = "Status: No issues. Feel free to add graphs"
        self.max_graphs = False

        self.app = DjangoDash(id, external_stylesheets=external_stylesheets)
        self.genre_options = [
            {'label': 'Any', 'value': '1'},
            {'label': 'Action', 'value': '2'},
            {'label': 'Adventure', 'value': '3'},
            {'label': 'Cars', 'value': '4'},
            {'label': 'Comedy', 'value': '5'},
            {'label': 'Dementia', 'value': '6'},
            {'label': 'Demons', 'value': '7'},
            {'label': 'Mystery', 'value': '8'},
            {'label': 'Drama', 'value': '9'},
            {'label': 'Ecchi', 'value': '10'},
            {'label': 'Fantasy', 'value': '11'},
            {'label': 'Game', 'value': '12'},
            {'label': 'Hentai', 'value': '13'},
            {'label': 'Historical', 'value': '14'},
            {'label': 'Horror', 'value': '15'},
            {'label': 'Kids', 'value': '16'},
            {'label': 'Magic', 'value': '17'},
            {'label': 'Martial Arts', 'value': '18'},
            {'label': 'Mecha', 'value': '19'},
            {'label': 'Music', 'value': '20'},
            {'label': 'Parody', 'value': '21'},
            {'label': 'Samurai', 'value': '22'},
            {'label': 'Romance', 'value': '23'},
            {'label': 'School', 'value': '24'},
            {'label': 'Sci Fi', 'value': '25'},
            {'label': 'Shoujo', 'value': '26'},
            {'label': 'Shoujo Ai', 'value': '27'},
            {'label': 'Shounen', 'value': '28'},
            {'label': 'Shounen Ai', 'value': '29'},
            {'label': 'Space', 'value': '30'},
            {'label': 'Sports', 'value': '31'},
            {'label': 'Super Power', 'value': '32'},
            {'label': 'Vampire', 'value': '33'},
            {'label': 'Yaoi', 'value': '34'},
            {'label': 'Yuri', 'value': '35'},
            {'label': 'Harem', 'value': '36'},
            {'label': 'Slice Of Life', 'value': '37'},
            {'label': 'Supernatural', 'value': '38'},
            {'label': 'Military', 'value': '39'},
            {'label': 'Police', 'value': '40'},
            {'label': 'Psychological', 'value': '41'},
            {'label': 'Thriller', 'value': '42'},
            {'label': 'Seinen', 'value': '43'},
            {'label': 'Josei', 'value': '44'},

        ]

        self.category_options = [
            {'label': 'Any', 'value': '1'},
            {'label': 'TV', 'value': '2'},
            {'label': 'OVA', 'value': '3'},
            {'label': 'Movie', 'value': '4'},
            {'label': 'Special', 'value': '5'},
            {'label': 'ONA', 'value': '6'},
            {'label': 'Music', 'value': '7'},
        ]

        self.app.layout = self.serve_layout

        # @self.app.callback(
        #     Output('graphcontainer', 'children'),
        #     [Input('search_button', 'n_clicks'),
        #      State('searchname', 'value')]
        # )
        @self.app.callback(
            [Output('table', 'data'),
             Output('table', 'dropdown')],
            [Input('search_button', 'n_clicks'),
             Input("searchname", 'n_submit'),
             State("searchname", "value"),
             State('genre_dropdown', 'value'),
             State('category_dropdown', 'value'),
             State('date_picker_range', 'start_date'),
             State('date_picker_range', 'end_date')]
        )
        def update_table(n_clicks, n_submit, searchname, genre_dropdown, category_dropdown, start_date, end_date):
            data = [{'Name': "", 'Add Graph(s)': ""},
                    {'Name': "", 'Add Graph(s)': ""},
                    {'Name': "", 'Add Graph(s)': ""},
                    {'Name': "", 'Add Graph(s)': ""},
                    {'Name': "", 'Add Graph(s)': ""}]
            dropdown = {}

            if searchname is not None:
                data = []
                selected_genre = int(genre_dropdown) - 1
                selected_category = (self.category_options[int(category_dropdown) - 1]['label'])
                results = self.search_anime(searchname, selected_genre, selected_category, start_date, end_date)

                for x in range(0, len(results) - 1):
                    data.append({'Name': results[x]["title"], 'Add Graph(s)': "Don't add Graph"})

                dropdown = {
                    'Add Graph(s)': {
                        'options': [
                            {'label': "No", 'value': "Don't add Graph"},
                            {'label': "Yes", 'value': "Add Graph"}
                        ],
                        'searchable': False,
                        'clearable': False
                    }
                }

            return data, dropdown

        @self.app.callback(
            [Output('graphcontainer', 'children'),
             Output('status_message', 'children'),
             Output('add_graphs', 'disabled')],
            [Input('add_graphs', 'n_clicks'),
             State('table', 'data')]
        )
        def add_graph(n_clicks, data):
            id = 'graph-{}'.format(n_clicks)

            disable_add_button = self.max_graphs
            children = self.status_children

            names_added = []
            names_no_data = []
            names_duplicate = []
            names_above_max = []

            num_graphs = Anime.objects.count()

            if n_clicks > 0:
                for i in data:
                    if i['Add Graph(s)'] == 'Add Graph':
                        if num_graphs < 5:
                            if i['Name'] not in self.names_list:
                                try:
                                    test = graphs.Graphs(i['Name'] + 'app', i['Name'], i['Name'], i['Name'] + 'slider',
                                                         False,
                                                         [Input(i['Name'] + 'slider', 'value')],
                                                         self.shared_info.color_graphs,
                                                         self.shared_info.time_scale, i['Name'])
                                    self.graphs_list.append(test.return_layout())  # Potentially causes exception

                                    self.names_list.append(i['Name'])
                                    names_added.append(i['Name'])

                                    num_graphs = num_graphs + 1
                                    a = Anime(anime_name=i['Name'], anime_order=num_graphs)
                                    a.save()

                                except exceptions.ResponseError:
                                    names_no_data.append(i['Name'])

                            else:
                                names_duplicate.append(i['Name'])
                        else:
                            names_above_max.append(i['Name'])

                str_names = ""
                str_no_data = ""
                str_duplicates = ""
                str_above = ""

                if num_graphs == 5:
                    disable_add_button = True
                    self.max_graphs = True

                if len(names_added) > 0:
                    self.shared_info.pending_updates_edit = True
                    self.shared_info.pending_updates_export = True
                    str_names = "Added (" + str(num_graphs) + "/5 total limit): "
                    for i in names_added:
                        str_names = str_names + i + "; "
                if len(names_no_data) > 0:
                    str_no_data = "Not added (no search data or rate limit exceeded): "
                    for i in names_no_data:
                        str_no_data = str_no_data + i + "; "

                if len(names_duplicate) > 0:
                    str_duplicates = "Not added (duplicate graph): "
                    for i in names_duplicate:
                        str_duplicates = str_duplicates + i + "; "

                if len(names_above_max) > 0:

                    str_above = "Not added (exceeded 5-graph limit): "
                    for i in names_above_max:
                        str_above = str_above + i + "; "

                if len(str_names) > 0 or len(str_no_data) > 0 or len(str_duplicates) > 0 or len(str_above) > 0:
                    children = "Status - "
                    if len(str_names) > 0:
                        children = children + str_names
                    if len(str_no_data) > 0:
                        children = children + str_no_data
                    if len(str_duplicates) > 0:
                        children = children + str_duplicates
                    if len(str_above) > 0:
                        children = children + str_above

            return html.Div(self.graphs_list), children, disable_add_button

    def serve_layout(self):
        if self.shared_info.pending_updates_main:
            self.shared_info.pending_updates_main = False
            self.div = html.Div(children=self.init_graph(), id="graphcontainer")

        num_graphs = Anime.objects.count()

        if num_graphs == 5:
            self.status_children = "Status: Max graphs (5) limit reached. Graphs may be removed via 'Settings' page."
            self.max_graphs = True
        else:
            self.status_children = "Status: No changes made yet. Feel free to add graphs (" + str(
                num_graphs) + "/5 total limit)"
            self.max_graphs = False

        graph_area = self.div

        return html.Div([
            html.Div(
                id='searchtablearea',
                children=[
                    html.Div(
                        id='searcharea',
                        children=[
                            dcc.Input(
                                id='searchname',
                                type='text',
                                placeholder='Enter Show Name',
                                debounce=True,
                                n_submit=0
                            ),
                            html.Button(id="search_button", n_clicks=0, children="Search"),
                            html.P('Genre:'),
                            dcc.Dropdown(id='genre_dropdown',
                                         options=self.genre_options,
                                         value='1',
                                         clearable=False
                                         ),

                            html.P('Category:'),
                            dcc.Dropdown(id='category_dropdown',
                                         options=self.category_options,
                                         value='1',
                                         clearable=False
                                         ),

                            html.P('Select search range:'),

                            dcc.DatePickerRange(
                                id='date_picker_range',
                                start_date_placeholder_text='Select start date',
                                end_date_placeholder_text='Select end date',
                                clearable=True,
                            ),
                        ]),
                    html.Div(
                        id='tablearea',
                        children=
                        [self.init_table(),
                         html.P(id='status_message', children=self.status_children, style={'font-style': 'italic'}),
                         html.Button(id="add_graphs", n_clicks=0, children="Add selected graphs",
                                     disabled=self.max_graphs),
                         ])
                ]),
            graph_area,
        ])

    def init_graph(self):
        initial_graphs = []
        self.graphs_list = []
        self.names_list = []
        for a in Anime.objects.raw('SELECT anime_name FROM home_anime ORDER BY anime_order ASC'):
            p = str(a)
            self.names_list.append(p)
            initial_graphs.append(
                graphs.Graphs(p.replace(" ", ""), p, p.replace(" ", ""), p.replace(" ", "") + 'slider', False,
                              [Input(p.replace(" ", "") + 'slider', 'value')], self.shared_info.color_graphs,
                              self.shared_info.time_scale, p))

        if len(initial_graphs) != 0:
            for i in initial_graphs:
                self.graphs_list.append(i.return_layout())

        return html.Div(self.graphs_list)

    def search_anime_gender_birthday(self, anime_id):
        data = [sub['username'] for sub in self.jikan.anime(anime_id, extension='userupdates', page=1)["users"]]
        user = [self.jikan.user(username=name) for name in data]
        print(name['birthday'] for name in user)
        print(name['gender'] for name in user)

    def search_anime(self, anime_name, genre_number, category_name, start_date, end_date):
        search_params = {}

        if genre_number > 0:
            search_params['genre'] = genre_number

        if category_name != "Any":
            search_params['type'] = category_name

        if start_date is not None:
            search_params['start_date'] = start_date

        if end_date is not None:
            search_params['end_date'] = end_date

        search = self.jikan.search('anime', anime_name, parameters=search_params)

        # user = self.jikan.user_list(38000)
        # print(user)
        # print(user['birthday'])
        # print(user['gender'])
        return search["results"]

    def init_table(self, type: str = 'Add', pg_size: int = 5):
        layout = dash_table.DataTable(
            id='table',
            style_cell={'textAlign': 'left'},
            style_data_conditional=[
                {
                    "if": {"state": "active"},  # 'active' | 'selected'
                    "backgroundColor": "#FFFFFF",
                    "border": "1px solid #3CCFCF",
                },
                {
                    "if": {"state": "selected"},
                    "backgroundColor": "##FFFFFF",
                    "border": "1px solid #3CCFCF",
                },
            ],
            style_header={
                'backgroundColor': 'rgb(230, 230, 230)',
                'fontWeight': 'bold'
            },
            columns=[{"name": "Name",
                      "id": "Name",
                      "editable": False
                      },
                     {"name": type + ' Graph(s)',
                      "id": type + ' Graph(s)',
                      "presentation": "dropdown",
                      "editable": True,
                      }
                     ],
            dropdown={},
            data=[{'Name': "", 'Add Graph(s)': ""},
                  {'Name': "", 'Add Graph(s)': ""},
                  {'Name': "", 'Add Graph(s)': ""},
                  {'Name': "", 'Add Graph(s)': ""},
                  {'Name': "", 'Add Graph(s)': ""}],
            page_size=pg_size,
        )

        return layout
コード例 #26
0
class Graphs:
    def __init__(self,
                 app_name,
                 graph_title,
                 graph_id,
                 slider_id,
                 top_bool,
                 app_input_state_list,
                 graph_color='Crimson',
                 time_scale='12-m',
                 anime_name="default"):
        self.jikan = Jikan()
        self.app_name = app_name
        self.graph_title = graph_title
        self.graph_id = graph_id
        self.slider_id = slider_id
        self.top_bool = top_bool
        self.app_input_state_list = app_input_state_list
        self.graph_color = graph_color
        self.time_scale = time_scale
        self.anime_name = anime_name
        self.app = DjangoDash(app_name,
                              external_stylesheets=external_stylesheets)
        self.app.layout = html.Div([
            html.H1(graph_title),
            #html.Button("Custom export", id="export_table", **{"data-dummy": ""}),
            self.return_graph(
            ),  # dcc.Graph(id=graph_id, animate=True, style={"backgroundColor": "#1a2d46", 'color': '#ffffff'})
            # html.Button("Custom export", id="export_table", **{"data-dummy": ""}),
            # dcc.Slider(
            #     id=slider_id,
            #     marks={i: '{}'.format(i) for i in range(20)},
            #     max=20,
            #     value=2,
            #     step=1,
            #     updatemode='drag',
            #     min=0,
            # ),
        ])

        self.app.clientside_callback(
            """
            function(n_clicks) {
                if (n_clicks > 0)
                    document.querySelector("#topanime a.modebar-btn").click()
                return ""
            }
            """, Output("export_table", "data-dummy"),
            [Input("export_table", "n_clicks")])

        @self.app.callback(Output(graph_id, 'figure'), app_input_state_list)
        def display_value(value):

            trendshow = TrendReq(hl='en-US', tz=360)

            kw_list = []
            if top_bool:
                for k in range(0, 5):
                    kw_list.append(self.get_top_anime_names(k, 'tv'))
            else:
                kw_list.append(self.search_anime(anime_name))
            kw_group = list(zip(*[iter(kw_list)] * 1))
            kw_grplist = [list(x) for x in kw_group]
            dic = {}
            i = 0
            for kw in kw_grplist:
                trendshow.build_payload(kw, timeframe='today 1-w', geo='')
                dic[i] = trendshow.interest_over_time()
                i += 1

            trendframe = pd.concat(dic, axis=1)
            trendframe.columns = trendframe.columns.droplevel(0)
            trendframe = trendframe.drop('isPartial', axis=1)

            trace = [
                go.Scatter(x=trendframe.index, y=trendframe[col], name=col)
                for col in trendframe.columns
            ]
            layout = dict(paper_bgcolor='#27293d',
                          plot_bgcolor='rgba(0,0,0,0)',
                          font=dict(color='white'),
                          showlegend=True)
            return {'data': trace, 'layout': layout}

    def get_top_anime_names(self, rank: int, subtype: str):
        top_anime = self.jikan.top(type='anime', page=1, subtype=subtype)
        time.sleep(0.5)
        return top_anime["top"][rank]["title"]

    def search_anime(self, anime_name):
        search = self.jikan.search('anime', anime_name)
        time.sleep(0.5)
        return search["results"][0]["title"]

    def return_graph(self):
        trendshow = TrendReq(hl='en-US', tz=360)

        kw_list = []
        if self.top_bool:
            for k in range(0, 5):
                kw_list.append(self.get_top_anime_names(k, 'tv'))
        else:
            kw_list.append(self.search_anime(self.anime_name))
        kw_group = list(zip(*[iter(kw_list)] * 1))
        kw_grplist = [list(x) for x in kw_group]
        dic = {}
        i = 0
        for kw in kw_grplist:
            trendshow.build_payload(kw,
                                    timeframe='today ' + self.time_scale,
                                    geo='')
            dic[i] = trendshow.interest_over_time()
            i += 1

        trendframe = pd.concat(dic, axis=1)
        trendframe.columns = trendframe.columns.droplevel(0)
        trendframe = trendframe.drop('isPartial', axis=1)

        fig = {
            'data': [
                go.Scatter(x=trendframe.index,
                           y=trendframe[col],
                           name=col,
                           line=dict(color=self.graph_color))
                for col in trendframe.columns
            ],
            'layout':
            dict(
                #legend=dict(font=dict(color='#7f7f7f')),
                paper_bgcolor='#27293d',
                plot_bgcolor='rgba(0,0,0,0)',
                font=dict(color='white'),
                showlegend=True)
        }

        return dcc.Graph(id=self.graph_id, figure=fig)

    def return_layout(self):
        return self.app.layout
コード例 #27
0
import bs4, urllib3, json, requests
from jikanpy import Jikan

jikan = Jikan()

base_url = "https://api.jikan.moe/v3"

search_result = jikan.search(
    'anime',
    'Bleach',
)

print(search_result)

#data  = json.loads(search_result)
#print(type(data))
コード例 #28
0
class JikanClient:
    'Class used to handle requests related to the jikan.moe API and provide anime and manga information using Jikan API wrapper'

    def __init__(self):
        pass
        self.jikan = Jikan()
        self.animeList = []
        self.mangaList = []

    #Method used to sesarch for an anime and add the first 25 anime received to our search results
    def animeSearch(self, animeName):
        self.animeList.clear()
        animeResults = self.jikan.search(query=animeName, search_type='anime')
        if (len(animeResults['results']) < 25):
            for i in animeResults['results']:
                currentAnime = (anime(i['mal_id'], i['title'], i['score'],
                                      i['airing'], i['synopsis'],
                                      i['image_url'], i['episodes']))
                self.animeList.append(currentAnime)
        else:
            for i in range(25):
                currentAnime = (anime(animeResults['results'][i]['mal_id'],
                                      animeResults['results'][i]['title'],
                                      animeResults['results'][i]['score'],
                                      animeResults['results'][i]['airing'],
                                      animeResults['results'][i]['synopsis'],
                                      animeResults['results'][i]['image_url'],
                                      animeResults['results'][i]['episodes']))
                self.animeList.append(currentAnime)

    #Return an embed to be sent for a specific anime
    def animeEmbed(self, animeIndex):
        embed = discord.Embed(title=self.animeList[animeIndex].title,
                              description=self.animeList[animeIndex].synopsis,
                              colour=discord.Colour(0x8d32e3))

        embed.set_thumbnail(url=self.animeList[animeIndex].image)
        embed.add_field(name="Rating:",
                        value=f'{self.animeList[animeIndex].rating}' + '/10',
                        inline=True)
        embed.add_field(name="Status:",
                        value=f'{self.animeList[animeIndex].status}',
                        inline=True)
        embed.add_field(name="Episodes:",
                        value=f'{self.animeList[animeIndex].episodes}',
                        inline=True)
        return embed

    #Return an embed that displasy all the anime search resutls
    def animeListDisplay(self, animeName):
        descString = ''
        for i in range(len(self.animeList)):
            descString = descString + "**" + f'{i+1}' + "**. " + self.animeList[
                i].title
            if i != len(self.animeList) - 1:
                descString = descString + "\n"

        embed = discord.Embed(title="List of anime found for '" + animeName +
                              "':",
                              description=descString,
                              colour=discord.Colour(0x8d32e3))
        #print(descString)
        return embed

    #Method used to search for a manga and add the first 25 results to our list
    def mangaSearch(self, mangaName):
        self.mangaList.clear()
        mangaResults = self.jikan.search(query=mangaName, search_type='manga')
        if (len(mangaResults['results']) < 25):
            for i in mangaResults['results']:
                currentManga = (manga(i['mal_id'], i['title'], i['score'],
                                      i['publishing'], i['synopsis'],
                                      i['image_url'], i['chapters'],
                                      i['volumes']))
                self.mangaList.append(currentManga)
        else:
            for i in range(25):
                currentManga = (manga(mangaResults['results'][i]['mal_id'],
                                      mangaResults['results'][i]['title'],
                                      mangaResults['results'][i]['score'],
                                      mangaResults['results'][i]['publishing'],
                                      mangaResults['results'][i]['synopsis'],
                                      mangaResults['results'][i]['image_url'],
                                      mangaResults['results'][i]['chapters'],
                                      mangaResults['results'][i]['volumes']))
                self.mangaList.append(currentManga)

    #Return an embed that displasy all the manga search resutls
    def mangaListDisplay(self, mangaName):
        descString = ''
        for i in range(len(self.mangaList)):
            descString = descString + "**" + f'{i+1}' + "**. " + self.mangaList[
                i].title
            if i != len(self.mangaList) - 1:
                descString = descString + "\n"

        embed = discord.Embed(title="List of manga found for '" + mangaName +
                              "':",
                              description=descString,
                              colour=discord.Colour(0x8d32e3))
        #print(descString)
        return embed

    #Return an embed to be sent for a specific manga
    def mangaEmbed(self, mangaIndex):
        embed = discord.Embed(title=self.mangaList[mangaIndex].title,
                              description=self.mangaList[mangaIndex].synopsis,
                              colour=discord.Colour(0x8d32e3))

        embed.set_thumbnail(url=self.mangaList[mangaIndex].image)
        embed.add_field(name="Rating:",
                        value=f'{self.mangaList[mangaIndex].rating}' + '/10',
                        inline=True)
        embed.add_field(name="Status:",
                        value=f'{self.mangaList[mangaIndex].status}',
                        inline=True)
        embed.add_field(name="Chapters:",
                        value=f'{self.mangaList[mangaIndex].chapters}',
                        inline=True)
        embed.add_field(name="Volumes:",
                        value=f'{self.mangaList[mangaIndex].volumes}',
                        inline=True)
        return embed
コード例 #29
0
ファイル: main.py プロジェクト: ammo414/Fuwa
def funimation(funilink):
    jikan = Jikan()
    title = funilink.replace('https://www.funimation.com/shows/',
                             '').replace('-', ' ')[:-1].strip()
    mallink = jikan.search('anime', title)['results'][0]['url']
    return mallink
コード例 #30
0
def sauce(update: Update, context: CallbackContext ):
  results = " "
  API = '1ee746dd98d9d3f2b6f366236cb35630d270cd90'
  sauce = SauceNao(api_key=API, db = 999, numres = 6)
  bot = context.bot 
  msg = update.effective_message 
  msg_id = update.effective_message.message_id 
  chat = update.effective_chat 
  reply = msg.reply_to_message
  filename_photo = "saucey.png"
  filename_gif = "saucey.gif" 
  if not reply:
    msg.reply_text("Reply to something baka...")
    return
  photo = "False"
  gif = "False"
  m = msg.reply_text("Where is my frying pan.. Ahh!! Hot Sauce-ing now!!", reply_markup = InlineKeyboardMarkup([[InlineKeyboardButton(text = "(^_-)", callback_data = "Nah")]]))
  if reply:
    if reply.photo:
      photo_id = reply.photo[-1].file_id
      photo = "True" 
    elif reply.animation:
      gif_id = reply.animation.file_id
      gif = "True" 
    elif reply.video:
      if reply.video.file_size >= 5:
        gif_id = reply.video.file_id
        gif = "True"
      else:
        m.edit_text("Ahh That is too big for setsuna, give a small sized one Nya!!")
    elif reply.sticker:
      photo_id = reply.sticker.file_id
      photo = "True" 
    else:
      m.edit_text("Nyah!!, give a gif, photo or a sticker!! ")
      return
    if photo == "True":
      file = bot.get_file(photo_id)
      dl = file.download(filename_photo)
      oo = open(dl, 'rb')
      results = sauce.from_file(oo)
      os.remove(dl)
    elif gif == "True" :
        file = bot.get_file(gif_id)
        dl = file.download(filename_gif)
        nyah = cv2.VideoCapture(dl)
        heh, nyo = nyah.read()
        cv2.imwrite("nyah.png", nyo)
        results = sauce.from_file(open("nyah.png", 'rb')) 
        nyah.release()
        os.remove(dl)
      #except Exception:
        #m.edit_text("Ahh its too big!!, Setsuna cant hanlde it Nya!")
    else:
      return
  ru = []
  rsu_1  = int(results[0].index_id) 
  rsu_2 = int(results[1].index_id)
  rsu_3 = int(results[2].index_id)
  rsu_4 = int(results[3].index_id) 
  rsu_5 = int(results[4].index_id)
  rsu_6 = int(results[5].index_id) 
  text = " "
  markup = " "
  tex_dan, url_dan, material_dan, creator_dan, source_dan, character_dan, tex_pix, mem_pix, url_pix,  anime_url, anime_title,  dan_simi, simi_pix, anime_year, anime_ep= " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "
  mal_url = "False"
  rsudan = "False"
  rsupix = "False"
  rsuAnime = "False"
  urgel = "False"
  
  if rsu_1 == 9:
    rsudan = "True"
    rsu = 0 
  elif rsu_2 == 9:
    rsudan = "True"
    rsu = 1
  elif rsu_3 == 9:
    rsudan = "True"
    rsu = 2 
  elif rsu_4 == 9:
    rsudan = "True"
    rsu = 3 
  elif rsu_5 == 9:
    rsudan = "True"
    rsu = 4 
  elif rsu_6 == 9:
    rsudan = "True"
    rsu = 5 
  else:
    print("Danboruu not found")
    
  if rsu_1 == 5:
    rsupix = "True"
    rsu2 = 0
  elif rsu_2 == 5:
    rsupix = "True"
    rsu2 = 1
  elif rsu_3 == 5:
    rsupix = "True"
    rsu2 = 2
  elif rsu_4 == 5:
    rsupix = "True"
    rsu2 = 3
  elif rsu_5 == 5:
    rsupix = "True"
    rsu2 = 4
  elif rsu_6 == 5:
    rsupix = "True"
    rsu2 = 5
  else:
    print("Pixiv not found...")
    
  if rsu_1 == 21:
    rsuAnime = "True"
    rsu3 = 0 
  elif rsu_2 == 21:
    rsuAnime = "True"
    rsu3 = 1
  elif rsu_3 == 21:
    rsuAnime = "True"
    rsu3 = 2
  elif rsu_4 == 21:
    rsuAnime = "True"
    rsu3 = 3
  elif rsu_5 == 21:
    rsuAnime = "True"
    rsu3 = 4
  elif rsu_6 == 21:
    rsuAnime = "True"
    rsu3 = 5
  else:
    print("Not found on Anime..")
    
  if rsudan == "True" :
    dan_simi = str(results[rsu].similarity)
    tex_dan = str(results[rsu].title)
    urdan = results[rsu].urls
    try:
      urgel = urdan[1]
    except IndexError:
      pass
    if len(urdan) >= 2:
      tit = urdan.pop()
    else:
      pass
    url_dan = " ".join(urdan)
    di = results[rsu].raw
    ik = di.get('data')
    if not ik == "None":
      creator_dan = ik.get('creator') 
      material_dan = ik.get('material')
      source_dan = ik.get('source')
      character_dan = ik.get('characters')
    print("Danboruu retrieving successful...")
  else:
    print("Danboruu either not found or retrieving unsuccessful")
    
  if rsuAnime == "True":
    raww = results[rsu3].raw
    anime_url = results[rsu3].urls
    try:
      anime_url = anime_url[0]
    except IndexError:
      pass 
    simi = str(results[rsu3].similarity) 
    deta = raww.get('data')
    anime_title = deta.get('source') 
    anime_ep = deta.get('part')
    anime_year = deta.get('year')
    anime_timestamp = deta.get('est_time' )
    print("Anime retrieving successful...")
    heh = Jikan()
    kek = heh.search('anime', anime_title, page=1)
    if kek:
      mal_url = kek['results'][0]['url']
    else:
      mal_url = "False"
  else:
    print("Anime not found or retrieving unsuccessful")
  
  if rsupix == "True" :
     url_pix = " ".join(results[rsu2].urls) 
     simi_pix = str(results[rsu2].similarity) 
     tex_pix = str(results[rsu2].title)
     kek = results[rsu2].raw
     ti = kek.get('data')
     if not ti == 'None':
       mem_pix = ti.get('member_name')
     pixiv = "True" 
     print("Pixiv retrieving successful...")
  else:
     print("Pixiv not found or retrieving unsuccessful")
    
  if rsuAnime == "True":
    text += f"*Title: {anime_title}\nEpisode: {anime_ep}* \n*Year Released*: `{anime_year}` \n*Timestamp:* `{anime_timestamp}`\n*Similarity:* `{simi}`"
    print(text)
    
  if rsudan == "True" :
    text += "*Title:*" + " " + f"*{tex_dan}*" + " " + "\n*Creator:*" + " " +  f"*{creator_dan}*" + "\n*Material:*" + " " + f" *{material_dan}*" + "\n*Character:*" + " " + f"*{character_dan}*" + "\n" + "*Similarity: " + " " + f"{dan_simi}*" 
    print(text)

  if rsupix == "True":
    if rsuAnime == "True":
      pass
    elif rsudan == "True":
      pass 
    else:
      text +=  "*Title:*" + " " + f"*{tex_pix}*" + "\n" +  "*Artist:*" + " " + f"*{mem_pix}*\n" + f"*Similarity: {simi_pix}*"
  
  if text == " ":
    text = "Sorry Not found!!, Setsuna sad... reeeee"
  #buttons made here 
  keybo = []
  if rsupix == "True":
    keybo.append([InlineKeyboardButton(text = "Pixiv", url = url_pix)])
  if rsudan == "True":
    if not urgel == "False":
      keybo.append([InlineKeyboardButton(text = "Danboruu", url = url_dan), InlineKeyboardButton(text = "Gelbooru", url = urgel)])
    elif url_dan == "False":
      if not urgel == "False":
        keybo.append([InlineKeyboardButton(text ="Gelbooru", url = urlgel)])
    else:
      keybo.append([InlineKeyboardButton (text = "Danboruu", url = url_dan)])
  if rsuAnime == "True":
      keybo.append([InlineKeyboardButton(text = "Anime-db", url = anime_url)])
  if not mal_url == "False":
      keybo.append([InlineKeyboardButton(text = "MAL", url = mal_url)])
  if len(keybo) >= 1:
    markup = InlineKeyboardMarkup(keybo)
    m.delete()
    msg.reply_text(text = text, reply_markup = markup, parse_mode = ParseMode.MARKDOWN)
  else:
    m.delete()
    msg.reply_text(text, parse_mode = ParseMode.MARKDOWN)