Scraping APIविशेषताएँस्क्रैप शोपी

Shopee वेबसाइट डेटा स्क्रैपिंग

पैरामीटर व्याख्या

पैरामीटरप्रकारमानवर्णन
actorstringscraper.shopeeनिश्चित प्रविष्टि
input.actionstringshopee.productतीन प्रकारों का समर्थन करता है
  1. shopee.product उत्पाद विवरण डेटा प्राप्त करें
  2. shopee.search कीवर्ड खोज डेटा
  3. shopee.live लाइव संबंधित डेटा | | input.url | string | URL लिंक | चार प्रकार के URL लिंक का समर्थन करता है
  4. उत्पाद विवरण पृष्ठ का URL लिंक
  5. उत्पाद विवरण पृष्ठ का API लिंक (/api/v4/pdp/get_pc)
  6. उत्पाद खोज के लिए API लिंक (/api/v4/search/search_items)
  7. लाइव प्रसारण के लिए API लिंक (/api/v1/session/{sessionId}/more_items) |

उत्पाद विवरण डेटा

import { Scrapeless } from '@scrapeless-ai/sdk';
 
const client = new Scrapeless({
  apiKey: 'YOUR_API_KEY'
});
 
client.scraping.createTask({
   actor: "scraper.shopee",
   input: {
      action: "shopee.product",
      url: "https://shopee.tw/2312312.10228173.24803858474"
   }
}).then(async (result) => {
    console.log(result);
  })
  .catch((error) => {
    console.error('Error:', error);
  });

उत्पाद खोज डेटा

import { Scrapeless } from '@scrapeless-ai/sdk';
 
const client = new Scrapeless({
  apiKey: 'YOUR_API_KEY'
});
 
client.scraping.createTask({
   actor: "scraper.shopee",
   input: {
      action: "shopee.search",
      url: "https://shopee.co.th/api/v4/search/search_items?by=sales&keyword=baby%20pants&limit=30&newest=0&order=desc&page_type=search"
   }
}).then(async (result) => {
    console.log(result);
  })
  .catch((error) => {
    console.error('Error:', error);
  });

लाइव डेटा

import { Scrapeless } from '@scrapeless-ai/sdk';
 
const client = new Scrapeless({
  apiKey: 'YOUR_API_KEY'
});
 
const sessionId = "";
client.scraping.createTask({
   actor: "scraper.shopee",
   input: {
      action: "shopee.live",
      url: `https://live.shopee.co.th/api/v1/session/${sessionId}/more_items?offset=0&limit=10`
   }
}).then(async (result) => {
    console.log(result);
  })
  .catch((error) => {
    console.error('Error:', error);
  });

API लिंक कैसे बनाएँ

उत्पाद विवरण पृष्ठ API

# API को तीन भागों में विभाजित किया जा सकता है
# 1. क्षेत्र
# 2. item_id
# 3. shop_id
 
# समर्थित क्षेत्र सूची
# ["shopee.co.id", "shopee.vn", "shopee.co.th", "shopee.ph", "shopee.com.my", "shopee.sg", "shopee.com.co", "shopee.cl", "shopee.com.mx", "shopee.com.br", "shopee.tw"]
 
url = f"https://{region}/api/v4/pdp/get_pc?item_id={item_id}&shop_id={shop_id}"
print(url)

उत्पाद खोज API

limit = 20  # 10 20 30 40
order = "desc"
page_type = "search"
keyword = "keyword"   # इसे संपादित करें
region = "shopee.co.id"
 
# समर्थित क्षेत्र सूची
# ["shopee.co.id", "shopee.vn", "shopee.co.th", "shopee.ph", "shopee.com.my", "shopee.sg", "shopee.com.co", "shopee.cl", "shopee.com.mx", "shopee.com.br", "shopee.tw"]
 
url = f"https://{region}/api/v4/search/search_items?limit={limit}&newest=0&by=sales&keyword={keyword}&order={order}&page_type={page_type}&scenario=PAGE_OTHERS&version=2"
print(url)

TaskId के माध्यम से कार्य परिणाम प्राप्त करें

import requests
 
API_KEY = ""
host = "api.scrapeless.com"
task_id = ""
 
url = f"https://{host}/api/v1/scraper/result/{task_id}"
 
headers = {
   'x-api-token': f'{API_KEY}'
}
 
response = requests.request("GET", url, headers=headers)
 
print(response.text)