YouTube: Kanal eines Videos auch über externalChannelId finden
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
3e843aea9f
commit
a3673a6042
2 changed files with 8 additions and 0 deletions
|
|
@ -91,6 +91,12 @@ class ResolveTests(TestCase):
|
|||
self.assertEqual((found['title'], found['artwork']), ('', ''))
|
||||
self.assertEqual(seen, [youtube.WATCH + 'aaaaaaaaaaa'])
|
||||
|
||||
def test_a_video_whose_details_hold_objects_still_names_its_channel(self):
|
||||
page = (f'<script>{{"channelId":"{FEATURED}"}};{{"videoDetails":{{"videoId":"aaaaaaaaaaa",'
|
||||
f'"thumbnail":{{"x":1}},"channelId":"{CHANNEL}","isOwnerViewing":false}}}}</script>')
|
||||
found, _ = self.resolve(youtube.WATCH + 'aaaaaaaaaaa', page)
|
||||
self.assertEqual(found['feed'], f'{youtube.FEED}?channel_id={CHANNEL}')
|
||||
|
||||
def test_a_playlist_has_its_own_feed(self):
|
||||
found, _ = self.resolve('https://www.youtube.com/playlist?list=PLabcdefghijk')
|
||||
self.assertEqual(found['feed'], f'{youtube.FEED}?playlist_id=PLabcdefghijk')
|
||||
|
|
|
|||
|
|
@ -38,6 +38,8 @@ _OWN_CHANNEL = (
|
|||
r'"externalId":"(UC[\w-]{22})"',
|
||||
r'<meta itemprop="identifier" content="(UC[\w-]{22})"',
|
||||
r'"videoDetails":\{[^{}]*?"channelId":"(UC[\w-]{22})"',
|
||||
r'"externalChannelId":"(UC[\w-]{22})"', # a video's owner, in its microformat
|
||||
r'"channelId":"(UC[\w-]{22})","isOwnerViewing"', # videoDetails with braces before it
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue