|
| 1 | +import math |
| 2 | +import time |
| 3 | +import requests |
| 4 | +import json |
| 5 | +import asyncio |
| 6 | +from pyrogram import filters |
| 7 | +from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton |
| 8 | + |
| 9 | +# time formatter from uniborg |
| 10 | +def t(milliseconds: int) -> str: |
| 11 | + """Inputs time in milliseconds, to get beautified time, |
| 12 | + as string""" |
| 13 | + seconds, milliseconds = divmod(int(milliseconds), 1000) |
| 14 | + minutes, seconds = divmod(seconds, 60) |
| 15 | + hours, minutes = divmod(minutes, 60) |
| 16 | + days, hours = divmod(hours, 24) |
| 17 | + tmp = ((str(days) + " Days, ") if days else "") + \ |
| 18 | + ((str(hours) + " Hours, ") if hours else "") + \ |
| 19 | + ((str(minutes) + " Minutes, ") if minutes else "") + \ |
| 20 | + ((str(seconds) + " Seconds, ") if seconds else "") + \ |
| 21 | + ((str(milliseconds) + " ms, ") if milliseconds else "") |
| 22 | + return tmp[:-2] |
| 23 | + |
| 24 | + |
| 25 | +airing_query = ''' |
| 26 | + query ($id: Int,$search: String) { |
| 27 | + Media (id: $id, type: ANIME,search: $search) { |
| 28 | + id |
| 29 | + episodes |
| 30 | + title { |
| 31 | + romaji |
| 32 | + english |
| 33 | + native |
| 34 | + } |
| 35 | + siteUrl |
| 36 | + nextAiringEpisode { |
| 37 | + airingAt |
| 38 | + timeUntilAiring |
| 39 | + episode |
| 40 | + } |
| 41 | + } |
| 42 | + } |
| 43 | + ''' |
| 44 | + |
| 45 | +fav_query = """ |
| 46 | +query ($id: Int) { |
| 47 | + Media (id: $id, type: ANIME) { |
| 48 | + id |
| 49 | + title { |
| 50 | + romaji |
| 51 | + english |
| 52 | + native |
| 53 | + } |
| 54 | + } |
| 55 | +} |
| 56 | +""" |
| 57 | + |
| 58 | +anime_query = ''' |
| 59 | + query ($id: Int,$search: String) { |
| 60 | + Media (id: $id, type: ANIME,search: $search) { |
| 61 | + id |
| 62 | + idMal |
| 63 | + title { |
| 64 | + romaji |
| 65 | + english |
| 66 | + native |
| 67 | + } |
| 68 | + description (asHtml: false) |
| 69 | + startDate{ |
| 70 | + year |
| 71 | + } |
| 72 | + episodes |
| 73 | + season |
| 74 | + type |
| 75 | + format |
| 76 | + status |
| 77 | + duration |
| 78 | + siteUrl |
| 79 | + studios{ |
| 80 | + nodes{ |
| 81 | + name |
| 82 | + } |
| 83 | + } |
| 84 | + trailer{ |
| 85 | + id |
| 86 | + site |
| 87 | + thumbnail |
| 88 | + } |
| 89 | + averageScore |
| 90 | + genres |
| 91 | + bannerImage |
| 92 | + } |
| 93 | + } |
| 94 | +''' |
| 95 | +character_query = """ |
| 96 | + query ($query: String) { |
| 97 | + Character (search: $query) { |
| 98 | + id |
| 99 | + name { |
| 100 | + first |
| 101 | + last |
| 102 | + full |
| 103 | + } |
| 104 | + siteUrl |
| 105 | + favourites |
| 106 | + image { |
| 107 | + large |
| 108 | + } |
| 109 | + description |
| 110 | + } |
| 111 | + } |
| 112 | +""" |
| 113 | + |
| 114 | +manga_query = """ |
| 115 | +query ($id: Int,$search: String) { |
| 116 | + Media (id: $id, type: MANGA,search: $search) { |
| 117 | + id |
| 118 | + title { |
| 119 | + romaji |
| 120 | + english |
| 121 | + native |
| 122 | + } |
| 123 | + description (asHtml: false) |
| 124 | + startDate{ |
| 125 | + year |
| 126 | + } |
| 127 | + type |
| 128 | + format |
| 129 | + status |
| 130 | + siteUrl |
| 131 | + averageScore |
| 132 | + genres |
| 133 | + bannerImage |
| 134 | + } |
| 135 | + } |
| 136 | +""" |
| 137 | + |
| 138 | + |
| 139 | +url = 'https://graphql.anilist.co' |
0 commit comments