मैं एक सरल वेब क्रॉलर बनाया है, लेकिन मैं प्रत्यावर्तन समारोह जोड़ना चाहते हैं ताकि हर पेज खोला जाता है कि मैं इस पेज में यूआरएल प्राप्त कर सकते हैं, लेकिन मैं पता नहीं कैसे मैं ऐसा कर सकते हैं है और मैं भी चाहता हूँ बनाने के लिए धागे शामिल करने के लिए यह तेजी से यहाँ यह मेरे कोड हैसी # में सरल वेब क्रॉलर
namespace Crawler
{
public partial class Form1 : Form
{
String Rstring;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
WebRequest myWebRequest;
WebResponse myWebResponse;
String URL = textBox1.Text;
myWebRequest = WebRequest.Create(URL);
myWebResponse = myWebRequest.GetResponse();//Returns a response from an Internet resource
Stream streamResponse = myWebResponse.GetResponseStream();//return the data stream from the internet
//and save it in the stream
StreamReader sreader = new StreamReader(streamResponse);//reads the data stream
Rstring = sreader.ReadToEnd();//reads it to the end
String Links = GetContent(Rstring);//gets the links only
textBox2.Text = Rstring;
textBox3.Text = Links;
streamResponse.Close();
sreader.Close();
myWebResponse.Close();
}
private String GetContent(String Rstring)
{
String sString="";
HTMLDocument d = new HTMLDocument();
IHTMLDocument2 doc = (IHTMLDocument2)d;
doc.write(Rstring);
IHTMLElementCollection L = doc.links;
foreach (IHTMLElement links in L)
{
sString += links.getAttribute("href", 0);
sString += "/n";
}
return sString;
}
अच्छी तरह से स्कॉप्ड प्रश्न के रूप में बंद करने के लिए वोट दें। कृपया "सी # में वेब क्रॉलर" के लिए खोज और आप अधिक लक्षित होने के सवाल को परिष्कृत करने पर विचार करें। –
आप निश्चित रूप से प्रत्यावर्तन का उपयोग करने के रूप में आप स्थानीय stack.You पर इंटरनेट के राज्य धारण करने के लिए एक ढेर इस्तेमाल कर सकते हैं के रूप में टॉम सुझाव में सक्षम नहीं होगा नहीं करना चाहती है, लेकिन आप जिस क्रम में आप के लिए AbsoluteUris जोड़ने रिवर्स चाहिए क्रॉल, और ढेर की प्रकृति आप पृष्ठ के नीचे से रेंगने और आप एक क्रॉलर आप पुनः प्राप्ति व्यवहार को यथासंभव एक ब्राउज़र से मेल करने की जरूरत है लिखने के लिए जा रहे हैं होगा। एक कतार एक बेहतर विकल्प है। एक प्राथमिकता क्यूई एक बेहतर भी है। –
PriorityQueue https://svn.arachnode.net/svn/arachnodenet/trunk/Structures/PriorityQueue.cs उपयोगकर्ता नाम/पासवर्ड: सार्वजनिक/सार्वजनिक –