FIx channels

This commit is contained in:
Kevo 2022-02-27 18:20:42 +01:00
parent 167f7327c7
commit 4fe89e95fa
3 changed files with 66 additions and 6 deletions

39
tests/test_channel.py Normal file
View file

@ -0,0 +1,39 @@
from tests import CLIENT
def test_channel_by_id(channel_id: str='UCuAXFkgsw1L7xaCfnd5JJOw') -> None:
"""
Prints out information about a channel by its ID.
"""
channel = CLIENT.get_channel_by_id(channel_id)
assert channel.id == channel_id
print(f"""
Channel ID: {channel_id}
Name: {channel.name}
Description: {channel.description}
Subscriber count: {channel.subscriber_count}
""")
def test_channel_by_name(channel_name: str='SusanWojcicki') -> None:
"""
Prints out information about a channel by its ID.
"""
channel = CLIENT.get_channel_by_name(channel_name)
print(f"""
Channel ID: {channel.id}
Name: {channel.name}
Description: {channel.description}
Subscriber count: {channel.subscriber_count}
""")
if __name__ == '__main__':
test_channel_by_id()
test_channel_by_name()

View file

@ -12,7 +12,7 @@ def test_comments(video_id: str='dQw4w9WgXcQ') -> None:
np = None
while at_page < max_pages:
comments = CLIENT.get_comments(video_id, nextpage=np)
comments = CLIENT.get_comments(video_id, nextpage=np, params={'hl': 'us'})
at_page += 1
print('=' * 35, f'Page: {at_page}', '=' * 35)