diff --git a/README.md b/README.md index c77ff30..719862c 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ docker run -p 8080:8080 -d /youtube-scrape Here is an example call: ``` -http://youtube-scrape.herokuapp.com/api/search?q=herman%20fassett&page=1 +http://youtube-scrape.herokuapp.com/api/search?q=herman%20fassett ``` Example output: ``` diff --git a/package.json b/package.json index 03385ef..e4bd684 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "youtube-scrape", - "version": "0.1.4", + "version": "0.1.5", "description": "Scrape YouTube searches", "main": "server.js", "author": "Herman Fassett", diff --git a/scraper.js b/scraper.js index f14aa64..5114beb 100644 --- a/scraper.js +++ b/scraper.js @@ -41,9 +41,9 @@ async function youtube(query, key, pageToken) { // Get script json data from html to parse let data, sectionLists = []; try { - let match = html.match(/ytInitialData[^{]*(.*);\s*\/\/ scraper_data_end/s); + let match = html.match(/ytInitialData[^{]*(.*"adSafetyReason":[^;]*});/s); if (match && match.length > 1) { - json["parser"] += ".scraper_data"; + json["parser"] += ".object_var"; } else { json["parser"] += ".original";