-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDoubanCrawler.h
47 lines (41 loc) · 1.25 KB
/
DoubanCrawler.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#pragma once
#include <bits/stdc++.h>
#include "BaseObject.h"
#include "BaseCrawler.h"
using namespace std;
static Catcher &catcher = Catcher:: getCatcher();
static vector<DataType> DoubanMovieDataList = {
_name,
_date,
_director,
_writers,
_actors,
_labels,
_country,
_language,
_runtime,
_rating,
_awards,
_reviews,
_photos,
};
class DoubanCrawler : public BaseCrawler {
vector<DataType> TargetDataList;
vector<BaseObject*> ObjectList;
public:
BaseData* newData (DataType type);
virtual ~DoubanCrawler() {
for (auto it : ObjectList)
delete it;
}
virtual void addTargetData (const DataType &);
virtual void addObject (BaseObject*);
virtual void init();
virtual void work();
virtual vector<BaseObject*>& getObject();
virtual vector<DataType> getDatatype();
bool getData (string content, BaseData *data); // 从content中抓取处一个数据(名称、评分等)data
void readFile (const string&, string&); // 将一个文件所有内容读入字符串
void downloadPics (BaseObject *); // 将一部电影的所有剧照下载到本地
BaseObject* scanPage (const string&); // 扫描一个网页,返回一个Object,为该网页对应的电影
};