Replaces links to twitter.com an "x.com" to a nitter server #1461
No reviewers
Labels
No labels
2018.09
2019.01
2019.03
2019.06
2019.09
2019.12
2020.03
2020.06
2020.09
2020.12
2021.03
2021.07
2021.09
2022.02
2022.06
2022.09
2022.12
2023.04
2023.05
2023.09
2024.03
2024.06
2024.09
2024.12
dependencies
Hackathon 2021
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: friendica/friendica-addons#1461
Loading…
Reference in a new issue
No description provided.
Delete branch "(deleted):develop"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
In the meantime, links are increasingly being shared on x.com instead of twitter.com. The addon has not yet been able to capture links on x.com and redirect them to nitter.
@ -3,3 +3,2 @@
* Name: nitter
* Description: Replaces links to twitter.com to a nitter server in all displays of postings on a node.
* Version: 2.0
* Description: Replaces links to twitter.com an "x.com" to a nitter server in all displays of postings on a node.
*and
@ -56,3 +56,3 @@
/*
* replace "twitter.com" with "nitter.net"
* replace "twitter.com" an "x.com" with "nitter.net"
*and
@ -70,2 +70,4 @@
$b['html'] = str_replace('https://twitter.com', $nitter, $b['html']);
$replaced = true;
}
if (strstr($b['html'], 'https://x.com')) {
Wrong indentation, should be one fewer tabulation.
Also matching on just
x.com
exposes partial matches on different domains likex.commercial.biz
. We'd be better off matching onhttps://x.com/
with the trailing slash.Same goes for the
https://twitter.com/
match.@ -64,3 +64,2 @@
$nitter = DI::config()->get('nitter', 'server', 'https://nitter.net');
if (strstr($b['html'], 'https://mobile.twitter.com')) {
$b['html'] = str_replace('https://mobile.twitter.com', $nitter, $b['html']);
if (strstr($b['html'], 'https://mobile.twitter.com/')) {
It seems as if the nitter server url is stored without a trailing
/
. So replacing the url including a trailing/
with the nitter url without a trailing/
will not work.I have checked this on my test instance. The Nitter instance is referenced in all URL constellations. The jump works if a
/
is inserted.I had understood the note above to mean that after each str_replace command a / must be placed after the domain to avoid confusion with e.g. x.commercial.biz. Is there a misunderstanding on my part?
It looks like the Nitter service will stop working as soon as the remaining guest Twitter accounts will expire. The creator is sunsetting the project, which means we should deprecate the addon as well, making these changes moot.
Yeah, it's really said that the work had been in vain.
Pull request closed