1.0.4 release
- Update version number - Added check for `skip-event` AKA chapters endpoint for 200 (OK) status code before attempting to get chapters, if not 200, return empty chapters
This commit is contained in:
parent
c4ceb2fe92
commit
b553865ff5
@ -25,7 +25,7 @@ class CR(Service):
|
|||||||
"""
|
"""
|
||||||
Service code for Crunchyroll
|
Service code for Crunchyroll
|
||||||
Author: TPD94
|
Author: TPD94
|
||||||
Version: 1.0.3
|
Version: 1.0.4
|
||||||
Authorization: Cookies for web endpoints, Credentials for TV endpoints, Cookies/Credentials for both. Cookies required.
|
Authorization: Cookies for web endpoints, Credentials for TV endpoints, Cookies/Credentials for both. Cookies required.
|
||||||
Security: FHD@L3
|
Security: FHD@L3
|
||||||
Use Series ID/URL (for example - https://www.crunchyroll.com/series/GG5H5XQ7D/kaiju-no-8) or Series ID (for example - GG5H5XQ7D).
|
Use Series ID/URL (for example - https://www.crunchyroll.com/series/GG5H5XQ7D/kaiju-no-8) or Series ID (for example - GG5H5XQ7D).
|
||||||
@ -36,7 +36,7 @@ class CR(Service):
|
|||||||
help="""
|
help="""
|
||||||
Service code for Crunchyroll\n
|
Service code for Crunchyroll\n
|
||||||
Author: TPD94\n
|
Author: TPD94\n
|
||||||
Version: 1.0.3\n
|
Version: 1.0.4\n
|
||||||
Authorization: Cookies for web endpoints, Credentials for TV endpoints, Cookies/Credentials for both. Cookies required.\n
|
Authorization: Cookies for web endpoints, Credentials for TV endpoints, Cookies/Credentials for both. Cookies required.\n
|
||||||
Security: FHD@L3\n
|
Security: FHD@L3\n
|
||||||
Use Series ID/URL (for example - https://www.crunchyroll.com/series/GG5H5XQ7D/kaiju-no-8) or Series ID (for example - GG5H5XQ7D).
|
Use Series ID/URL (for example - https://www.crunchyroll.com/series/GG5H5XQ7D/kaiju-no-8) or Series ID (for example - GG5H5XQ7D).
|
||||||
@ -542,55 +542,57 @@ class CR(Service):
|
|||||||
# Send GET request for the chapters
|
# Send GET request for the chapters
|
||||||
chapter_response = self.session.get(
|
chapter_response = self.session.get(
|
||||||
url=self.config['endpoints']['chapters'].format(episode=title.id),
|
url=self.config['endpoints']['chapters'].format(episode=title.id),
|
||||||
).json()
|
)
|
||||||
|
|
||||||
# Check for intro chapter
|
if chapter_response.status_code == 200:
|
||||||
if chapter_response.get('intro'):
|
chapter_response = chapter_response.json()
|
||||||
try:
|
# Check for intro chapter
|
||||||
# Add the chapter, may not exist
|
if chapter_response.get('intro'):
|
||||||
chapters.add(Chapter(
|
try:
|
||||||
timestamp=chapter_response['intro']['start'] * 1000,
|
# Add the chapter, may not exist
|
||||||
name=chapter_response['intro']['type'].capitalize(),
|
chapters.add(Chapter(
|
||||||
))
|
timestamp=chapter_response['intro']['start'] * 1000,
|
||||||
# If it doesn't exist, move on to the next
|
name=chapter_response['intro']['type'].capitalize(),
|
||||||
except:
|
))
|
||||||
pass
|
# If it doesn't exist, move on to the next
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
# Check for the credits chapter
|
# Check for the credits chapter
|
||||||
if chapter_response.get('credits'):
|
if chapter_response.get('credits'):
|
||||||
try:
|
try:
|
||||||
# Add the chapter, may not exist
|
# Add the chapter, may not exist
|
||||||
chapters.add(Chapter(
|
chapters.add(Chapter(
|
||||||
timestamp=chapter_response['credits']['start'] * 1000,
|
timestamp=chapter_response['credits']['start'] * 1000,
|
||||||
name=chapter_response['credits']['type'].capitalize(),
|
name=chapter_response['credits']['type'].capitalize(),
|
||||||
))
|
))
|
||||||
# If it doesn't exist, move on to the next
|
# If it doesn't exist, move on to the next
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# Check for the preview chapter
|
# Check for the preview chapter
|
||||||
if chapter_response.get('preview'):
|
if chapter_response.get('preview'):
|
||||||
try:
|
try:
|
||||||
# Add the chapter, may not exist
|
# Add the chapter, may not exist
|
||||||
chapters.add(Chapter(
|
chapters.add(Chapter(
|
||||||
timestamp=chapter_response['preview']['start'] * 1000,
|
timestamp=chapter_response['preview']['start'] * 1000,
|
||||||
name=chapter_response['preview']['type'].capitalize(),
|
name=chapter_response['preview']['type'].capitalize(),
|
||||||
))
|
))
|
||||||
# If it doesn't exist, move on to the next
|
# If it doesn't exist, move on to the next
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# Check for recap chapter
|
# Check for recap chapter
|
||||||
if chapter_response.get('recap'):
|
if chapter_response.get('recap'):
|
||||||
try:
|
try:
|
||||||
# Add the chapter, may not exist
|
# Add the chapter, may not exist
|
||||||
chapters.add(Chapter(
|
chapters.add(Chapter(
|
||||||
timestamp=chapter_response['recap']['start'] * 1000,
|
timestamp=chapter_response['recap']['start'] * 1000,
|
||||||
name=chapter_response['recap']['type'].capitalize(),
|
name=chapter_response['recap']['type'].capitalize(),
|
||||||
))
|
))
|
||||||
# If it doesn't exist, move on to return statement
|
# If it doesn't exist, move on to return statement
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# Return the chapters
|
# Return the chapters
|
||||||
return chapters
|
return chapters
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user