Skip to content

Commit

Permalink
Merge pull request #402 from felipeucelli/fallback-clients
Browse files Browse the repository at this point in the history
Fix AttributeError: 'NoneType' object has no attribute 'get'
  • Loading branch information
JuanBindez authored Jan 6, 2025
2 parents 7f0cb59 + 8f62063 commit 40d6696
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 - 2024 Juan Bindez <juanbindez780@gmail.com>
Copyright (c) 2023 - 2025 Juan Bindez <juanbindez780@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
6 changes: 3 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

VERSION=8
MINOR=10
PATCH=
EXTRAVERSION="-rc1"
PATCH=0
EXTRAVERSION=""

NOTES="(#388)"
BRANCH="dev"
BRANCH="main"

if [[ -z $PATCH ]]; then
PATCH=""
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "pytubefix"
version = "8.10-rc1"
version = "8.10.0"
authors = [
{ name="Juan Bindez", email="juanbindez780@gmail.com" },
]
Expand Down
14 changes: 7 additions & 7 deletions pytubefix/__main__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2023 - 2024 Juan Bindez <juanbindez780@gmail.com>
# Copyright (c) 2023 - 2025 Juan Bindez <juanbindez780@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -428,16 +428,16 @@ def vid_info(self):
# Some clients are unable to access certain types of videos
# If the video is unavailable for the current client, attempts will be made with fallback clients
playability_status = innertube_response['playabilityStatus']
if playability_status.get('status', None) == 'UNPLAYABLE':
if 'reason' in playability_status and playability_status['reason'] == 'This video is not available':
logger.warning(f"{self.client} client returned: This video is not available")
self.client = client
self.vid_info = None
logger.warning(f"Switching to client: {client}")
if playability_status['status'] == 'UNPLAYABLE' and 'reason' in playability_status and playability_status['reason'] == 'This video is not available':
logger.warning(f"{self.client} client returned: This video is not available")
self.client = client
self.vid_info = None
logger.warning(f"Switching to client: {client}")
else:
if self.use_po_token:
self.po_token = innertube.access_po_token
self._vid_info = innertube_response
break

return self._vid_info

Expand Down
2 changes: 1 addition & 1 deletion pytubefix/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "8.10-rc1"
__version__ = "8.10.0"

if __name__ == "__main__":
print(__version__)

0 comments on commit 40d6696

Please sign in to comment.