7s7: description change (add a ":")
[gofetch.git] / src / be / nikiroo / gofetch / support / SeptSurSept.java
1 package be.nikiroo.gofetch.support;
2
3 import java.io.IOException;
4 import java.net.URL;
5 import java.util.AbstractMap;
6 import java.util.ArrayList;
7 import java.util.List;
8 import java.util.Map.Entry;
9
10 import org.jsoup.nodes.Document;
11 import org.jsoup.nodes.Element;
12 import org.jsoup.nodes.Node;
13
14 /**
15 * Support <a href="https://www.7sur7.be/">https://www.7sur7.be/</a>.
16 *
17 * @author niki
18 */
19 public class SeptSurSept extends BasicSupport {
20 @Override
21 public String getDescription() {
22 return "7sur7.be: Info, sport et showbiz, 24/24, 7/7";
23 }
24
25 @Override
26 public void login() throws IOException {
27 addCookie("pwrefr2", "");
28 addCookie("pwv-atXMVFeyFP1Ki09i", "1");
29 addCookie("pwg-atXMVFeyFP1Ki09i", "basic");
30
31 addCookie("pwv", "1");
32 addCookie("pw", "functional");
33
34 URL url = new URL("https://www.7sur7.be/7s7/privacy/callback.do"
35 + "?redirectUri=/" + "&pwv=1" + "&pws=functional%7Canalytics"
36 + "&days=3650" + "&referrer=");
37
38 open(url).close();
39 }
40
41 @Override
42 protected List<Entry<URL, String>> getUrls() throws IOException {
43 List<Entry<URL, String>> urls = new ArrayList<Entry<URL, String>>();
44 URL url = new URL("https://www.7sur7.be/");
45 urls.add(new AbstractMap.SimpleEntry<URL, String>(url, ""));
46
47 return urls;
48 }
49
50 @Override
51 protected List<Element> getArticles(Document doc) {
52 return doc.getElementsByClass("clip");
53 }
54
55 @Override
56 protected String getArticleId(Document doc, Element article) {
57 String id = article.attr("id");
58 if (id != null && id.startsWith("clip")) {
59 return id.substring("clip".length());
60 }
61
62 return null;
63 }
64
65 @Override
66 protected String getArticleTitle(Document doc, Element article) {
67 return article.attr("data-title");
68 }
69
70 @Override
71 protected String getArticleAuthor(Document doc, Element article) {
72 return "";
73 }
74
75 @Override
76 protected String getArticleDate(Document doc, Element article) {
77 return article.attr("data-date");
78 }
79
80 @Override
81 protected String getArticleCategory(Document doc, Element article,
82 String currentCategory) {
83 Element parent = article.parent();
84 if (parent != null) {
85 Element catElement = parent.previousElementSibling();
86 if (catElement != null) {
87 return catElement.text();
88 }
89 }
90
91 return "";
92 }
93
94 @Override
95 protected String getArticleDetails(Document doc, Element article) {
96 return "";
97 }
98
99 @Override
100 protected String getArticleIntUrl(Document doc, Element article) {
101 return article.absUrl("href");
102 }
103
104 @Override
105 protected String getArticleExtUrl(Document doc, Element article) {
106 return "";
107 }
108
109 @Override
110 protected String getArticleContent(Document doc, Element article) {
111 return article.attr("data-intro").trim();
112 }
113
114 @Override
115 protected Element getFullArticle(Document doc) {
116 return doc.getElementById("detail_content");
117 }
118
119 @Override
120 protected ElementProcessor getElementProcessorFullArticle() {
121 return new BasicElementProcessor() {
122 @Override
123 public boolean ignoreNode(Node node) {
124 return node.attr("class").equals("read_more")
125 || "teas_emopoll".equals(node.attr("id"))
126 || "teas_emopoll_facebook".equals(node.attr("id"))
127 || "soc_tools".equals(node.attr("id"));
128 }
129
130 @Override
131 public String isSubtitle(Node node) {
132 if (node instanceof Element) {
133 Element element = (Element) node;
134 if (element.tagName().equals("strong")) {
135 return element.text();
136 }
137 }
138 return null;
139 }
140 };
141 }
142
143 @Override
144 protected List<Element> getFullArticleCommentPosts(Document doc, URL intUrl) {
145 return null;
146 }
147
148 @Override
149 protected List<Element> getCommentCommentPosts(Document doc,
150 Element container) {
151 return null;
152 }
153
154 @Override
155 protected String getCommentId(Element post) {
156 return null;
157 }
158
159 @Override
160 protected String getCommentAuthor(Element post) {
161 return null;
162 }
163
164 @Override
165 protected String getCommentTitle(Element post) {
166 return null;
167 }
168
169 @Override
170 protected String getCommentDate(Element post) {
171 return null;
172 }
173
174 @Override
175 protected Element getCommentContentElement(Element post) {
176 return null;
177 }
178
179 @Override
180 protected ElementProcessor getElementProcessorComment() {
181 return null;
182 }
183 }