Update twistmoe.py

master
Arjix 2021-06-24 05:13:08 +03:00 committed by GitHub
parent 3c1b852e10
commit af572fdccc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 22 additions and 0 deletions

View File

@ -82,6 +82,28 @@ class TwistMoe(Anime, sitename='twist.moe'):
return self._episode_urls
def _scrape_metadata(self):
slug = self.url.split('a/')[-1][:-1]
api_url = "https://api.twist.moe/api/anime/" + slug
res = helpers.get(
api_url,
headers={
'x-access-token': '0df14814b9e590a1f26d3071a4ed7974'
}
).json()
if 'hb_id' in res:
kitsu_api_url = "https://kitsu.io/api/edge/anime/" + str(res['hb_id'])
kitsu_data = helpers.get(kitsu_api_url).json()
attributes = kitsu_data['data']['attributes']
self.meta['title'] = attributes['canonicalTitle']
self.meta['year'] = attributes['startDate'].split('-')[0]
self.meta['airing_status'] = attributes['status']
self.meta['poster'] = attributes['posterImage']['original']
self.meta['cover'] = attributes['coverImage']['original']
self.meta['total_eps'] = attributes['episodeCount']
self.meta['desc'] = attributes['description']
# From stackoverflow https://stackoverflow.com/questions/36762098/how-to-decrypt-password-from-javascript-cryptojs-aes-encryptpassword-passphras
def pad(data):
length = BLOCK_SIZE - (len(data) % BLOCK_SIZE)