Apify Web Scraping Xiao Hong Shu: Wie kann man die Registrierung umgehen und menschlich verifizieren?Jquery

JQuery-Programmierung
Anonymous
 Apify Web Scraping Xiao Hong Shu: Wie kann man die Registrierung umgehen und menschlich verifizieren?

Post by Anonymous »

Ich versuche, von der Website aufgeführt zu werden, https://www.xiaohongshu.com/ mit einem Suchbegriff. Ich stelle jedoch fest, dass ein Pop -out angezeigt wird, dass ich mich registrieren muss, wenn eine Suche aufgerufen wird. Daher ist das Web -Scraping nicht erfolgreich und hat die gewünschten Ergebnisse nicht erzielt. mit dem folgenden Code in der Seitenfunktion. Es schaffte es jedoch nicht, erfolgreich zu verschrotten. Ich vermute, dass die Ursache auf die Registrierung zurückzuführen ist, als sie versuchte, auf die Website zuzugreifen. Ich habe vorhandene Xiao Hong Shu Scrapers aus dem Geschäft von Apify versucht, aber es hat nicht gelungen, die von mir gewünschten Auflistungsdetails zu erhalten. < /P>

Code: Select all

async function pageFunction(context) {
// This statement works as a breakpoint when you're trying to debug your code. Works only with Run mode: DEVELOPMENT!
// debugger;

// jQuery is handy for finding DOM elements and extracting data from them.
// To use it, make sure to enable the "Inject jQuery" option.
const $ = context.jQuery;
//const pageTitle = $('title').first().text();
//const itemList = $('item-list');

//const body_text_from_the_page = $('p').text();

// Print some information to actor log
//context.log.info(`URL: ${context.request.url}, TITLE: ${pageTitle}`);
//context.log.info(`print item-list, ${itemList}`);

const listings = document.querySelectorAll('.note-item'); // Each listing is within note items
const results = [];

listings.forEach(listing => {
const hrefElement = listing.querySelector('.cover mask ld');

const titleElement = listing.querySelector('.title');
const nameElement = listing.querySelector('.name');
const timeElement = listing.querySelector('.item-location span');

const href = hrefElement ? hrefElement.textContent.trim() : "N/A";
const title = titleElement ? titleElement.textContent.trim() : "N/A";
const name = nameElement ? nameElement.textContent.trim() : "N/A";
const time = timeElement ? timeElement.textContent.trim() : "N/A";

context.log.info('print', title);

results.push({
            href,
            title,
            name,
            time
});
});

return results;

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post