Skip to content

Commit

Permalink
Quick fix for parse key removal (#51)
Browse files Browse the repository at this point in the history
* Update scraper_data match

* Update version
  • Loading branch information
HermanFassett authored Nov 25, 2020
1 parent 8b8152c commit 677fbcd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ docker run -p 8080:8080 -d <your username>/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:
```
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
4 changes: 2 additions & 2 deletions scraper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit 677fbcd

Please sign in to comment.