#ifndef SCRAWLER_H
#define SCRAWLER_H

#include <QtWebKitWidgets>
#include <QSqlDatabase>
#include <QTimer>
class Client;
class SCrawler : public QObject
{
    Q_OBJECT
public:
    SCrawler();
    ~SCrawler();
    void load(QStringList _strlistArgv);
    void saveFile();
//    static void Debug(QString _strFilename,QString _strData);
    bool Debug(QString _strFilename,QString _strData);

signals:
    void finished();
private slots:
    void saveResult(bool ok);
    void killProcess();
private:
    int m_nSelect;
    //QString m_strTableReply;
    QString m_strReper;
    QString m_strKeywordID;
    QTimer *p_timer;
    QWebPage *m_page;
    QString m_strFile;
    QString m_strUrl;
    QString m_strTable;
    QString m_strFolder;

    QString m_strLocation;
    bool m_bUse;
    bool m_bLast;
    bool m_bError;
    bool m_bCrawled;

public:
    QString SqlString(QString _str);
    QString GetSafeUtf(QString _strData);
    int GetNumber(QString _str);
    int getPort(QString _strport);
    bool SendIpList(QString _str);
    void SearchChildFrame(QWebFrame *frame);
    QString getIpListFromAss(const QWebElement _FindElement);
    QString getIpListFromNordVpn(const QWebElement _FindElement);
    QString getIpListFromCyberSyndrom(const QWebElement _FindElement);
    QString getIpListFromProxylists(const QWebElement _FindElement);
    QString getIpListFromProxySpy(const QString _txt);
    QString getIpListFromProxySearcher(const QWebElement _FindElement);
    QString getIpListFromProxyListro(const QWebElement _FindElement);
    QString getIpListFromSamuir(const QWebElement _FindElement);
    QString getIpListFromNntime(const QWebElement _FindElement);
    QString getIpListFromFreeproxy(const QWebElement _FindElement);
    QString getIpListFromXroxy(const QWebElement _FindElement);
    QString getIpListFromCoolProxy(const QWebElement _FindElement);
    QString getIpListFromGatherProxy();


    QString addSource(QString _strIpList, QString _strSource);
    QWebElement Find(const QWebElement _FindElement,const QString _strElement,const QString _strAttrib,const QString _strFind);
    QWebElement FindMid(const QWebElement _FindElement,const QString _strElement,const QString _strAttrib,const QString _strFind, const int _strStart, const int _strLength);
    QWebElement FindMid(const QWebElement _FindElement,const QString _strElement,const QString _strAttrib,const QString _strFind, const int _strStart);
    QWebElement FindRight(const QWebElement _FindElement,const QString _strElement,const QString _strAttrib,const QString _strFind);
    QWebElement FindLeft(const QWebElement _FindElement,const QString _strElement,const QString _strAttrib,const QString _strFind);
    QList<QWebElement> FindAllMid(const QWebElement _FindElement,const QString _strElement,const QString _strAttrib,const QString _strFind, const int _strStart, const int _strLength);
    QWebElementCollection Finds(const QWebElement _FindElement,const QString _strElement,const QString _strAttrib,const QString _strFind);
    void UpdateError(QString _strError);

};

#endif // SCRAWLER_H
