mirror of
https://github.com/YuzuZensai/play-dl-test.git
synced 2026-01-31 14:58:05 +00:00
YouTube is closing soon.....
This commit is contained in:
10
node-youtube-dl/YouTube/search.ts
Normal file
10
node-youtube-dl/YouTube/search.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { url_get } from "./utils/request";
|
||||
import fs from 'fs'
|
||||
|
||||
|
||||
export async function search(url:string, options? : {limit : number}) {
|
||||
let body = await url_get(url)
|
||||
let json_convert = body.split("var ytInitialData = ")[1].split(";</script>")[0]
|
||||
let result = JSON.parse(json_convert).contents.twoColumnSearchResultsRenderer.primaryContents.sectionListRenderer.contents[0].itemSectionRenderer.contents
|
||||
console.log(result.length)
|
||||
}
|
||||
Reference in New Issue
Block a user