溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

模擬網絡爬蟲

發布時間:2020-06-20 08:50:17 來源:網絡 閱讀:200 作者:wzdouban 欄目:編程語言
/*
利用wget  指令和隊列 模擬實現網絡爬蟲
利用自己的站點wzsts.host3v.com測試了一下
有一點錯誤
文件運行后拿到index.html
對于連接僅僅可以拿到 html 和htm 結尾的 而.com的沒有考慮(設計文件可能多)
一次測試后了解到如下問題:
1.文件應該有樹形話還原網站目錄
2.文本記錄的連接應該分類化
項目運行需要 su 根權限進行 
因為mv命令
本項目僅僅適合在linux下運行
本項目給真真的linux 爬蟲做鋪墊
*/
#include<bits/stdc++.h>
using namespace std;
#include <stdlib.h>
#include <iostream>
#include <fstream>
string s("index.html");
queue<string>q;
 //略去一段
int main()
{
 //index.html
system("wget wzsts.host3v.com");

ofstream out("out.txt"); 
string mv("mv ");
string html(" html");
q.push(s);
  while(!q.empty())
   {
out<<q.front().c_str();   out<<"\n";  
if(strstr(q.front().c_str(),".html")||strstr(q.front().c_str(),".htm"))
  {
    fun(q.front().c_str()); 
    q.pop();
    string t("wget ");   t=t+s;  cout<<t.c_str()<<endl;
   system(t.c_str());
  }

string ss(q.front().c_str());
 ss=mv+ss.c_str()+html;     cout<<ss<<endl;
 system(ss.c_str());
   }

 out.close(); 
return 0;
}


向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

亚洲午夜精品一区二区_中文无码日韩欧免_久久香蕉精品视频_欧美主播一区二区三区美女