7 |
#include <iostream> |
#include <iostream> |
8 |
#include <fstream> |
#include <fstream> |
9 |
#include <iconv.h> |
#include <iconv.h> |
10 |
|
#include <stdexcept> |
11 |
#include <time.h> |
#include <time.h> |
12 |
|
|
13 |
#include "util.h" |
#include "util.h" |
121 |
} |
} |
122 |
|
|
123 |
|
|
124 |
|
string str_formatint(int i) |
125 |
|
{ |
126 |
|
std::ostringstream os; |
127 |
|
os << i; |
128 |
|
return os.str(); |
129 |
|
} |
130 |
|
|
131 |
|
|
132 |
string str_characters(string str) |
string str_characters(string str) |
133 |
{ |
{ |
134 |
string rep; |
string rep; |
185 |
string document; |
string document; |
186 |
|
|
187 |
ostringstream command; |
ostringstream command; |
188 |
command << "wget -O " << tempfile << " -o /dev/null \"" << url << "\""; |
command << "wget -O " << tempfile << " --tries=1 --timeout=15 -o /dev/null \"" << url << "\""; |
189 |
system( command.str().c_str() ); |
int res = system( command.str().c_str() ); |
190 |
|
if (res) |
191 |
|
throw std::runtime_error("Command time out"); |
192 |
|
|
193 |
ifstream in( tempfile.c_str() ); |
ifstream in( tempfile.c_str() ); |
194 |
|
|