Skip to content

Commit edd925c

Browse files
Add default value to variable to fix exception handling crash (#30)
* Package updates * Simplify lookup and fix incorrect thumbnail and duration * Move to separate file * Add id to return data * Bump lodash from 4.17.11 to 4.17.15 Bumps [lodash](https://github.com/lodash/lodash) from 4.17.11 to 4.17.15. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](lodash/lodash@4.17.11...4.17.15) Signed-off-by: dependabot[bot] <support@github.com> * Encode query * Fix views * Update readme format and results * YouTube change fixes (#19) * Split up functions and add basic video renderer parsing for new youtube update * Add basic playlist parsing and return version / parser * Update version * Add basic radio renderer parsing and rename playlist property * Fix when no description for video * Add basic channel renderer parsing * Update description result example with new format * Handle 0 subscriber case for channel renderer parsing * Parse all section lists, fix verified check and add to channel renderer, show YouTube mixes uploader as YT, update live video duration and fix view count with no views * Add estimated results property to json returned by API * Add additional try/catch and logging * Only parse sections with item renderer * Add default value to sectionLists so failure doesn't crash app * Fix merging mistake lol * Update version Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent 98aa61c commit edd925c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "youtube-scrape",
3-
"version": "0.1.0",
3+
"version": "0.1.1",
44
"description": "Scrape YouTube searches",
55
"main": "server.js",
66
"author": "Herman Fassett",

scraper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ async function youtube(query, page) {
2424
json["parser"] = "json_format";
2525

2626
// Get script json data from html to parse
27-
let data, sectionLists;
27+
let data, sectionLists = [];
2828
try {
2929
data = html.substring(html.indexOf("ytInitialData") + 17);
3030
data = JSON.parse(data.substring(0, data.indexOf('window["ytInitialPlayerResponse"]') - 6));

0 commit comments

Comments
 (0)