1 package be
.nikiroo
.gofetch
.support
;
3 import java
.io
.IOException
;
4 import java
.io
.UnsupportedEncodingException
;
6 import java
.net
.URLDecoder
;
7 import java
.util
.AbstractMap
;
8 import java
.util
.ArrayList
;
10 import java
.util
.Map
.Entry
;
12 import org
.jsoup
.nodes
.Document
;
13 import org
.jsoup
.nodes
.Element
;
14 import org
.jsoup
.nodes
.Node
;
17 * Support <a href="https://www.7sur7.be/">https://www.7sur7.be/</a>.
21 public class SeptSurSept
extends BasicSupport
{
23 public String
getDescription() {
24 return "7sur7.be: Info, sport et showbiz, 24/24, 7/7";
28 public void login() throws IOException
{
29 addCookie("pwrefr2", "");
30 addCookie("pwv-atXMVFeyFP1Ki09i", "1");
31 addCookie("pwg-atXMVFeyFP1Ki09i", "basic");
33 addCookie("pwv", "1");
34 addCookie("pw", "functional");
36 URL url
= new URL("https://www.7sur7.be/7s7/privacy/callback.do"
37 + "?redirectUri=/" + "&pwv=1" + "&pws=functional%7Canalytics"
38 + "&days=3650" + "&referrer=");
44 protected List
<Entry
<URL
, String
>> getUrls() throws IOException
{
45 List
<Entry
<URL
, String
>> urls
= new ArrayList
<Entry
<URL
, String
>>();
46 URL url
= new URL("https://www.7sur7.be/");
47 urls
.add(new AbstractMap
.SimpleEntry
<URL
, String
>(url
, ""));
53 protected List
<Element
> getArticles(Document doc
) {
54 return doc
.getElementsByClass("clip");
58 protected String
getArticleId(Document doc
, Element article
) {
59 String id
= article
.attr("id");
60 if (id
!= null && id
.startsWith("clip")) {
61 return id
.substring("clip".length());
68 protected String
getArticleTitle(Document doc
, Element article
) {
70 return URLDecoder
.decode(article
.attr("data-title"), "UTF-8");
71 } catch (UnsupportedEncodingException e
) {
72 throw new RuntimeException("UTF-8 support mandatory in JVM");
77 protected String
getArticleAuthor(Document doc
, Element article
) {
82 protected String
getArticleDate(Document doc
, Element article
) {
83 return article
.attr("data-date");
87 protected String
getArticleCategory(Document doc
, Element article
,
88 String currentCategory
) {
89 Element parent
= article
.parent();
91 Element catElement
= parent
.previousElementSibling();
92 if (catElement
!= null) {
93 return catElement
.text();
101 protected String
getArticleDetails(Document doc
, Element article
) {
106 protected String
getArticleIntUrl(Document doc
, Element article
) {
107 return article
.absUrl("href");
111 protected String
getArticleExtUrl(Document doc
, Element article
) {
116 protected String
getArticleContent(Document doc
, Element article
) {
118 return URLDecoder
.decode(article
.attr("data-intro"), "UTF-8")
120 } catch (UnsupportedEncodingException e
) {
121 throw new RuntimeException("UTF-8 support mandatory in JVM");
126 protected Element
getFullArticle(Document doc
) {
127 return doc
.getElementById("detail_content");
131 protected ElementProcessor
getElementProcessorFullArticle() {
132 return new BasicElementProcessor() {
134 public boolean ignoreNode(Node node
) {
135 return node
.attr("class").equals("read_more")
136 || "teas_emopoll".equals(node
.attr("id"))
137 || "teas_emopoll_facebook".equals(node
.attr("id"))
138 || "soc_tools".equals(node
.attr("id"));
142 public String
isSubtitle(Node node
) {
143 if (node
instanceof Element
) {
144 Element element
= (Element
) node
;
145 if (element
.tagName().equals("strong")) {
146 return element
.text();
155 protected List
<Element
> getFullArticleCommentPosts(Document doc
, URL intUrl
) {
160 protected List
<Element
> getCommentCommentPosts(Document doc
,
166 protected String
getCommentId(Element post
) {
171 protected String
getCommentAuthor(Element post
) {
176 protected String
getCommentTitle(Element post
) {
181 protected String
getCommentDate(Element post
) {
186 protected Element
getCommentContentElement(Element post
) {
191 protected ElementProcessor
getElementProcessorComment() {
192 return new BasicElementProcessor();