वेब पर कब्जा और परिवर्तित करने के लिए उपकरण

GrabzIt के वेब स्क्रैपर एपीआई का उपयोग करके आप एक स्क्रैप को कैसे बदल सकते हैं?

वृद्धि intGrabzIt के बीच एकीकरण वेब खुरचनी और GrabzIt का उपयोग करके आपका एप्लिकेशन वेब स्क्रैपर एपीआई वेब स्क्रैप्स के गुणों को प्रोग्रामेटिक रूप से बदलने के लिए।

वेब स्क्रैप का लक्ष्य बदलें

नीचे दिया गया उदाहरण दिखाता है कि दोनों को कैसे बदला जाए बीज यूआरएल और मुख्य है लक्ष्य यूआरएल.

GrabzItScrapeClient client = new GrabzItScrapeClient("Sign in to view your Application Key", "Sign in to view your Application Secret");
Target target = new Target();
//Set the target URL
target.URL = "http://www.example.com";
List<string> seedUrls = new List<string>();
seedUrls.Add("http://www.example.com/news.html");
seedUrls.Add("http://www.example.com/about.html");
seedUrls.Add("http://www.example.com/contactus.html");
//Set the seed URL's
target.SeedURLs = seedUrls.ToArray();
//Enter the id of the scrape you want to alter along with the target object
client.SetScrapeProperty("59421f049e3d991318d35e49", target);
$client = new GrabzItScrapeClient("Sign in to view your Application Key", "Sign in to view your Application Secret");
$target = new GrabzItTarget();
//Set the target URL
$target->SetURL("http://www.example.com");
$seedUrls = array();
$seedUrls[] = "http://www.example.com/news.html";
$seedUrls[] = "http://www.example.com/about.html";
$seedUrls[] = "http://www.example.com/contactus.html";
//Set the seed URL's
$target->SetSeedURLs($seedUrls);
//Enter the id of the scrape you want to alter along with the target object
$client->SetScrapeProperty("59421f049e3d991318d35e49", $target);
client = GrabzItScrapeClient.GrabzItScrapeClient("Sign in to view your Application Key", "Sign in to view your Application Secret");
target = new GrabzItTarget.GrabzItTarget()
#Set the target URL
target.url = "http://www.example.com"
seedUrls = []
seedUrls.append("http://www.example.com/news.html")
seedUrls.append("http://www.example.com/about.html")
seedUrls.append("http://www.example.com/contactus.html")
#Set the seed URL's
target.seedURLs = seedUrls
#Enter the id of the scrape you want to alter along with the target object
client.SetScrapeProperty("59421f049e3d991318d35e49", target)

वेब स्क्रैप में एक वेरिएबल बदलें

नीचे दिए गए उदाहरणों में हम एक वेरिएबल सेट करें एक करने के लिए string नामों की सारणी, हालाँकि वेरिएबल को किसी अन्य प्रकार के सरल डेटा पर भी सेट किया जा सकता है।

GrabzItScrapeClient client = new GrabzItScrapeClient("Sign in to view your Application Key", "Sign in to view your Application Secret");
Variable variable = new Variable("names");
List<string> names = new List<string>();
names.Add("Tom");
names.Add("Dick");
names.Add("Harry");
foreach(string name in names)
{
	variable.AddArrayItem(name);
}
//Enter the id of the scrape you want to alter along with the variable object
client.SetScrapeProperty("59421f049e3d991318d35e49", variable);
$client = new GrabzItScrapeClient("Sign in to view your Application Key", "Sign in to view your Application Secret");
$variable = new GrabzItVariable("names");
$names = array();
$names[] = "Tom";
$names[] = "Dick";
$names[] = "Harry";
$variable->SetValue($names);
//Enter the id of the scrape you want to alter along with the variable object
$client->SetScrapeProperty("59421f049e3d991318d35e49", $variable);
client = GrabzItScrapeClient.GrabzItScrapeClient("Sign in to view your Application Key", "Sign in to view your Application Secret");
variable = new GrabzItVariable.GrabzItVariable("names")
names = []
names.append("Tom")
names.append("Dick")
names.append("Harry")
#Set the seed URL's
variable.value = names
#Enter the id of the scrape you want to alter along with the variable object
client.SetScrapeProperty("59421f049e3d991318d35e49", variable)

इसके बाद वैरिएबल मान को इसका उपयोग करके सामान्य तरीके से एक्सेस किया जा सकता है ग्लोबल.गेट तरीका नीचे दिखाया गया है।

var names = Global.get("names");

फिर नाम सरणी को स्क्रैप निर्देशों में सामान्य रूप से उपयोग किया जा सकता है।