ScrapeAPI is a powerful and easy-to-use API for scraping Google search results of a pdf link based on the user given book name and YouTube search results based on a user-defined query.
SerpAPI and a node package youtubei is used for web scraping. SerpAPI is used for google scraping and youtubei is used for YouTube scraping.
All API requests are made via HTTP GET. The base URL for all requests is https://scrapeapi.vercel.app
.
Retrieve Google search results for a given textbook name.
Endpoint:
GET /google/search?q=YOUR_TEXTBOOK
Query Parameters:
q
(string, required): The textbook you want to search on Google.
Example Request:
GET /google?q=Samanta D., Classic Data Structures, Prentice Hall India, 2/e, 2009.
Retrieve YouTube search results for a given query.
Endpoint:
GET /youtube?q=YOUR_QUERY
Query Parameters:
q
(string, required): The query you want to search on YouTube.
Example Request:
GET /youtube?q=Applications of linked list
The response for Google search results will be in JSON format. Here is an example response:
{
"link": "Textbook pdf link"
}
The response for YouTube search results will be in JSON format. Here is an example response:
{
[
{
"id": "Result video link",
"title": "Result video title",
"thumbnails": {
"url": "Result video thumbnail",
"width": "Result video thumbnail width",
"height": "Result video thumbnail height"
}
},
{
"id": "Result video link",
"title": "Result video title",
"thumbnails": {
"url": "Result video thumbnail",
"width": "Result video thumbnail width",
"height": "Result video thumbnail height"
}
}
]
}
If there are any errors with your request, you will receive a JSON response with an error message and status code. Please refer online for a list of possible error codes and their meanings.
import axios from "axios";
# Example request to scrape Google search results
query = "Textbook name"
url = "https://scrapeapi.vercel.app/google"
#Example request to scrape YouTube search results
query = "Topic name"
url = "https://scrapeapi.vercel.app/youtube"
const response = await axios.get(url, {
params: {
q: query
},
});
if response.status == 200:
data = response.json()
# Process the data as needed
else:
print("Request failed with status code:", response.status)
If you have any questions, encounter issues, or need assistance, please raise an issue at https://github.com/nuzaim/searchserver/issues
Happy scraping with ScrapeAPI!