]> git.mxchange.org Git - friendica-addons.git/blob - retriever/templates/help.tpl
Additional work for PR 3778
[friendica-addons.git] / retriever / templates / help.tpl
1 <h2>Retriever Plugin Help</h2>
2 <p>
3 This plugin replaces the short excerpts you normally get in RSS feeds
4 with the full content of the article from the source website.  You
5 specify which part of the page you're interested in with a set of
6 rules.  When each item arrives, the plugin downloads the full page
7 from the website, extracts content using the rules, and replaces the
8 original article.
9 </p>
10 <p>
11 There's a few reasons you may want to do this.  The source website
12 might be slow or overloaded.  The source website might be
13 untrustworthy, in which case using Friendica to scrub the HTML is a
14 good idea.  You might be on a LAN that blacklists certain websites.
15 It also works neatly with the mailstream plugin, allowing you to read
16 a news stream comfortably without needing continuous Internet
17 connectivity.
18 </p>
19 <p>
20 However, setting up retriever can be quite tricky since it depends on
21 the internal design of the website.  That was designed to make life
22 easy for the website's developers, not for you.  You'll need to have
23 some familiarity with HTML, and be willing to adapt when the website
24 suddenly changes everything without notice.
25 </p>
26 <h3>Configuring Retriever for a feed</h3>
27 <p>
28 To set up retriever for an RSS feed, go to the "Contacts" page and
29 find your feed.  Then click on the drop-down menu on the contact.
30 Select "Retriever" to get to the retriever configuration.
31 </p>
32 <p>
33 The "Include" configuration section specifies parts of the page to
34 include in the article.  Each row has three components:
35 </p>
36 <ul>
37 <li>An HTML tag (e.g. "div", "span", "p")</li>
38 <li>An attribute (usually "class" or "id")</li>
39 <li>A value for the attribute</li>
40 </ul>
41 <p>
42 A simple case is when the article is wrapped in a "div" element:
43 </p>
44 <pre>
45     ...
46     &lt;div class="ArticleWrapper"&gt;
47       &lt;h2&gt;Man Bites Dog&lt;/h2&gt;
48       &lt;img src="mbd.jpg"&gt;
49       &lt;p&gt;
50         Residents of the sleepy community of Nowheresville were
51         shocked yesterday by the sight of creepy local weirdo Jim
52         McOddman assaulting innocent local dog Snufflekins with his
53         false teeth.
54       &lt;/p&gt;
55       ...
56     &lt;/div&gt;
57     ...
58 </pre>
59 <p>
60 You then specify the tag "div", attribute "class", and value
61 "ArticleWrapper".  Everything else in the page, such as navigation
62 panels and menus and footers and so on, will be discarded.  If there
63 is more than one section of the page you want to include, specify each
64 one on a separate row.  If the matching section contains some sections
65 you want to remove, specify those in the "Exclude" section in the same
66 way.
67 </p>
68 <p>
69 Once you've got a configuration that you think will work, you can try
70 it out on some existing articles.  Type a number into the
71 "Retrospectively Apply" box and click "Submit".  After a while
72 (exactly how long depends on your system's cron configuration) the new
73 articles should be available.
74 </p>
75 <h3>Techniques</h3>
76 <p>
77 You can leave the attribute and value blank to include all the
78 corresponding elements with the specified tag name.  You can also use
79 a tag name of just an asterisk ("*"), which will match any element type with the
80 specified attribute regardless of the tag.
81 </p>
82 <p>
83 Note that the "class" attribute is a special case.  Many web page
84 templates will put multiple different classes in the same element,
85 separated by spaces.  If you specify an attribute of "class" it will
86 match an element if any of its classes matches the specified value.
87 For example:
88 </p>
89 <pre>
90     &lt;div class="article breaking-news"&gt;
91 </pre>
92 <p>
93 In this case you can specify a value of "article", or "breaking-news".
94 You can also specify "article breaking-news", but that won't match if
95 the website suddenly changes to "breaking-news article", so that's not
96 recommended.
97 </p>
98 <p>
99 One useful trick you can try is using the website's "print" pages.
100 Many news sites have print versions of all their articles.  These are
101 usually drastically simplified compared to the live website page.
102 Sometimes this is a good way to get the whole article when it's
103 normally split across multiple pages.
104 </p>
105 <p>
106 Hopefully the URL for the print page is a predictable variant of the
107 normal article URL.  For example, an article URL like:
108 </p>
109 <pre>
110     http://www.newssite.com/article-8636.html
111 </pre>
112 <p>
113 ...might have a print version at:
114 </p>
115 <pre>
116     http://www.newssite.com/print/article-8636.html
117 </pre>
118 <p>
119 To change the URL used to retrieve the page, use the "URL Pattern" and
120 "URL Replace" fields.  The pattern is a regular expression matching
121 part of the URL to replace.  In this case, you might use a pattern of
122 "/article" and a replace string of "/print/article".  A common pattern
123 is simply a dollar sign ("$"), used to add the replace string to the end of the URL.
124 </p>
125 <h3>Background Processing</h3>
126 <p>
127 Note that retrieving and processing the articles can take some time,
128 so it's done in the background.  Incoming articles will be marked as
129 invisible while they're in the process of being downloaded.  If a URL
130 fails, the plugin will keep trying at progressively longer intervals
131 for up to a month, in case the website is temporarily overloaded or
132 the network is down.
133 </p>
134 <h3>Retrieving Images</h3>
135 <p>
136 Retriever can also optionally download images and store them in the
137 local Friendica instance.  Just check the "Download Images" box.  You
138 can also download images in every item from your network, whether it's
139 an RSS feed or not.  Go to the "Settings" page and
140 click <a href="$config">"Plugin settings"</a>.  Then check the "All
141 Photos" box in the "Retriever Settings" section and click "Submit".
142 </p>
143 <h2>Configure Feeds:</h2>
144 <div>
145 {{foreach $feeds as $feed}}
146 {{include file='contact_template.tpl' contact=$feed}}
147 {{/foreach}}
148 </div>