* [TwitterBridge] Get cookies before sending request
Twitter now requires cookies to be set before requesting a page. This will fetch the cookies and send them to `getSimpleHTMLDOM()`.
* Formatting fixes
This reverts commit 052844f5e1.
There is a bug in ->remove() that causes the parser to incorrectly
identify elements in the DOM tree that shouldn't exist anymore.
References #1151
simplehtmldom 1.9 introduced new functions to recursively remove
nodes from the DOM. This allows removing elements without the need
to re-load the document by using $html->load($html->save()), which
is very inefficient.
Find more information about remove() at
https://simplehtmldom.sourceforge.io/docs/1.9/api/simple_html_dom_node/remove/
Images in Twitter feeds are currently being scaled by adding ':orig'
(original image) and ':thumb' (thumbnail) to image URIs in the feed.
This can cause issues with feed readers that don't handle colons in
URIs correctly.
Image scaling can now be disabled by adding '&noimgscaling=on' to the
query. This parameter is optional to stay compatible to existing feeds.
References #957
* core: Add bridge parameter auto detection
This adds a new 'detect' action which accepts a URL from which an
appropriate bridge is selected and relevant parameters are extracted.
The user is then automatically redirected to the selected bridge.
For example to get a feed from: https://twitter.com/search?q=%23rss-bridge
we could send a request to:
'/?action=detect&format=Atom&url=twitter.com/search%3Fq%3D%2523rss-bridge'
which would redirect to:
'/?action=display&q=%23rss-bridge&bridge=Twitter&format=Atom'.
This auto detection happens on a per-bridge basis, so a new function
'detectParameters' is added to BridgeInterface which bridges may implement.
It takes a URL for an argument and returns a list of parameters that were
extracted, or null if the URL isn't relevant for the bridge.
* [TwitterBridge] Add parameter auto detection
* [BridgeAbstract] Add generic parameter detection
This adds generic "paramater detection" for bridges that don't have any
parameters defined. If the queried URL matches the URI defined in the
bridge (ignoring https://, www. and trailing /) an emtpy list of parameters is
returned.
- Do not add spaces after opening or before closing parenthesis
// Wrong
if( !is_null($var) ) {
...
}
// Right
if(!is_null($var)) {
...
}
- Add space after closing parenthesis
// Wrong
if(true){
...
}
// Right
if(true) {
...
}
- Add body into new line
- Close body in new line
// Wrong
if(true) { ... }
// Right
if(true) {
...
}
Notice: Spaces after keywords are not detected:
// Wrong (not detected)
// -> space after 'if' and missing space after 'else'
if (true) {
...
} else{
...
}
// Right
if(true) {
...
} else {
...
}
The title attribute includes tags (anchors) instead of raw text.
While this works fine in a browser, using a raw format like plain-
text or json breaks with expected behavior.
This commit changes the order in which functions are applied. By re-
moving anchors AFTER fixing the title, the final result does not
include tags and the title is still fixed.
This bug was introduced by d81b61ccfa
References: #546
Twitter now requires login to access "Tweets & Replies" which
breaks feeds using the default behavior. Using the "Without
replies" option still works.
This commit makes the "Without replies" option default. That way
existing feeds will return contents again. The parameter can still
be checked but its status has no effect anymore.
Notice: The parameter should not be removed as that would cause
any feed using the parameter to stop working because of "Invalid
parameter"
References #544
This commit improves readability of tweets by adding spaces before
anchors in the text.
- Hide "invisible" tags which were not rendered hidden because of
missing CSS.
- Fix spacing between anchors
Reported via #539
Twitter provides an easy way to receive various image sizes based
on the same image URI:
https://dev.twitter.com/overview/api/entities-in-twitter-objects
We support different sizes: thumb, small, medium and large. The
media_url defaults to medium but you can retrieve the media in
different sizes by appending a colon + the size key (for example:
https://pbs.twimg.com/media/A7EiDWcCYAAZT1D.jpg:thumb).
-- Twitter Developer Documentation
TwitterBridge now makes use of this feature in order to provide
thumbnail images in the content and original sized images as
enclosures.
References #526
This adds new features to show quotes and pictures in feeds.
Quotes will show up on top of a tweet and are separated from
the quoting feed by a horizontal line.
Pictures that are embedded in the tweet will be captured and
attached to the feed using enclosures. By default the picture
will also be shown in the feed itself. This can be disabled
using the option '&noimg=on'
Some codes are now split into separate functions so they can be used
for tweets and quotes alike.
Maintainer should be set for all bridges. Using git blame to
determine who provided the most code to the files. This is
obviously not a good solution, feel free to insert own names
- returnError, returnServerError, returnClientError ,debugMessage are
moved to lib/error.php
- getContents, getSimpleHTMLDOM, getSimpleHTMLDOMCached are moved to
lib/contents.php
Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
Inputs are not stored in BridgeAbstract::$parameters anymore to separate
static data from dynamic data.
The getInput method allows for more readable code.
Also fix an "undefined index 'global'" notice
Probability of breaking bridges: high !
Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
if a bridge needs to modify some of the data that were initialized
there, ::__construct() should be used instead.
Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>