Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ie/polskieradio] Fixed issue #8419 #8459

Merged
merged 2 commits into from
Oct 28, 2023
Merged

[ie/polskieradio] Fixed issue #8419 #8459

merged 2 commits into from
Oct 28, 2023

Conversation

shubhexists
Copy link
Contributor

@shubhexists shubhexists commented Oct 28, 2023

IMPORTANT: PRs without the template will be CLOSED

Description of your pull request and other information

This a a site-fix code.
Changes made in polskieradio.py .
This PR fixes the issue of skipping the first page of the site as reported in the linked issue.

Fixes #8419

Template

Before submitting a pull request make sure you have:

In order to be accepted and merged into yt-dlp each piece of code must be in public domain or released under Unlicense. Check all of the following options that apply:

  • I am the original author of this code and I am willing to release it under Unlicense
  • I am not the original author of this code but it is in public domain or released under Unlicense (provide reliable evidence)

What is the purpose of your pull request?

Copilot Summary

馃 Generated by Copilot at bc45707

Summary

馃悰馃搫馃殌

Fix missing first page of auditions in polskieradio extractor by using zero-based page numbers.

itertools.count
zero-based page number fix
autumn leaves no gaps

Walkthrough

  • Fix missing first page of articles by changing the starting index of itertools.count to 0 (link)

@garret1317 garret1317 added the site-bug Issue with a specific website label Oct 28, 2023
Copy link
Member

@bashonly bashonly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should do it for the episodes, too, and adjust the page count in the output

diff --git a/yt_dlp/extractor/polskieradio.py b/yt_dlp/extractor/polskieradio.py
index 5bf92b9b5..e0b22fffd 100644
--- a/yt_dlp/extractor/polskieradio.py
+++ b/yt_dlp/extractor/polskieradio.py
@@ -262,14 +262,14 @@ def _call_lp3(self, path, query, video_id, note):
             query=query, headers={'x-api-key': '9bf6c5a2-a7d0-4980-9ed7-a3f7291f2a81'})
 
     def _entries(self, playlist_id, has_episodes, has_articles):
-        for i in itertools.count(1) if has_episodes else []:
+        for i in itertools.count(0) if has_episodes else []:
             page = self._call_lp3(
                 'AudioArticle/GetListByCategoryId', {
                     'categoryId': playlist_id,
                     'PageSize': 10,
                     'skip': i,
                     'format': 400,
-                }, playlist_id, f'Downloading episode list page {i}')
+                }, playlist_id, f'Downloading episode list page {i + 1}')
             if not traverse_obj(page, 'data'):
                 break
             for episode in page['data']:
@@ -281,14 +281,14 @@ def _entries(self, playlist_id, has_episodes, has_articles):
                     'timestamp': parse_iso8601(episode.get('datePublic')),
                 }
 
-        for i in itertools.count(1) if has_articles else []:
+        for i in itertools.count(0) if has_articles else []:
             page = self._call_lp3(
                 'Article/GetListByCategoryId', {
                     'categoryId': playlist_id,
                     'PageSize': 9,
                     'skip': i,
                     'format': 400,
-                }, playlist_id, f'Downloading article list page {i}')
+                }, playlist_id, f'Downloading article list page {i + 1}')
             if not traverse_obj(page, 'data'):
                 break
             for article in page['data']:

@bashonly bashonly added the pending-fixes PR has had changes requested label Oct 28, 2023
@bashonly bashonly changed the title Fixed issue #8419 [ie/polskieradio] Fixed issue #8419 Oct 28, 2023
@shubhexists
Copy link
Contributor Author

Got it! I'll fix this and upload a PR after some time.

Copy link
Member

@bashonly bashonly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you also update the PolskieRadioAuditionIE tests so that we have correct counts, please?

@bashonly bashonly removed the pending-fixes PR has had changes requested label Oct 28, 2023
@bashonly bashonly self-assigned this Oct 28, 2023
@shubhexists
Copy link
Contributor Author

Can you brief what exactly in tests do I need to update? Count seems to be working fine only.

@bashonly
Copy link
Member

ah nvm, I guess these playlists are constantly being appended to anyways so it doesn't make a difference

@bashonly bashonly merged commit 464327a into yt-dlp:master Oct 28, 2023
16 checks passed
aalsuwaidi pushed a commit to aalsuwaidi/yt-dlp that referenced this pull request Apr 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
site-bug Issue with a specific website
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[polskieradio] Download skips first nine files in playlist.
3 participants