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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Util): Search for section instead of using indexes #39

Merged
merged 2 commits into from Dec 2, 2021

Conversation

s-montigny-desautels
Copy link
Contributor

Primary and Secondary sections is not always the indexes 0 and 1 respectively.

This patch search for the section using the in keyword to look if the section has the videoPrimaryInfoRenderer key for the primary section and the videoSecondaryInfoRenderer for the secondary section.

fix #32

src/Util.ts Outdated
@@ -354,6 +355,9 @@ class Util {
try {
const parsed = JSON.parse(html.split("var ytInitialData = ")[1].split(";</script>")[0]);
data = parsed.contents.twoColumnWatchNextResults.results.results.contents;
const fd = openSync("./result.json", "w");
Copy link
Owner

Choose a reason for hiding this comment

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

why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My bad, forgot to cleanup. It's fixed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TypeError: Cannot read properties of undefined (reading "videoOwnerRenderer")
2 participants