remwharead  0.6.3
uri.hpp
1 /* This file is part of remwharead.
2  * Copyright © 2019 tastytea <tastytea@tastytea.de>
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, version 3.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #ifndef REMWHAREAD_URI_HPP
18 #define REMWHAREAD_URI_HPP
19 
20 #include <string>
21 #include <curlpp/Easy.hpp>
22 
23 namespace remwharead
24 {
25  using std::string;
26 
27  typedef struct html_extract
28  {
29  string title;
30  string description;
31  string fulltext;
32  } html_extract;
33 
34  class URI
35  {
36  public:
37  explicit URI(const string &uri);
38 
40  const html_extract get();
42  const string archive();
43 
44  protected:
45  string _uri;
46 
47  void set_curlpp_options(curlpp::Easy &request);
48  const string extract_title(const string &html);
49  const string extract_description(const string &html);
50  const string strip_html(const string &html);
52  const string remove_html_tags(const string &html,
53  const string &tag = "");
54  const string unescape_html(const string &html);
56  const string remove_newlines(string text);
57  };
58 }
59 
60 #endif // REMWHAREAD_URI_HPP
Definition: uri.hpp:27
const string remove_html_tags(const string &html, const string &tag="")
Remove all HTML tags. If tag is not empty, remove only this tag.
Definition: uri.cpp:137
Definition: search.cpp:23
const string remove_newlines(string text)
Replace newlines with spaces.
Definition: uri.cpp:514
Definition: uri.hpp:34
const string archive()
Save URI in archive and return URI.
Definition: uri.cpp:475