1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-08-26 09:34:46 +02:00

Compare commits

..

425 Commits

Author SHA1 Message Date
Jisagi
b9102d7e87 Add Steam Group Announcements Bridge (#3527)
* Create SteamGroupAnnouncementsBridge.php

* Shorten implementation

Maybe this fixes the tests

* test

---------

Co-authored-by: Dag <me@dvikan.no>
2023-07-13 17:23:12 +02:00
Fake4d
0f2b55fbef Update Configuration.php - Old Version Date in new Release (#3526)
Old Version Date in new Release
2023-07-12 11:56:07 +02:00
Dag
69aa751f40 fix(cache): bug in prior refactor (#3525)
* fix(cache): bug in prior refactor

* yup
2023-07-11 23:26:22 +02:00
csisoap
b3bf95bfdd Replace token for Twitter. (#3522) 2023-07-11 23:17:38 +02:00
Dag
6c0e186d3f fix(jornaln): Array to string conversion at lib/BridgeAbstract.php li… (#3523)
* fix(jornaln): Array to string conversion at lib/BridgeAbstract.php line 320

* yup
2023-07-11 16:54:59 +02:00
Dag
c9a861e259 fix(cache): bug in prior refactor (#3520) 2023-07-09 15:24:29 +02:00
Dag
dfe78fb379 fix: various small fixes (#3519) 2023-07-09 10:08:30 +02:00
Dag
f0a504bb9a fix(FeedMerge): allow xml parse failure too (#3518) 2023-07-08 23:36:36 +02:00
Dag
7881c87bed fix: various small fixes (#3517)
* fix(asrocknews): Trying to get property src of non-object

Trying to get property 'src' of non-object at bridges/ASRockNewsBridge.php line 37

* refactor(http): tweak max redirs config

* fix(tiktok)

* fix(gizmodo)

* fix(craig)

* fix(nationalg)

* fix(roadandtrack)

* fix(etsy)
2023-07-08 23:21:55 +02:00
Dag
1a529fac46 fix(soundcloud): bug in prior cache refactor (#3516) 2023-07-08 22:53:23 +02:00
Dag
adc38e65d9 docs: add install method using composer (#3514) 2023-07-08 17:07:43 +02:00
Dag
0b95dc2d4f chore: synchronize composer.lock (#3513)
$ composer update
Loading composer repositories with package information
Updating dependencies
Info from https://repo.packagist.org: #StandWithUkraine
Lock file operations: 0 installs, 12 updates, 6 removals
  - Removing phpdocumentor/reflection-common (2.2.0)
  - Removing phpdocumentor/reflection-docblock (5.3.0)
  - Removing phpdocumentor/type-resolver (1.6.1)
  - Removing phpspec/prophecy (v1.15.0)
  - Removing symfony/polyfill-ctype (v1.25.0)
  - Removing webmozart/assert (1.10.0)
  - Upgrading doctrine/instantiator (1.4.1 => 1.5.0)
  - Upgrading myclabs/deep-copy (1.11.0 => 1.11.1)
  - Upgrading nikic/php-parser (v4.13.2 => v4.16.0)
  - Upgrading phpunit/php-code-coverage (9.2.15 => 9.2.26)
  - Upgrading phpunit/phpunit (9.5.20 => 9.6.9)
  - Upgrading sebastian/comparator (4.0.6 => 4.0.8)
  - Upgrading sebastian/diff (4.0.4 => 4.0.5)
  - Upgrading sebastian/environment (5.1.4 => 5.1.5)
  - Upgrading sebastian/exporter (4.0.4 => 4.0.5)
  - Upgrading sebastian/recursion-context (4.0.4 => 4.0.5)
  - Upgrading sebastian/type (3.0.0 => 3.2.1)
  - Upgrading squizlabs/php_codesniffer (3.6.2 => 3.7.2)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 29 installs, 0 updates, 0 removals
  - Installing sebastian/version (3.0.2): Extracting archive
  - Installing sebastian/type (3.2.1): Extracting archive
  - Installing sebastian/resource-operations (3.0.3): Extracting archive
  - Installing sebastian/recursion-context (4.0.5): Extracting archive
  - Installing sebastian/object-reflector (2.0.4): Extracting archive
  - Installing sebastian/object-enumerator (4.0.4): Extracting archive
  - Installing sebastian/global-state (5.0.5): Extracting archive
  - Installing sebastian/exporter (4.0.5): Extracting archive
  - Installing sebastian/environment (5.1.5): Extracting archive
  - Installing sebastian/diff (4.0.5): Extracting archive
  - Installing sebastian/comparator (4.0.8): Extracting archive
  - Installing sebastian/code-unit (1.0.8): Extracting archive
  - Installing sebastian/cli-parser (1.0.1): Extracting archive
  - Installing phpunit/php-timer (5.0.3): Extracting archive
  - Installing phpunit/php-text-template (2.0.4): Extracting archive
  - Installing phpunit/php-invoker (3.1.1): Extracting archive
  - Installing phpunit/php-file-iterator (3.0.6): Extracting archive
  - Installing theseer/tokenizer (1.2.1): Extracting archive
  - Installing nikic/php-parser (v4.16.0): Extracting archive
  - Installing sebastian/lines-of-code (1.0.3): Extracting archive
  - Installing sebastian/complexity (2.0.2): Extracting archive
  - Installing sebastian/code-unit-reverse-lookup (2.0.3): Extracting archive
  - Installing phpunit/php-code-coverage (9.2.26): Extracting archive
  - Installing phar-io/version (3.2.1): Extracting archive
  - Installing phar-io/manifest (2.0.3): Extracting archive
  - Installing myclabs/deep-copy (1.11.1): Extracting archive
  - Installing doctrine/instantiator (1.5.0): Extracting archive
  - Installing phpunit/phpunit (9.6.9): Extracting archive
  - Installing squizlabs/php_codesniffer (3.7.2): Extracting archive
Generating autoload files
25 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
2023-07-08 17:07:35 +02:00
Dag
61b307a9f9 fix(tiktok): feed item link (#3511)
* fix(tiktok): feed item link

* fix(tiktok): support entire url, for convenience
2023-07-08 17:07:20 +02:00
Dag
341649a8a4 fix: tweak the defaultly enabled bridges (#3510)
* fix: tweak the defaultly enabled bridges

enabled_bridges[] = FeedMerge
enabled_bridges[] = Filter
enabled_bridges[] = GettrBridge
enabled_bridges[] = MastodonBridge
enabled_bridges[] = Reddit
enabled_bridges[] = RumbleBridge
enabled_bridges[] = SoundcloudBridge
enabled_bridges[] = Telegram
enabled_bridges[] = ThePirateBay
enabled_bridges[] = Twitch
enabled_bridges[] = Twitter
enabled_bridges[] = Vk
enabled_bridges[] = XPathBridge
enabled_bridges[] = Youtube
enabled_bridges[] = YouTubeCommunityTabBridge

* add feed reducer too

* add tiktok too
2023-07-08 17:07:08 +02:00
Dag
91976f7d56 fix(file cache): acquire lock before writing (#3509) 2023-07-08 17:06:49 +02:00
Dag
8b996e3056 refactor: display action (#3508) 2023-07-08 17:06:33 +02:00
Dag
c1c8304fc0 refactor: dont create multiple instances of the cache (#3504) 2023-07-08 17:03:12 +02:00
Dag
b594ad2de3 fix: discard empty lines in whitelist.txt (#3507) 2023-07-07 11:25:36 +02:00
User123698745
ef0b86968c [PicnobBridge] fix missing images (#3506)
* [PicnobBridge] fix missing images

* [PicnobBridge] handle invalid relative date (e.g.: 'Just now')

* [PicnobBridge] fix code indent
2023-07-07 08:16:45 +02:00
somini
d49ea235f0 [JornalDeNoticiasBridge]: Remove bridge (#3505)
This is now broken, it was replaced by a React monstrosity. The API
doesn't even let me read the post data, it demands authentication.
Bummer.

Better remove it now, since it's worthless.
2023-07-07 08:14:31 +02:00
Dag
46f0e97c73 refactor: remove useless actual args to clearstatcache (#3503) 2023-07-06 19:39:40 +02:00
Dag
5e22459eb6 fix: remove unnecessary calls to purgeCache (#3502) 2023-07-06 18:52:19 +02:00
Dag
965d7d44c5 feat(sqlite cache): add config options (#3499)
* refactor: sqlite cache

* refactor

* feat: add config options to sqlite cache

* refactor
2023-07-06 15:59:38 +02:00
Dag
21c8d8775e fix: bug in #3442 (#3498)
* fix: bug in #3442

* docs: add inline doc on how to enable all bridges
2023-07-06 15:20:56 +02:00
Dag
caac7f572c refacor: improve cache interface (#3492)
* fix: proper typehint on setScope

* refactor: type hint setKey()

* typehint
2023-07-06 15:10:30 +02:00
Dag
f8801d8cb3 feat: add system config enable_maintenance_mode (#3497) 2023-07-06 15:09:44 +02:00
Dag
8f9147458d fix(gatesnotes): fix #3493 (#3494) 2023-07-06 03:36:01 +02:00
Dag
a9fd3b9e61 fix(CacheInterface): logic bug in getTime (#3491)
* fix(CacheInterface): logic bug in getTime

* test
2023-07-05 17:37:21 +02:00
Dag
18e1597361 fix(ph): consent cookie (#3490) 2023-07-05 17:06:23 +02:00
Patrick
e9af41d666 Add bridges for JohannesBlick Steinfeld, OM Online and UsesTech (#3489)
* Add bridges for JohannesBlick Steinfeld, OM Online and UsesTech

* Fixed linit alert
2023-07-05 16:43:59 +02:00
Dag
354317d010 fix(rumble): add timestamp to items (#3485) 2023-07-05 05:41:33 +02:00
Dag
84501cfc00 feat: add health check action (#3484) 2023-07-05 05:41:20 +02:00
Dag
82c22bd2b5 fix(feedmerge): allow a single feed to break, and dont break the whole bridge (#3476) 2023-07-05 05:41:01 +02:00
Dag
a21d496bc7 feat: add default arg to Configuration::getConfig (#3331) 2023-07-05 05:33:22 +02:00
Dag
cf920694d5 fix(futurasciences): fix broken bridge (#3488) 2023-07-04 23:34:24 +02:00
Thomas
bf0d771367 [YouTubeCommunityTabBridge] Fix getURI implementation
Previously the undefined property "feedUri" was accessed here, always
causing a fallback to the parent class
2023-07-04 17:03:30 +02:00
Dag
48385777b4 fix: php notices (#3482)
* fix(furaffinity): notice

* fox(releases3ds): remove references to non-existing vars
2023-07-03 10:48:33 +02:00
Dag
d8bc015efc fix: php notices (#3479)
* fix(jornaln): A non well formed numeric value encountered

fixes

A non well formed numeric value encountered at bridges/JornalNBridge.php line 89

* fix(reuters): fix notice
2023-07-03 00:39:01 +02:00
Eugene Molotov
0f14a0f6ee [YandexZenBridge] Add image to post (#3478) 2023-07-02 22:56:45 +02:00
Thomas
eb2b4747ae [YouTubeCommunityTabBridge] Add timestamps (#3477)
As YouTube doesn't provide precise dates for community posts, an
increasing multiple of 60 seconds is subtracted from each timestamp.
This ensures that the original order is always preserved, even if there
are multiple posts with the same date (e.g. "1 month ago").
2023-07-02 22:56:08 +02:00
Dag
bf73372d7f fix: dont be case-sensitive on env vars (#3475) 2023-07-02 06:47:21 +02:00
Dag
748fc9fd65 fix: various small notice fixes (#3474)
* fix(patreon): php notice

* fix(pepperbridge): php notice

* fix(ebay): php notice

* fix(tiktok): php notice

* fix(yandex): fix notice

* fix(justwatch): notice

* lint
2023-07-02 06:40:25 +02:00
Dag
372880b5ef fix: file cache tweaks (#3470)
* fix: improve file cache

* fix(filecache): log when unserialize fails
2023-06-30 22:31:19 +02:00
rmscoelho
cc91ee1e37 [JornalNBridge] getName() fix (#3456)
* [JornalNBridge] getName() fix

* [JornalNBridge] feed fixes
2023-06-30 15:54:53 +02:00
Arnav Jain
fece9ed344 [NotAlwaysBridge] Add new categories, remove duplicate header, and social meta (#3463)
* [NotAlwaysBridge] add new tags

* [NotAlwaysBridge] Remove duplicate header and social meta

* [NotAlwaysBridge] Add space to fix lint issues
2023-06-30 15:50:54 +02:00
Bocki
b6a263037a [core] Fix prtester for optgroups (#3467) 2023-06-30 15:41:00 +02:00
Mynacol
410ef85618 [GolemBridge] Strip <script> tags
Golem articles referencing their podcast contain a JavaScript reference
to Podigee. We don't want JS, so we strip it.

Example page: https://www.golem.de/news/podcast-besser-wissen-von-schlangenoel-und-sicherheit-2306-175185.html
2023-06-28 16:01:32 +02:00
Dag
8eabdbe5f8 fix(Twitter): properly find time line entries when ordering is inconsistent (#3461) 2023-06-27 16:11:41 +02:00
António Pereira
bd6f56383c [PresidenciaPTBridge]: Fix timestamp search (#3459) 2023-06-26 17:52:32 +02:00
ORelio
d4bc63ee98 [TheHackerNews] Update content extraction (#3458) 2023-06-25 19:01:57 +02:00
rmscoelho
1b02d4f49b [CorreioDaFeiraBridge] cache timeout + getName fixes (#3453)
* [CorreioDaFeiraBridge] cache timeout fix

* [CorreioDaFeiraBridge] cache timeout fix

* [CorreioDaFeiraBridge] getName() fix
2023-06-22 07:27:52 +02:00
rmscoelho
a4ed52ca30 [VideoCardzBridge] cache timeout fix + getName fixes (#3454)
* [VideoCardzBridge] cache timeout fix

* [VideoCardzBridge] getName() + title fix
2023-06-22 07:27:30 +02:00
rmscoelho
1769399da8 [ABolaBridge] cache timeout fix + getName fixes (#3455)
* [ABolaBridge] cache timeout fix

* [ABolaBridge] fix timestamp and image alt null

* [ABolaBridge] formatting fixes

* [ABolaBridge] getName() fix
2023-06-22 07:27:01 +02:00
rmscoelho
12ba6154f9 [JornalNBridge] cache timeout fix (#3452)
* [JornalNBridge] cache timeout fix

* [JornalNBridge] cache timeout fix
2023-06-21 11:15:36 +02:00
rmscoelho
8e35ebf482 [New Bridge] Jornal N (Portuguese local newspaper) (#3451)
* [New Bridge] Jornal N (Portuguese local newspaper)

* [JornalNBridge] formatting fixes
2023-06-21 05:17:11 +02:00
rmscoelho
61130e89b4 [ABolaBridge] timestamp (#3448)
* [ABolaBridge] timestamp

* [ABolaBridge] formatting fixes
2023-06-21 05:15:01 +02:00
rmscoelho
ebebb886c5 [ABolaBridge] feed fixes (#3446)
* [ABolaBridge] category name and url fixes

* [ABolaBridge] "Mercado" feed fix; feed name fix; img fix;

* [ABolaBridge] formatting fix
2023-06-20 17:26:55 +02:00
Matt Connell
6eaa31b999 [New Bridge] WYMT news bridge (#3444)
* feat: add WYMT bridge

* fix: phpcs error
2023-06-20 15:13:41 +02:00
rmscoelho
1d3888f22a [VideoCardzBridge] category name and url fixes (#3447)
* [VideoCardzBridge] category name and url fixes

* [VideoCardzBridge] error fixes

* [VideoCardzBridge] formatting fix

* [VideoCardzBridge] cache timeout removal
2023-06-20 15:01:41 +02:00
rmscoelho
60be4cdebd [CorreioDaFeiraBridge] adding timestamps; fixing categories; (#3445)
* [New Bridge] Correio da Feira (regional newspaper)

* [CorreioDaFeiraBridge] adding timestamp; fixing name

* [CorreioDaFeiraBridge] formatting fixes
2023-06-20 12:46:24 +02:00
rmscoelho
5a0bacbd8a [New Bridge] Videocardz.com bridge (#3442)
* [New Bridge] Videocardz.com Bridge

* [New Bridge] Videocardz.com Bridge

* [Videocardz.com] cache timeout increase

* [VideoCardzBridge] cache timeout change

* [VideoCardzBridge] formatting

* [VideoCardBridge] formatting fixes

* [VideoCardzBridge] formatting fixes
2023-06-20 12:45:50 +02:00
rmscoelho
0c808dc3a1 [New Bridge] Bridge for sports website A Bola (#3441)
* [New Bridge] Bridge for sports website A Bola

* [ABolaBridge] add thumbnail

* [ABolaBridge] formatting

* [ABolaBridge] formatting fixes

* [ABolaBridge] formatting fixes

* [ABolaBridge] formatting fixes
2023-06-20 12:45:34 +02:00
rmscoelho
98b72b2c5c [New Bridge] Correio da Feira (regional newspaper) (#3443) 2023-06-20 05:57:22 +02:00
Thomas
54d626d5cd [XPathAbstract] Use baseURI to fix relative links (if available) (#3439) 2023-06-17 17:53:00 +02:00
somini
1e470ef341 [PresidenciaPTBridge]: Fix title search (#3438)
This was changed on the site itself, in the last few days.
2023-06-17 06:13:09 +02:00
Dag
0a8fe57003 feat: enable bridges using env var (#3428)
* refactor: bridgefactory, add tests

* refactor: move defaultly enabled bridges to config

* refactor

* refactor

* feat: add support for enabling bridges with env var
2023-06-11 03:16:03 +02:00
Nick McCarthy
d9490c6518 GoogleScholarV2Bridge (#3415)
* Added google scholar v2 bridge with more functionality

* Corrected Sort By interpretation (this is weird on Googles part)

* Remove some debug statements

* Merged GoogleScholarBridge and GoogleScholarV2Bridge into GoogleScholarBridge with two contexts.

* Left V2 in Bridge Name

* Lint

* Update GoogleScholarBridge.php

* Update GoogleScholarBridge.php

* Lint.

* ;
2023-06-10 18:35:04 +02:00
Jisagi
eb799e59a6 [NyaaTorrentsBridge] Add custom fields (#3420)
* Update NyaaTorrentsBridge.php

* lint

* lint #2

* Sir Lint the Third

* Add torrent id to custom fields

* Proposed improvements
2023-06-10 18:28:00 +02:00
Eugene Molotov
ec1a3f4fe3 [YoutubeBridge] Unassign maintainer (#3431) 2023-06-10 18:27:49 +02:00
Eugene Molotov
80376830c5 [VkBridge] Handle some secondary attachments (#3430) 2023-06-10 18:27:32 +02:00
Shikiryu
e859497d6a [PicalaBridge] Fix article without image (#3429)
Co-authored-by: Clement Desmidt <clement@desmidt.fr>
2023-06-09 17:30:11 +02:00
Dag
ca351edbfe test: use correct path for bridges (#3427) 2023-06-08 23:44:26 +02:00
Dag
8f9eaae338 chore: fix ci (#3426) 2023-06-08 23:37:36 +02:00
Dag
fbaf26e8bf fix(html_format): add spacing below date if author is missing (#3425)
* small ui tweak

* remove unused <div>

* refactor: rename method

* refactor: inline const

* refactor
2023-06-08 23:04:16 +02:00
Simon Alberny
95071d0134 Add RemixAudioBridge (#3424) 2023-06-07 22:37:38 +02:00
Simon Alberny
3f8165207e Add RainLoopBridge (#3423) 2023-06-07 22:36:51 +02:00
Simon Alberny
08be0ad7a5 Add GoAccessBridge (#3422) 2023-06-07 22:36:21 +02:00
Simon Alberny
6fa1f349d9 Add AllocineFRSortiesBridge (#3421) 2023-06-07 22:35:54 +02:00
July
54957d2a03 [GameBananaBridge] Load all full quality screenshots (#3419)
Replaces the low quality preview images used previously
2023-06-06 20:00:55 +02:00
Tone
819e453064 remove newsletter ad from finanzflussBridge (#3417)
* remove newsletter ad

* whitespace
2023-06-02 20:28:29 +02:00
Dag
1636a84c25 fix(spotify): use non-predictable cache key (#3330)
* refactor

* fix(spotify): use non-predictable cache key
2023-06-02 20:22:28 +02:00
Dag
ee498eadf9 fix: move debug mode to config (#3324)
* fix: move debug mode to config

* fix: also move debug_whitelist to .ini config

* fix: move logic back to Debug class

* docs

* docs

* fix: disable debug mode by default

* fix: restore previous behavior for alerts

* fix: center-align alert text
2023-06-02 20:22:09 +02:00
Ryan Stafford
c5cd229445 [YoutubeBridge] Set icon (#3416) 2023-06-01 21:26:47 +02:00
July
845a8f7936 [MangaDexBridge] Add option to add chapter images to entries (#3412) 2023-05-28 18:23:01 +02:00
aysilu-kitsune
2f0784c287 added my instance (#3413) 2023-05-28 18:21:44 +02:00
piyushpaliwal
227c7b8968 Sleeper.com Alerts. Fixes #2234 (#3411)
* Sleeper.com Alerts. Fixes #2234

* fix: linter issue
2023-05-28 01:31:45 +02:00
July
01f731cfa4 [GameBananaBridge] Create new bridge (#3410) 2023-05-26 18:19:34 +02:00
mrnoname1000
87b9f2dd94 [core] Fix XPathAbstract while working around Simple HTML DOM bug (#3408) 2023-05-21 21:06:35 +02:00
Dag
f803ffa79a fix: ArgumentCountError: DOMDocument::getElementsByTagName() expects exactly 1 argument, 2 given, #3406 (#3407) 2023-05-21 19:59:39 +02:00
mrnoname1000
b5dbec4cc1 [AllSidesBridge] New bridge (#3405) 2023-05-20 04:15:56 +02:00
mrnoname1000
3e0d024888 [core] Fix defaultLinkTo for simple_html_dom objects (#3404) 2023-05-20 00:02:17 +02:00
Dag
cfe81ab2ac fix: Call to a member function setAttribute() on int, #3402 (#3403) 2023-05-19 16:05:52 +02:00
mrnoname1000
096c3bca73 [XPathAbstract] Fix relative links in fetched HTML (#3401)
* [core] Make defaultLinkTo compatible with DOMDocument

* [XPathAbstract] Fix relative links in fetched HTML
2023-05-18 13:50:50 +02:00
Tone
ecd717cf58 removing a-collapse (#3394)
it is only used for ads for their magazine
e.g.: https://www.heise.de/news/Eventtipps-fuer-Fotografen-und-Fotografiebegeisterte-9010049.html?seite=all
2023-05-12 23:41:08 +02:00
Tone
0c540b4637 added script to deleted elements in CaschyBridge (#3391)
* added script to deleted elements

Now it works much better with included content like twitter, e.g. in this article:
https://stadt-bremerhaven.de/1password-mit-android-14-wird-man-passkeys-in-chrome-und-apps-unterstuetzen/

* Update CaschyBridge.php

* Update CaschyBridge.php
2023-05-11 21:25:13 +02:00
mrnoname1000
d0f7f5e2d8 [New Bridge] FiderBridge (#3378)
* [core] Add config parameter to markdownToHtml

* [FiderBridge] New bridge
2023-05-11 21:24:12 +02:00
Alexandre Alapetite
e99e026fa8 Use standard Docker logs (#3333)
Instead of storing logs inside the container (where then cannot easily be seen not rotated), consider using the standard Docker approach of writing to standard output
https://docs.docker.com/config/containers/logging/
2023-05-11 01:44:11 +02:00
Dag
50865d5741 fix: add additional cloudflare title (Glassdoor specific) (#3342) 2023-05-11 01:33:38 +02:00
July
dc4134ed1d [ScribbleHubBridge] Add CloudFlare error handling (#3361)
* [ScribbleHubBridge] Set html defaultLinkTo

* [ScrubbleHubBridge] Add CloudFlare error handling
2023-05-11 01:33:21 +02:00
mrnoname1000
c6c4b3a24f [XPathAbstract] Fix encoding on feed title (#3365) 2023-05-11 01:32:01 +02:00
mrnoname1000
63dc500ae0 [XPathAbstract] Save HTML for entry content (#3366) 2023-05-11 01:31:34 +02:00
vincentvd1
723768c828 Add bridge for Magellantv articles (#3368)
* [MagellantvBrdige] added first version

* [MagellantvBridge]  cleanup, added tags and fixed bugs

* [MagellantvBridge] fix linting issues

* [MagellantvBridge] more linting fixes

* [MagellantvBridge] removed tabs
2023-05-11 01:30:25 +02:00
Tone
e7bda080b4 added iframe to $bad (#3380)
iframe can't be rendered in feed reader, so we can delete it
2023-05-10 22:14:34 +02:00
Joseph
8fd677f4ae [GithubTrendingBridge] Fix items (#3381) 2023-05-10 22:14:21 +02:00
Dag
88f646cf12 fix(TwitterBridge): trim screen name before passing it to twitter client (#3389) 2023-05-10 21:59:50 +02:00
Dag
49d105fd70 fix(TwitterBridge): remove ampersand from screen name, api dont like it (#3388) 2023-05-10 21:55:47 +02:00
Dag
ff49c9f731 fix(TwitterBridge): repair fetching of tweets by username (#3385)
* feat: alpha version of new twitter bridge

* fix: refetch guest_token if expired

* fix: purge cache

* fix: safeguards

* fix

* fix: two notices

* fix

* fix: use factory to create cache

* fix: fail properly instead of die()
2023-05-10 21:45:44 +02:00
Max
c628f99928 use lowercase 2023-05-10 18:40:33 +02:00
Tone
f26808d22c added article categories for CaschyBridge (#3379)
* added article categories

* whitespace
2023-05-08 16:21:39 +02:00
Tone
a1b6bca581 added article categories for GolemBridge (#3377)
* added article categories for GolemBridge

* tabs are bad, spaces good

* fixed duplicate categories on multi-page articles
2023-05-08 16:21:03 +02:00
Tone
ec091fb747 fixed authors and added categories for HeiseBridge (#3376) 2023-05-07 12:33:45 +02:00
mrnoname1000
887f4bbe15 [BugzillaBridge] Explicitly request JSON (#3364) 2023-04-27 19:24:29 +02:00
Paul Prechtel
212c56fde5 [HeiseBridge] Handle heise+ articles better (#3358)
- Stop parsing paywalled heise+ articles, as they had garbage content
  and anyways not the full article.
- Link to archive.today to access the full article without account.
  (Automatically getting the full article from archive.ph was not feasible
  b/c of captchas and problems extracting the actual content)
2023-04-20 23:02:08 +02:00
sysadminstory
00e716d84d [PepperBridgeAbstract] Fix "no results" check (#3357)
CSS class for "no results" text has changed, so the bridge has been
updated accordingly.
2023-04-20 11:22:53 +02:00
July
f0c96008bc [ScribbleHubBridge] Create new bridge (#3353)
* [ScribbleHubBridge] Create new bridge

* [ScribbleHubBridge] Improve 'Series' filtering

* [ScribbleHubBridge] Properly fetch feed name

* [ScribbleHubBridge] Fix feed name and set feed URI

* [ScribbleHubBridge] Fix linting violations with phpcbf

* [ScribbleHubBridge] Properly handle html encoding in titles
2023-04-19 20:35:04 +02:00
Eugene Molotov
343fd36671 [core] Remove hardcoded maximum duration of 24 hours in loadCacheValue (#3355) 2023-04-19 17:53:35 +02:00
Paul Prechtel
a4a7473abb [Docs] Fix link to SimpleHTMLDOM documentation (#3354) 2023-04-19 17:51:55 +02:00
Paul Prechtel
4068668de9 [ZeitBridge] Re-add paywall workaround (#3352)
Additionally to the Googlebot User-Agent, a Googlebot IP address has to
be used. For now, we can use `X-Forwarded-For` for this.
2023-04-18 18:41:40 +02:00
Eugene Molotov
7c4591c550 [VkBridge] Add detectParameters (#3351) 2023-04-18 18:41:11 +02:00
Paul Prechtel
0718fdc829 [ZeitBridge] Revert User-Agent (#3350)
The Googlebot User-Agent is no longer sufficient to circumvent the
paywall.
2023-04-17 15:33:14 +02:00
Dawid Wróbel
7eca527160 [eBayBridge] New bridge (#3349)
Fixes #3268
2023-04-15 18:40:49 +02:00
triatic
f1c54d5d55 [TwitterV2.md] Update to reflect price change to Twitter API (#3347) 2023-04-14 21:32:13 +02:00
Korytov Pavel
1ed7bdcddf [InternationalInstituteForStrategicStudiesBridge] Repair and improve bridge (#3338)
* [InternationalInstituteForStrategicStudiesBridge] Repair and improve bridge

* [InternationalInstituteForStrategicStudiesBridge] Fix lint
2023-04-08 22:09:07 +02:00
Paroleen
8486c0f8ca [SpotifyBridge] Add podcasts feed (#3329)
Co-authored-by: Matteo Parolin <matteoparolin99@gmail.com>
2023-03-24 20:34:51 +01:00
Eugene Molotov
249133204e [UI] Remove excessive top margin in all pages and logo in HTML feed preview (#3326) 2023-03-24 13:44:34 +01:00
Eugene Molotov
c8af9f9055 [VkBridge] Make timestamps more accurate (#3325) 2023-03-22 20:32:15 +01:00
Dag
9bb04ba848 Prepare 2023-03-21 release (#3323)
* fix: upgrade version string in php code
2023-03-22 19:32:19 +01:00
realansgar
307f5865c0 [ARDAudiothekBridge] fix feed icon not showing in RSS feeds (#3274)
* [ARDAudiothekBridge] fix feed icon not showing in RSS feeds

* [ARDAudiothekBridge] Fix lint errors
2023-03-21 18:24:28 +01:00
DRogueRonin
36e98e8481 docs: add docker development environment example (#3319) 2023-03-20 19:13:08 +01:00
Dag
347a0e9a3d fix: patch simple_html_dom, #3309 (#3310) 2023-03-20 19:12:13 +01:00
Dag
4c3ebb312d feat: improve error handling ux (#3298)
* feat: improve error handling ux

* feat: add error messages for failed xml parsing
2023-03-20 19:11:51 +01:00
Dag
9e9a697b8b feat: add config option "path" for file cache (#3297) 2023-03-20 19:10:01 +01:00
Miika Launiainen
4e616c7092 [YorushikaBridge] Replace YouTube embeds with YouTube link (#3321) 2023-03-19 12:50:04 +01:00
toineenzo
fbe7cc11ec Add more countries to App Store Bridge (#3246)
* Added more countries

* Fixed Brazil typo

* Update AppleAppStoreBridge.php

Removed whitespace line 52 for lint fix
2023-03-18 19:55:23 +01:00
sysadminstory
23fb5819cd [FreeTelechargerBridge] New bridge (#3318)
* [FreeTelechargerBridge] New bridge

New bridge

* [FreeTelechargerBridge ] Fix CACHE_TIMEOUT value

Fixed CACHE_TIMEOUT value
2023-03-16 09:35:49 +01:00
vdbhb59
dc8ce20482 Update 06_Public_Hosts.md (#3311)
Added my instance of public hosted RSS-Bridge host.
2023-03-14 15:55:14 +01:00
mad-reyk
224cce08a8 [Sfeed] Fixed category separator and random white spaces (#3308) 2023-03-12 15:21:21 +01:00
mad-reyk
c1f446fd19 [Sfeed] Added new format (#3306)
* [Sfeed] Added new format

* [Sfeed] Spaces instead of tabs

* [Sfeed] Move all global functions to class and fix phpcs warnings
2023-03-12 00:13:27 +01:00
Corentin Garcia
19fc2dc100 [GatesNotesBridge] Fix bridge (fix #3294) (#3305) 2023-03-11 23:26:22 +01:00
Dag
2c94791bcd fix: skip yt json if absent, fix #3301 (#3302) 2023-03-11 20:06:01 +01:00
Dag
1ffb2df46d New bridge (#3300)
Create rss feed from wallpapers published on erowall.com.

Allow fetching n latest wallpapers sorted by date, views, downloads and
tags.

Co-authored-by: Kurz Junge <kurz.junge.0xa@tutanota.com>
2023-03-11 01:41:02 +01:00
Miika Launiainen
dc9530b405 [YorushikaBridge] Created the bridge (#3299) 2023-03-09 18:36:51 +01:00
Bocki
90bf5518cb [Core] Activate live linting in codespaces (#3293)
* [Core] Add live linting to devcontainer

* Deactivate lint on type
2023-03-08 18:39:50 +01:00
Bocki
783160e715 [nginx] Add ipv6 listener (#3292) 2023-03-07 23:59:22 +01:00
Bocki
0a114c02c2 [Docu] Clarify docker instructions (#3291) 2023-03-07 23:58:21 +01:00
Bocki
2abdc7588a [Docu] Add documentation for Codespaces (#3289)
* [Docu] Add documentation for Codespaces

* Adapt PR line
2023-03-07 21:34:02 +01:00
Bocki
84e0135959 [Core] github codespaces setup (#3287) 2023-03-07 17:10:36 +01:00
Korytov Pavel
f7200756c3 [InternationalInstituteForStrategicStudiesBridge] Add bridge (#3286)
* [InternationalInstituteForStrategicStudiesBridge] Add bridge

* [InternationalInstituteForStrategicStudiesBridge] Fix lint errors
2023-03-07 17:03:50 +01:00
sysadminstory
b8ad49c562 [ExtremeDownload] Remove Bridge (#3285)
The Website has been taken down, this bridge is not needed anymore.
2023-03-07 01:02:51 +01:00
Dag
058e792b8f feat: add filecache config to enable/disable real purge (#3263)
* refactor: cachefactory

* feat: add filecache config to enable/disable real purge

* test: fix test
2023-03-06 21:50:40 +01:00
Dag
007f2b2d8a feat: sanitize root folder also in php error messages (#3262) 2023-03-06 21:47:25 +01:00
Dag
a01c1f6ab0 fix: disallow usage of default password (#3284) 2023-03-06 20:43:44 +01:00
Bocki
f0e5ef0fc5 [Various] getKey replacements and docu (#3283)
* [Various] getKey replacements and docu

* more bridges and fix to the abstract

* linting

* revert bandcampdaily. doing more than i thought
2023-03-06 20:01:51 +01:00
Tone
b40714079f Create FinanzflussBridge.php (#3282)
* Create finanzflussBridge.php

new bridge for finanzfluss.de

* Pascal case

* Rename finanzflussBridge.php to FinanzflussBridge.php

* Update FinanzflussBridge.php

more spaces!
2023-03-05 23:45:45 +01:00
Simon
180c332406 Update 06_Public_Hosts.md (#3280)
Change location for bridge.easter.fr
2023-03-05 00:37:42 +01:00
Joseph
8c4dbb32de [DockerHubBridge] Display compressed image size in items (#3279)
* [DockerHubBridge] Display compressed image size in items

* [DockerHubBridge] lint

* [DockerHubBridge] Use format_bytes()
2023-03-04 17:33:28 +01:00
Ololbu
5ab949ca55 [FicbookBridge] Fix new lines in content (#3278)
* [FicbookBridge] Fix new lines in content

Sets `$stripRN` in `getSimpleHTMLDOMCached` to `false` and replace new line to `br` through `str_replace()`.

* [FicbookBridge] Add space after comma
2023-03-04 16:12:46 +01:00
Bocki
f3f98a117c [Core] Add getKey function (#3275)
* [Core] Add getKey function
2023-03-02 13:25:57 +01:00
Bocki
f0d8cfd4d4 [JustWatchBridge] New bridge (#3273)
* [JustWatchBridge] New bridge
2023-03-01 20:24:01 +01:00
Korytov Pavel
4aed05c7b6 [TldrTechBridge] Add AI section (#3272) 2023-02-28 17:28:33 +01:00
Mynacol
4450e9b973 Let curl select the default HTTP version (#3249)
This essentially reverts b042412416,
as YouTube seems to have fixed their servers.
At least I was able to query the YouTube endpoint around 150 times with
CURL_HTTP_VERSION_2TLS recently. They even advertise HTTP/3 support with
an `alt-svc` HTTP header now.

This unsets CURLOPT_HTTP_VERSION to let curl decide
on the version. This would support all curl versions and opens the
possibility for HTTP/3, but leads to inconsistent behavior depending
on the underlying curl version.

We don't set CURL_HTTP_VERSION_NONE explicitly, as it is always the curl
default and opens the path to let individual bridges override the HTTP
version where necessary.

Alternatively, setting CURL_HTTP_VERSION_2TLS explicitly would lead to consistent behavior
regardless of the curl version, but might uncover old curl bugs before the
developers enabled HTTP/2 by default.
Additionally, that requires at least PHP 7.0.7 (we require PHP 7.4
already) and curl 7.47.0 [1], released on Jan 27 2016 [2].

See also the discussion on https://github.com/RSS-Bridge/rss-bridge/pull/3249

[1] https://www.php.net/manual/curl.constants.php
[2] https://curl.se/docs/releases.html
2023-02-22 17:48:39 +01:00
sysadminstory
7783e4133d [PicnobBridge] Update description & uid (#3267)
- Description now allows HTML and relative URLs are rewritten
- Post ID in the post URL is used as UID in the feed
2023-02-21 00:56:17 +01:00
Erisa A
4cfe69abb4 Update public instance (#3266) 2023-02-20 12:53:23 +01:00
Predä
db437b6326 [PicukiBridge] Add source field (#3265)
* [PicukiBridge] Add source_url field

* Simplify the regex matching.

* Add picuki source for feeds
2023-02-19 01:35:28 +01:00
Tone
5d4247dded Update CaschyBridge.php (#3261)
prevents the bug #3259 that quote-blocks will be displayed multiple times
2023-02-15 22:20:22 +01:00
Dag
286790727b fix: throw exception when outbox not found, #3255 (#3260) 2023-02-15 21:42:05 +01:00
Dag
c27a300e02 test: add failing mastodon test (#3255)
* fix: refactor cache factory

* test: add failing test

* add null cache
2023-02-15 21:22:37 +01:00
Joseph
787b4d7cad [DockerHubBridge] Add tag filter option (#3258)
* [DockerHubBridge] Add tag filter option

* [DockerHubBridge] Add example value

* [DockerHubBridge] lint

* [DockerHubBridge] Fix

* Update DockerHubBridge.php

* [DockerHubBridge] Make repo required

* [DockerHubBridge] Add filter example value for user images
2023-02-15 20:15:38 +01:00
Dag
17fcc72b09 chore: upgrade to php 8 in the Dockerfile, fix #3191 (#3256) 2023-02-13 22:21:07 +01:00
Joseph
67f72bfa5d [TelegramBridge] Support new username URL format (#3257)
* [TelegramBridge] Support new username URL format

* [TelegramBridge] Fix text error
2023-02-13 22:19:41 +01:00
sysadminstory
06a4bc4b45 [DealabsBridge-HotUKDealsBridge-MydealsBridge] (#3253)
Fix CSS class for the deal temperature
2023-02-10 06:16:01 +01:00
SergioFLS
ed36c8cbcd [ItchioBridge] add error for password pages (#3252) 2023-02-08 19:50:21 +01:00
sravan
4dc6158d5c fix badge (#3251) 2023-02-08 19:48:54 +01:00
Mynacol
38e832daae [GolemBridge] Remove link from author (#3248)
Fixes #3224.
2023-02-08 19:44:01 +01:00
Eugene Molotov
91f91ba621 [VkBridge] Follow site changes (#3244) 2023-02-07 15:10:43 +01:00
Dag
7f1b32f390 feat: add a proper feed item uid when the bridge errors out (#3237)
* refactor: move function to class

* fix: use the computed bridge name as cache key

* refactor: extract method

* fix: set a feed item uid on errors

* docs

* fix: remove year from uid
2023-02-02 22:53:01 +01:00
Dag
c97e1923ae docs (#3238) 2023-02-02 01:30:29 +01:00
Dag
e01e031e3a fix: # and / in filter bridge (#3236) 2023-02-01 20:11:20 +01:00
Bocki
1fe55314be [Core] Update GH Actions (#3235)
* [Core] Update GH Actions

* fix dockerbuild

* add empty lines at the end of files
2023-01-31 22:11:59 +01:00
Binnette
af6aedd536 php 7.4 (or higher) (#3232) 2023-01-30 22:42:39 +01:00
Sébastien MB
51952c1db2 [DevToBridge] Allow subsribe to username (#3218) 2023-01-30 11:59:46 +01:00
Justin Goette
69290c8e55 feat: [FilterBridge] Add URI/URL filter option to FilterBridge (#3212) 2023-01-29 20:13:29 +01:00
sysadminstory
57e79e7f1b [RadioMelodieBridge] Fix article content (#3230)
- remove the social network share section ath the beginning and and the
  end of the article
- removte the HTML formated article tilthe from the content
- limite the author picture size to 60 px
2023-01-29 19:45:55 +01:00
somini
b21806a0b3 [TheRedHandFiles]: New Bridge (#3229)
This blog had a feed, is updated irregularly, and someone disabled the
feed on the Wordpress config on purpose for some reason. :(
2023-01-28 07:39:59 +01:00
Mynacol
e44e458617 [HeiseBridge] add all RSS feeds from heise.de (#3223)
Add all feeds from https://www.heise.de/news-extern/news.html with
(mostly) their original name.

The existing ones moved from e.g. https://www.heise.de/newsticker/heise-atom.xml
to https://www.heise.de/rss/heise-atom.xml.

Some feeds were commented out, as they do not provide full-text feeds
for multiple reasons.
2023-01-27 02:54:08 +01:00
Korytov Pavel
e76ddf9192 [TldrTechBridge] Add bridge (#3222)
* [TldrTechBridge] Add bridge

* [TldrTechBridge] Fix lint

* [TldrTechBridge] Fix lint
2023-01-23 19:22:13 +01:00
sysadminstory
e1e340f650 [PicnobBridge] New Bridge (#3221)
Add new bridge
- some image can not be displayed in the feed because of the CORP policy
2023-01-22 16:00:18 +01:00
Dag
c06e471ae9 feat: add new bridge for picarto.tv (#3220) 2023-01-20 22:48:06 +01:00
Dag
04090bd84a docs (#3217) 2023-01-17 21:21:32 +01:00
Tone
b9af53beff New Bridge for Caschys Blog (#3215) 2023-01-17 17:06:49 +01:00
Tone
077fc4bc3c Update HeiseBridge.php (#3214)
loading smaller images instead the original ones with a size of around 20Mb
2023-01-17 17:01:09 +01:00
sysadminstory
eb94107c15 [RadioMelodie] Fix bridge (#3204)
This fix follows the change in the CSS of the website.
2023-01-03 19:26:56 +01:00
Eugene Molotov
eab82f0a26 [VkBridge] Add video thumbnails (#3206) 2023-01-03 19:26:05 +01:00
Justin Goette
b58f2ed338 docs: Fix formatting (#3205) 2023-01-03 19:25:36 +01:00
csisoap
5d8ed2df51 [ReutersBridge] Only include main headline from Top News feed (#3199) 2022-12-31 07:05:25 +01:00
Justin Goette
910ccd3ad8 docs: Fix typo (#3196) 2022-12-28 00:34:49 +01:00
csisoap
2a69c585b8 [YoutubeBridge] fix blank page when duration limit used (#3192) 2022-12-18 08:23:18 +01:00
Dag
936ae8cca3 various fixes (#3190)
* fix: Call to a member function parent() on null

* fix: notice

fixes Trying to get property plaintext of non-object at bridges/WikiLeaksBridge.php line 96

* fix: CommonDreamsBridge
2022-12-13 21:04:57 +01:00
Dag
a13c4624fb feat: custom http ua in AO3, fix #3188 (#3189)
* refactor

* feat: custom http ua in AO3, #3188
2022-12-13 09:53:42 +01:00
Jan Justi
933be15a77 [docker-entrypoint.sh] Add custom formats (#3179) 2022-12-10 21:25:25 +01:00
Štěpán Škorpil
b4f9d27424 Added StreamCzBridge (#3187)
* Added StreamCzBridge

* Fixed codestyle on StreamCzBridge
2022-12-10 15:02:11 +01:00
Ololbu
7d5698a75f [TapasBridge] New bridge (#3184)
* [TapasBridge] New bridge

* [TapasBridge] Delete comment

* [TapasBridge] Delete context

* [TapasBridge] Delete context again

* [TapasBridge] Convert double quotes do single quotes

* [TapasBridge] Fix some lint errors

* [TapasBridge] Fix indentation style

* [TapasBridge] Fix some lint errors
2022-12-09 11:05:08 +01:00
Dag
ec1b9a110d fix: radiofrance, #3077 (#3186) 2022-12-08 21:36:28 +01:00
Dag
69518e95c1 feat: add tags to codeberg bridge, fix #3177 (#3185)
* refactor

* feat: add tags to codeberg bridge, fix #3177
2022-12-08 21:21:17 +01:00
Julien Papasian
59d3011c86 Add Nautiljon bridge (#3181) 2022-12-08 20:48:10 +01:00
Eugene Molotov
fdf380bccd [VkBridge] Remove junky 'Show more' button (#3176) 2022-12-03 04:58:25 +01:00
Steve Joerger
0423e1f268 Issue 3174 - Add docker-compose instructions to main README.md (#3175)
* Added instructions to use docker-compose copied from wiki with extra step of docker-compose command.

* Added header to differentiate docker-compose section. Added missing step to browse to url.
2022-12-03 04:56:37 +01:00
Dag
55b294665c fix: remove duplicate apt install in dockerfile (#3172) 2022-12-02 03:43:10 +01:00
Niehztog
7cf64daac9 Adds new Bridge for kitso.io episode feed (#3169)
* Adds new Bridge for kitso.io episode feed

* linter fixes, changed item titles

* more linter fixes

* fix bridge uri

* linter fixes

* added sorting of items by timestamp, added parameters to spicify show

* trying to fix linter again

* linter doesnt like tenary operators

* fix whitespace
2022-11-30 00:59:24 +01:00
Juan Jose Pablos
ca667d731c Update VproTegenlichtBridge.php (#3168)
Fix lint error
2022-11-29 15:19:16 +01:00
TinyWiFi
d38cd05bea Added vern.cc Public Instance (#3164)
done on behalf of ~vern admins (https://vern.cc/admins)
2022-11-27 17:10:57 +01:00
vincentvd1
9863204fa3 Feat: Add bridge for Vpro tegenlicht (#3162)
* [VproTegenlichtBridge.php] Created bridge

* [VproTegenlichtBridge.php] Added fetch exception
2022-11-25 20:39:56 +01:00
Dag
592ea8faa4 fix: TheHackerNewsBridge (#3159) 2022-11-22 19:09:49 +01:00
ORelio
f53e0e4bee [DarkReading] Convert pictures to plain images (#3158)
Convert <picture> to <img> element
2022-11-22 18:42:31 +01:00
ORelio
d592e2cb15 [Core] Add html/convertLazyLoading (+ document stripRecursiveHTMLSection) (#3157)
* [core] Add html/convertLazyLoading($dom)

Looks for lazy-loading attributes such as 'data-src' and converts
them back to regular ones such as 'src', easier for RSS readers.
It also converts <picture> elements to plain <img> elements.

* [core] Document html/stripRecursiveHTMLSection()

Add documentation for that function (no code changes).

* [WordPressBridge] Use convertLazyLoading()

* [WordPressBridge] Unwrap image figures

<img> inside <figure> may not display on RSS readers.
This converts them back to <img>, without losing caption if present.

* [ZDNet] Convert lazy loading images

* [code] html/stripRecursiveHTMLSection: Fix typo
2022-11-20 12:41:59 +01:00
Eugene Molotov
2f7f13d9fe [core] Implement SetBridgeCacheAction to store bridge's cache remotely (#3156) 2022-11-20 12:41:38 +01:00
Eugene Molotov
8990aeb9f4 [core] Merge GET and POST args into request array (#3155) 2022-11-20 12:41:20 +01:00
Dag
745a7ba122 fix: TheHackerNewsBridge (#3154) 2022-11-19 00:25:31 +01:00
Dag
88766e6fde fix: produce smaller log records for http exceptions (#3153) 2022-11-18 21:36:06 +01:00
Dag
4ac2feb392 docs: improve docs (#3152) 2022-11-17 18:51:37 +01:00
Dag
ebb82849e9 fix: notice in telegram (#3151)
* refactor: telegram

* fix: notice in telegram
2022-11-17 18:06:56 +01:00
Dag
3ee2c7f918 feat: new bridge RumbleBridge (#3150) 2022-11-17 18:06:35 +01:00
Dag
130212fba5 feat: new list of default bridges (#3148) 2022-11-17 18:06:19 +01:00
Dag
2e6facd863 docs: more screenshots (#3149) 2022-11-17 18:05:44 +01:00
Dawid Wróbel
b017f75767 [OLXBridge] new bridge (#2944)
* [OLXBridge] new bridge

* [OLXBridge] option to limit to shipping offers only

* [OLXBridge] set the feed title according to search query

* [OLXBridge] Fix PHP notices

* [OLXBridge] Remove trailing slash from the URL

* [OLXBridge] filter out the imposed additional search categories

* [OLXBridge] limit search to 'new' OLX platform variants

* [OLXBridge] Parse date, add ID, description

Deep-crawl all results. Penalty is low, as we were doing this for almost all of the results, anyway, yet it allows to obtain a unique ID, an uncomplicated Date string and a description.

Requires ext-intl for parsing the date according to locale.

* [OLXBridge] Parse date, add ID, description

Deep-crawl all results. Penalty is low, as we were doing this for almost all of the results, anyway, yet it allows to obtain a unique ID, an uncomplicated Date string and a description.

Requires ext-intl for parsing the date according to locale.

* [OLXBridge] Images are optional, handle appropriately

* [OLXBridge] handle the ID coming from sibling auto-moto portal

* [OLXBridge] handle the photos coming from sibling auto-moto portal

* [OLXBridge] use meta property to find img URL

* [OLXBridge] handle the date coming from sibling auto-moto portal

* [OLXBridge] use simplified syntax to retrieve content attribute value

* [OLXBridge] handle the description coming from sibling auto-moto portal

* [OLXBridge] fix phpcs complaints

* [OLXBridge] add categories

* [OLXBridge] handle the categories coming from sibling auto-moto portal

* [OLXBridge] hint image MIME type

OLX images have no obvious extension

* [OLXBridge] Fix content formatting

* [OLXBridge] URL is pattern-checked, so no need to check again

* [OLXBridge] return actual search query as URI
2022-11-17 17:57:05 +01:00
Dawid Wróbel
0726cce426 [AllegroBridge]: new bridge (#2942)
* [AllegroBridge]: new bridge

* [AllegroBridge] set feed name

* [AllegroBridge] fix notices

* [AllegroBridge] add images as attachments

* [AllegroBridge] cleanup code

* [AllegroBridge] add UID

* [AllegroBridge] add categories

* [AllegroBridge] fix pretty formatting

* [AllegroBridge] fix notice when offerExtraInfo is not found

* [AllegroBridge] add support for session cookie to prevent rate limiting

* [AllegroBridge] return inputted URL as URI

* [AllegroBridge] fix phpcs warning
2022-11-17 05:13:33 +01:00
Austin Huang
e788e14baa [MastodonBridge] Add support for various platforms (#3133)
* [MastodonBridge] Add support for various platforms

* [MastodonBridge] satisfy the lint
2022-11-16 18:05:01 +01:00
Dag
a5779d30b5 feat: add max file size to http responses (#3140) 2022-11-16 17:56:26 +01:00
Dawid Wróbel
c2c88e9876 Dockerfile: Use libcurl-impersonate in place of libcurl (#2941)
Fixes #2547
2022-11-15 17:32:44 +01:00
Dag
dbab225fd2 fix: Call to a member function find() on bool (#3146)
* fix: Call to a member function find() on bool

Happens when defaultLinkTo() is passed the empty string.

* fix: prevent exception in defaultLinkTo() when passed the empty string

* refactor
2022-11-15 03:01:27 +01:00
Dag
001427243c feat: system alert message (#3139) 2022-11-15 00:32:04 +01:00
Dag
95c199c2eb fix: various php notices (#3145)
* fix: notice

* fix: Trying to get property content of non-object at bridges/PcGamerBridge.php line 36

* fix: better exception message

* fix: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior
2022-11-15 00:30:51 +01:00
Joseph
734a5868b8 [FirefoxAddonsBridge] Fix removal of link redirects (#3144)
* [FirefoxAddonsBridge] Fix removable of link redirects

* Update FirefoxAddonsBridge.php
2022-11-14 22:56:12 +01:00
Paroleen
80f9871c9e [AwwwardsBridge] Fix sites parsing (#3141)
* [AwwwardsBridge] Fix sites parsing

* [AwwwardsBridge] Fix phpcs issue
2022-11-11 18:33:28 +01:00
Dag
b64f8f2a09 fix: various fixes (#3136) 2022-11-08 21:17:32 +01:00
quickwick
00ff0890bb Add item dimensions (width x height) and source URL (if it exists in JSON) (#3135) 2022-11-08 18:43:51 +01:00
Dag
86c3a969b8 feat: add admin telegram contact config (#3134) 2022-11-07 18:36:52 +01:00
Dag
2ef98b299f refactor: extract frontpage to template (#3130)
Also introduce usage of Response object
2022-11-07 18:22:54 +01:00
MarKoeh
fe59cbabc9 [ARDAudiothekBridge] added bridge ARDAudiothek.de (#3132)
* [ARDAudiothekBridge] added bridge ARDAudiothek.de

ARD, the union of Germany's regional public-service broadcasters, operates a video and an audio streaming service. The video streaming service is ARDMediathek, for which a bridge already exists. The audio streaming service is ARDAudiothek. This commit adds initial support for ARDAudiothek. It currently supports turning shows to feeds.

* [ARDAudiothekBridge]  fixed code style

Sorry. Forgot spaces surrounding the concatenation symbol
2022-11-04 19:03:12 +01:00
Alexander
aa14d4aafb [SteamAppNewsBridge] new bridge (#3126)
* [SteamAppNewsBridge] new bridge

* [SteamAppNewsBridge] test fixes
2022-11-03 21:43:33 +01:00
Dag
75772f58e2 fix: review news was not properly extracted (#3131)
Fix #3129
2022-11-03 21:42:26 +01:00
John S Long
400e137673 [DiscogsBridge] Add optional image, if personal access token is configured (#3083) 2022-11-03 20:33:43 +01:00
ORelio
4520ab6835 [WordPressBridge] Improve content extraction (#3125)
* [WordPressBridge] Improve content extraction

 - Pick up currently unmaintained bridge
 - Allow Custom item limit and lower default limit from 20 to 10
 - Allow Custom content selector for blogs with non-standard templates (#2173)
 - Remove content selector made for one specific blog (#2173 - can be a custom selector now)
 - Add '.article-content' class in the set of default selectors
 - Improve lazy-loading conversion

* [WordPressBridge] Fix phpcs issues
2022-10-31 20:59:19 +01:00
Dag
7250940a05 fix: prtester css replacement (#3123) 2022-10-29 12:25:45 +02:00
Eugene Molotov
8779c09e89 [PikabuBridge] Remove html elements from feed item author (#3122) 2022-10-29 12:14:12 +02:00
Dag
23f8c81646 refactor/fix: css organization and error rendering (#3117)
* fix: php notice

* refactor/feat: merge HtmlFormat.css into style.css

Also improve ux of error rendering.

* fix: center-align footer text
2022-10-29 10:46:37 +02:00
Dag
1b45a53402 fix: make filecache be case-sensitive on key (#3113) 2022-10-29 10:27:26 +02:00
Dag
e027bd9274 fix: improve FeedExpander (#3103)
* fix: improve FeedExpander

Include the first libxml error in exception.

Give better error message if trying to parse the empty string.

Log all libxml errors if debug mode is enabled.

* error handling and logging tweak
2022-10-29 10:27:02 +02:00
Dag
f9cd397900 Update README.md (#3121) 2022-10-29 10:21:51 +02:00
Dag
1f576312ea feat: in debug mode, include part of http response in exception message (#3090) 2022-10-29 08:42:50 +02:00
Justin Goette
85b87b9597 docs: Document returnFull parameter of getContents (#3120) 2022-10-29 03:30:49 +02:00
joaomqc
bef6fc5cbd [SpotifyBridge] Add playlists feed (#3116)
* [SpotifyBridge] Add playlists feed

* fix formatting

* remove whitespace

* merge artist and playlist feeds

* fix lint errors
2022-10-27 20:02:01 +02:00
Dag
314d4c7a3f fix: quickfix for heise, #3118 (#3119) 2022-10-27 19:59:45 +02:00
Dag
52af2ae34c fix: php errors (notices) (#3115) 2022-10-26 00:47:45 +02:00
Juan Jose Pablos
8795cb252f A bit of info on cookies. I need to expand more. (#3111)
* add a bit of info about cookies

* Use markdown to look nice

* Update FacebookBridge.md

Fix url
2022-10-25 14:32:47 +02:00
Dag
cf7896aeef fix: forever loop in golem (#3114) 2022-10-25 14:30:01 +02:00
ORelio
05f2fb5ec7 [FeedExpander] Decode HTML entities in title (#3110)
Feed item title may contain HTML entities that we need to decode,
else they are encoded twice when generating the expanded feed.
2022-10-20 18:26:43 +02:00
Eugene Molotov
d483bf2b81 [core] Implement bearer token authentication (#3043) 2022-10-19 18:39:35 +02:00
Korytov Pavel
5b53e76477 [ScientificAmericanBridge] Add bridge (#3109)
* [ScientificAmericanBridge] Add bridge

* [ScientificAmericanBridge] Fix lint errors and timeout
2022-10-19 18:34:11 +02:00
Juan Jose Pablos
6ae40496c8 docs: add facebook bridge page 2022-10-18 19:35:53 +02:00
Dag
58e321c915 fix: flickr (#3104) 2022-10-17 00:38:57 +02:00
Dag
37f1ab726b fix: various bug fixes (#3102)
* fix: Undefined offset: 4

* fix: Trying to access array offset on value of type bool

* fix: Undefined variable: photo at bridges/TelegramBridge.php line 287

* fix: Trying to get property innertext of non-object at bridges/ZDNetBridge.php line 186

* fix: Undefined index: Category at bridges/UnraidCommunityApplicationsBridge.php line 42

* fix: Undefined index: fullUrl at bridges/EuronewsBridge.php line 61
2022-10-16 20:26:33 +02:00
Dag
ffbc107687 Improve logging and error handling (#3059)
* refactor: logging and errror handling
2022-10-16 17:55:43 +02:00
Dag
e21394d2d3 refactor: html format (#3062)
* refactor: html format

Fix a few small bugs too

* fix

* fix

* trigger build

* striptags instead of encode title
2022-10-16 12:03:57 +02:00
John S Long
78fa03238c [MastodonBridge] Add support for GoToSocial (#3098)
* [MastodonBridge] Add support for GoToSocial

GoToSocial expects URLs in HTTP Signatures to include the query string; Mastodon
does not. To provide support for both types of ActivityPub services, define a
new parameter for signature types, defaulting to Mastodon's format.

This change also introduces auto-resolution of linked objects, which GoToSocial
uses instead of including content directly in a user's outbox.

* [MastodonBridge] Fix lint failure
2022-10-12 21:43:09 +02:00
Harvey Christian Pacleb
4d8e40e746 [HonkaiImpactSeaBridge] Add bridge (#3084) 2022-10-12 21:29:38 +02:00
floviolleau
3ea7d46837 [PanneauPocketBridge] enhancements (#2940)
* [PanneauPocketBridge] small fixes

* [PanneauPocketBridge] rename variable

* [PanneauPocketBridge] remove function call

Co-authored-by: Florent VIOLLEAU <florent.violleau@samsic.fr>
2022-10-12 21:10:58 +02:00
An | Anton Röhm
7895fa895f fix "cht on matrix" button (again) (#3101) 2022-10-12 20:48:34 +02:00
John S Long
5e664d9b2b [Dockerfile] Enable opcache for improved performance (#3097)
Opcache is a PHP extension that caches the bytecode PHP converts each script
into to reduce the work that needs to happen each request.
2022-10-09 21:14:24 +02:00
Korytov Pavel
56a8c521c2 [EconomistBridge] Fix bridge (#3095) 2022-10-08 20:05:17 +02:00
Christian Schabesberger
79f6ec5733 hide Nordbayern+ articles (#3094) 2022-10-08 15:34:26 +02:00
Dag
0a2e31e1f7 docs: sort public instances (#3093) 2022-10-06 22:12:55 +02:00
Dag
e65fd7c822 fix: remove debug line (#3092) 2022-10-06 21:05:50 +02:00
Wouter Koch
c4c2acab98 Add NOS Nieuws & Sport Bridge (#3069)
* Add NOS Nieuws & Sport Bridge

* Change classname to reflect filename (NOSBridge)
2022-10-05 19:41:21 +02:00
joshinat0r
8b7b32d516 [RedditBrige] Fix old feed URLs (#3087)
* flair filter

* syntax

* fix multi & user feeds

* '

* dont replace ,

* fix old reddit feeds
2022-10-05 19:35:02 +02:00
Dag
5d18852108 fix: more verbose error in fb (#3089) 2022-10-05 19:30:42 +02:00
Dag
44e5bf5338 docs: point to offical feed in qnap (#3088) 2022-10-05 19:21:02 +02:00
somini
8b91921a70 [AsahiShimbunAJWBridge]: Fix title extraction (#3085) 2022-10-04 21:23:49 +02:00
Nicolas Delsaux
1232de5744 Add new bridge RadioFranceBridge, fix #3077 (#3082)
As far as I understand, this supports all radio france sub-pages listing podcast and/or shows (tested with my two favorites shows, so not a very professionnal test).
We use here the data model provided by Radio France, which includes all data in an easily usable format.
2022-10-03 06:55:24 +02:00
John S Long
6b83bf25fd [RoosterTeethBridge] Add episode description, optional episode image (#3080) 2022-10-02 19:38:33 +02:00
joshinat0r
30d964b356 [RedditBridge] Search for specific flairs (#3067)
* flair filter

* syntax

* fix multi & user feeds

* '

* dont replace ,
2022-10-02 07:34:20 +02:00
John S Long
8dcc21a871 [RoosterTeethBridge] Add new channels (#3076) 2022-10-02 06:48:07 +02:00
John S Long
7252a89914 [LWNprevBridge] Fix article content parsing (#3078) 2022-10-02 06:46:04 +02:00
An | Anton Röhm
3198a48589 Fix broken "chat on matrix" button (#3075) 2022-10-01 08:43:34 +02:00
Corentin Garcia
7c96334e3b [GithubSearchBridge] Add programming language (#3074) 2022-10-01 08:42:50 +02:00
Corentin Garcia
c4d95558af [GenshinImpactBridge] fix missing articles (#3073) 2022-10-01 08:42:02 +02:00
Corentin Garcia
8ac5045963 [TheGuardianBridge] Fix missing article content (fix #3032) (#3072) 2022-10-01 08:41:19 +02:00
Corentin Garcia
4a21855e5c [EliteDangerousGalnetBridge] Fix missing news (#3071) 2022-10-01 08:40:57 +02:00
Tobias Alexander Franke
1ffd9ee61a [GoogleScholarBridge] Follow authors of scientific publications. (#3066)
* [GoogleScholarBridge] Follow authors of scientific publications.

* [GoogleScholarBridge] Fix linting.

* [GoogleScholarBridge] Fix more linting issues.

* [GoogleScholarBridge] Use author field in extracted page and drop publisher
2022-09-25 22:22:49 +02:00
Tobias Alexander Franke
faf63269a1 [BinanceBridge] Adapt code to new JSON structure and fetch full article (#3065)
* [BinanceBridge] Add new bridge

* [BinanceBridge] TravisCI fixes

* [BinanceBridge] PR fixes

* [BinanceBridge] Fix for Binance blog: Pull JSON data instead of HTML

* [BinanceBridge] Fix double quotes

* [BinanceBridge] Remove announcements category (because of Cloudflare)

* [BinanceBridge] Simplify code to bare minimum

* [BinanceBridge] Adapt code to new JSON structure and fetch full article

* [BinanceBridge] Fix linting issues
2022-09-25 19:19:35 +02:00
Dag
8cc5e44be6 fix: use parlers new api (#3061) 2022-09-24 00:02:19 +02:00
Dag
aacba5b1a8 fix: too strict url validation in feed item (#3058)
Urls such as https://example.com/réponse were rejected

Fix https://github.com/RSS-Bridge/rss-bridge/issues/3018#issuecomment-1254159203
2022-09-21 23:07:56 +02:00
Mynacol
9d871e8a45 [ZeitBridge] Add bridge for zeit.de (#3056)
* [ZeitBridge] Add bridge for zeit.de

New bridge expanding the feeds of zeit.de to full-text ones.
Circumvents cookie banners and Z+ premium article paywalls.

* [ZeitBridge] Formatting
2022-09-21 22:24:11 +02:00
Dag
aabbeef743 docs: add a better bridge example in readme (#3057) 2022-09-21 22:20:51 +02:00
Mynacol
8d8fe66aab [HeiseBridge] Parser rewrite (#3054)
* [HeiseBridge] Parser rewrite

This rewrite is more readable and consistent than the previous one.

Additionally, this removes unwanted elements, largely recommendations
for other articles.
Furthermore, it increases the image quality by using the original
picture link instead of the compressed ones.

* [HeiseBridge] Formatting
2022-09-21 21:31:43 +02:00
Eugene Molotov
3d9fead463 [ActionFactory] Allow camel-case action names (#3044)
Dash symbol is used to convert dash-seperated string to camel-cased string
2022-09-20 18:17:57 +02:00
Eugene Molotov
2db523a37a [VkBridge] Handle empty posts before fixing image links (#3052) 2022-09-20 18:07:57 +02:00
Eugene Molotov
6cd8b90d28 [VkBridge] Follow changes on HTTP redirection (#3051)
When visiting canonical link like https://vk.com/club1,
VK returns redirection response to non-canical link,
which raises "Unexpected redirect location" exception.

This patch removes path check in order to handle this situation
2022-09-20 18:07:31 +02:00
Tobias Zulauf
f660c16ca6 [TwitterV2Bridge] noexternallink option to remove external stuff from the content_html output (#3041)
* [TwitterV2Bridge] noexternallink option to remove external stuff from the content_html output

* Update bridges/TwitterV2Bridge.php

* Update bridges/TwitterV2Bridge.php
2022-09-20 18:07:18 +02:00
Eugene Molotov
a12152e8a5 [VkBridge] Code cleanup (#3047)
- Remove .page_album_link patch, since VK already patched its renderer
- Remove non working code, that tries to get clean video links
2022-09-19 19:22:41 +02:00
Dag
55cc74c816 feat: new bridge pokemonnews (#3042)
* feat: new bridge pokemonnews

fix #3040

* fix
2022-09-17 01:29:40 +02:00
Eugene Molotov
11220ef373 [VkBridge] Photo fixes (#3039)
This commit fixes following issues:

- Photos from user profile wall started appearing as blured
- On posts with photo collection small thumbnails are shown
2022-09-15 22:17:10 +02:00
quickwick
a1e229a7e1 feat: check EZTV mirrors for available site to query (#3036) 2022-09-15 17:47:57 +02:00
Sébastien SAUVAGE
925caff5dd Merge pull request #3037 from RSS-Bridge/sebsauvage-remove-public-host-sebsauvage.net
Removing public instance on sebsauvage.net
2022-09-15 11:35:15 +02:00
Sébastien SAUVAGE
0bf41a5726 Removing public instance on sebsauvage.net 2022-09-15 11:33:16 +02:00
Dag
6f7be67a8c fix: broken bridge abcnews (#3033)
Fix #3031
2022-09-13 19:00:51 +02:00
Dag
2d272117cc fix: dont error out for invalid env names (#3030) 2022-09-12 23:14:11 +02:00
Dag
5a9336df12 fix: wrong accept header in mastodonbridge (#3025)
Fixes bug introduced by afcc38786e because of
the default Accept header which caused xml to be returned.

Fix #3024
2022-09-10 07:38:09 +02:00
Dag
94ae098ef5 fix: various fixes (#3023)
* improve twitch error message

* fix worldcosplay notice

* fix: add new video image to telegram

* fix: reuters

* fix: formula1

* twitter
2022-09-09 20:18:50 +02:00
Dag
6ac347d5ac fix: add workaround for NYTBridge antibot (#3022) 2022-09-08 19:54:09 +02:00
Dag
27b3d7c34e feat: improve logging and error handling (#2994)
* feat: improve logging and error handling

* trim absolute path from file name

* fix: suppress php errors from xml parsing

* fix: respect the error reporting level in the custom error handler

* feat: dont log error which is produced by bots

* ignore error about invalid bridge name

* upgrade bridge exception from warning to error

* remove remnants of using phps builin error handler

* move responsibility of printing php error from logger to error handler

* feat: include url in log record context

* fix: always include url in log record contect

Also ignore more non-interesting exceptions.

* more verbose httpexception

* fix

* fix
2022-09-08 19:07:57 +02:00
Dag
5578a735d9 feat: allow more feeds in FeedMerge (#3021)
Fix #3011
2022-09-08 18:44:15 +02:00
Dag
e63e3d072c feat: new bridge QnapBridge (#3020) 2022-09-08 18:28:36 +02:00
Eugene Molotov
70ba6c5b53 [VkBridge] Manually handle redirects (#3017)
Some redirects are legit, some redirects lead to "Too many requests" page
2022-09-07 03:02:23 +02:00
Eugene Molotov
bbbd599bc8 fix: do not throw exception on 301-303 http responses (#3014) 2022-09-06 15:40:20 +02:00
Dag
0dab51e26f fix: php errors (#3013)
* fix: php error in tiktok bridge

* fix: notice in craigslist

* fix: php notice in wordpress bridge

* feat: improve ux in telegram bridge
2022-09-06 00:14:20 +02:00
Eugene Molotov
8033a5f461 [VkBridge] Fix photo URI retrieving (#3010)
VK stopped filling JSON structure containing information for generating URI to full size photo
2022-09-05 23:41:41 +02:00
Dag
8ea9472300 feat: improve exception message when xml parsing fails (#3009) 2022-09-05 14:26:11 +02:00
Dag
a2c7865226 fix: exclude mastodon boosts when told to do so (#3007) 2022-09-05 05:58:18 +02:00
quickwick
36f64a3258 feat: add preview for external urls in twitterv2 (#3006)
Fix #2430
2022-09-05 05:31:36 +02:00
Dag
51f6ec8dc1 Update README.md (#3005) 2022-09-05 02:32:06 +02:00
quickwick
8ffc002e53 fix: truncated retweet text in twitter bridge(#3004)
Fix #2988
2022-09-05 02:04:09 +02:00
Dag
cca11174e1 fix: php error in ViceBridge (#3003)
Fixes Undefined variable: article at bridges/ViceBridge.php line 37
2022-09-04 22:58:58 +02:00
Dag
9d16e81e17 fix: php error PHP Notice: Undefined index: author (#3002) 2022-09-04 19:07:04 +02:00
Dag
5e09a14acc fix: include git tag in version (#3000)
Also include os and php version in github issue template.
2022-09-04 07:21:57 +02:00
Dag
693d6edfbf fix: php7.3 parser error in Configuration.php (#2999)
Dont fail a basic lint so that the proper error message can be shown when on unsupported versions.
2022-09-04 04:50:01 +02:00
Dag
57d5aa45f7 fix: php notice in eztvbridge (#2998)
* fix: php notice in eztvbridge

Fixes Undefined property: stdClass::$torrents

* lint
2022-09-04 04:35:21 +02:00
Dag
b8f73618c1 fix: include playlist when processing soundcloud items (#2997) 2022-09-04 03:50:40 +02:00
Dag
f40ed566be fix: absolute urls for images in pixivbridge (#2993) 2022-09-02 20:35:17 +02:00
Dag
3c2353c0ec fix: bug in previous refactor (#2992)
fix #2991
2022-08-31 18:16:19 +02:00
Dag
97808abca1 refactor: rename rssbridge.php to bootstrap.php (#2987)
Fix #2986
2022-08-27 23:01:06 +02:00
Korytov Pavel
1ca4dd69f7 [InstituteForTheStudyOfWarBridge] Do not put HTML tags into title (#2985) 2022-08-25 19:48:16 +02:00
Korytov Pavel
c079dbb521 [InstituteForTheStudyOfWarBridge] Add bridge (#2984) 2022-08-25 19:22:19 +02:00
Eugene Molotov
43ad54dba0 [PikabuBridge] Skip sponsored posts (#2983)
* [PikabuBridge] Skip sponsored posts

Sponsored posts appear very rarely in html code.
But when they appear, they always have different url that results junk feed.

One of the example is [1]. After visiting it, you will be redirected to [2] that is marked as
"Партнёрский материал" in Russian, or "Sponsored post" in English.

[1] https://pikabu.ru/story/a_mla_posa_m_memu_seyla_otorathche_idomikhlenonoikhmyav_sseyla_otoratazoed__9388770?from=cpm
[2] https://pikabu.ru/story/kakim_dolzhen_byit_vash_noutbuk_9388770

* lint

Co-authored-by: Dag <me@dvikan.no>
2022-08-25 18:09:06 +02:00
Eugene Molotov
fd0d5350be [RutubeBridge] Include timestamp and author in feed (#2982) 2022-08-24 14:49:54 +02:00
Dag
5165ea265d fix: case-insensitive config from env, fix #2935 (#2973)
* refactor

* fix: case-sensitive config from env, fix #2935

* lowercase all config section and keys

* test: add test for case-insensitivity
2022-08-23 21:19:53 +02:00
Bocki
edbafc6144 [Teefury] Fix occasional problem (#2974) 2022-08-20 21:11:27 +02:00
Dag
0de1694371 refactor: extract index.php to RssBridge.php (#2961)
* refactor: extract entry point into class

* refactor: js

* refactor: extract frontpage action
2022-08-18 22:52:01 +02:00
Christian Schabesberger
372eccd7b2 [Nordbayern] Update regions (#2966) 2022-08-13 19:41:05 +02:00
Bocki
e99cbf21b2 [DailyShirts] Add daily shirt sites (#2962) 2022-08-12 14:51:38 +02:00
Miika Launiainen
08c1f55f4a Created Hanime bridge (#2958)
* Created Hanime bridge

* Moved cover image from enclosures to content as dvikan suggested
2022-08-10 23:46:17 +02:00
Dag
6253538342 docs: revamp README (#2954) 2022-08-06 23:22:50 +02:00
Dag
502799a74c feat: use bridge description and short name in search (#2952)
* refactor: search.js

* feat: use bridge description and short name in search

* fix bug in previous merge commit

Also reformat string from tabs to spaces
2022-08-06 23:12:30 +02:00
Dag
eef45d4e8d fix: TypeError (0): setlocale(): Argument #1 ($category) must be of type int, string given (#2951)
This was upgraded from a warning to an error in php 8.
2022-08-06 22:46:49 +02:00
Dag
2bbce8ebef refactor: general code base refactor (#2950)
* refactor

* fix: bug in previous refactor

* chore: exclude phpcompat sniff due to bug in phpcompat

* fix: do not leak absolute paths

* refactor/fix: batch extensions checking, fix DOS issue
2022-08-06 22:46:28 +02:00
Dag
b042412416 fix: force HTTP 1.1 in curl requests (#2949)
Since curl 7.62.0 the default option is: CURL_HTTP_VERSION_2TLS

Before that the default used to be: CURL_HTTP_VERSION_1_1

Fix #2947
2022-08-05 11:46:32 +02:00
Eugene Molotov
205f0a7239 [RutubeBridge] Fix regex for retreiving reduxState (#2955)
Before this commit regex captured window.reduxState value until first semicolon.
This is incorrect since it produces invalid json, if semicolon is
also somethere in the middle of stringified json.

After this commit regex will capture window.reduxState value until last semicolon.
2022-08-05 11:45:50 +02:00
Dag
3984427f44 feat: include os and php version in github issue body (#2948) 2022-08-03 17:05:13 +02:00
Dag
ecb486794b refactor: use static values for cache scope
This fixes a future problem when code is placed under a namespace because `get_class($bridge)` will then return e.g. `RssBridge\Bridge\TwitterBridge` instead of the the current value `TwitterBridge`.

Also a bit refactoring of `Configuration.php`.
2022-08-02 15:03:54 +02:00
Loïc Fürhoff
a0a0d5235b Remove MAINTAINER (#2946) 2022-07-31 21:42:40 +02:00
Dag
afcc38786e fix: use default headers in getContents() (#2927) 2022-07-31 04:21:56 +02:00
Dag
cd0ca7f645 fix: change default curl user agent (#2926) 2022-07-31 03:58:07 +02:00
Dag
0a060b2ad6 [Gab] feat: add new bridge GabBridge (#2920) 2022-07-31 03:52:27 +02:00
Jan Tojnar
5b5f3b4254 Do not use constants for configuration (#2938)
* docs: Do not use constant names when referring to config options

The options are customizable using a config file and no longer hardcoded in index.php since 8ac8e08abf

* Do not use constants for configuration

Since <8ac8e08abf>, they are just set to the configuration object values.
2022-07-24 19:26:12 +02:00
Dawid Wróbel
499d5c2b77 [Amazon & AmazonPriceTracker] Add Poland (#2930) 2022-07-21 20:41:15 +02:00
llamasblade
2c63d5707d [HytaleBridge] Improve bridge performance (#2928) 2022-07-21 20:33:00 +02:00
llamasblade
9b0f8095c2 [YandexZenBridge] Fix feed title if username not specified (#2922) 2022-07-13 12:08:11 +02:00
llamasblade
1294d3b953 [YandexZenBridge] Add bridge (#2921) 2022-07-13 01:08:05 +02:00
llamasblade
64c8d4ad37 [HytaleBridge] Improve bridge contents (#2912)
Co-authored-by: BuildTools <unconfigured@null.spigotmc.org>
2022-07-10 21:06:41 +02:00
Dag
5e52ecc3f8 test: add new test for Configuration (#2915) 2022-07-10 20:05:27 +02:00
Dag
c33f84fcc2 fix: disallow non-strings in GET parameters (#2908) 2022-07-10 19:50:51 +02:00
Dag
003ab58514 [FurAffinity] fix: errror (#2887)
They changed parts of the dom.

Fix error:
Error: Call to a member function find() on null

Fixes #2868
2022-07-10 19:48:37 +02:00
Loïc Fürhoff
87f8571ccf [Mailman2] Add bridge (#2877) 2022-07-10 19:40:03 +02:00
floviolleau
f1319f5b2b [PanneauPocket] add new bridge (#2823) 2022-07-10 19:36:01 +02:00
Dag
40dc0a2e5f [Euronews] fix: use correct url (#2916)
The non-www domain has a tls config error.
2022-07-09 22:50:03 +02:00
Bocki
e89329b2c6 [core] Fix daux generation (#2914) 2022-07-09 20:33:07 +02:00
Jan Tojnar
e07a94d480 Normalize some method calls (#2911)
The methods were called as static even though they were not.
2022-07-09 08:13:07 +02:00
Dag
a966213cd7 refactor: inject the action params via its execute method (#2907) 2022-07-08 21:06:14 +02:00
Jan Tojnar
22c10941dc docs: Update directory structure description (#2906)
- The css directory was moved in 1a4c3f4418
2022-07-08 21:00:32 +02:00
Dag
abc4af43b3 feat: improve error handling (#2902) 2022-07-08 20:39:13 +02:00
Dag
c992bcc8bf [AssociatedPressNews] fix: prepend lead photo to items (#2905) 2022-07-08 18:42:45 +02:00
Jan Tojnar
f672902896 Add .git-blame-ignore-revs file (#2903)
This will ignore coding style change commits in GitHub’s blame UI.

Same thing can be achieved locally using either `git blame --ignore-revs-file .git-blame-ignore-revs`
or `git config blame.ignoreRevsFile .git-blame-ignore-revs`

https://git-scm.com/docs/git-blame#Documentation/git-blame.txt---ignore-revs-fileltfilegt
https://docs.github.com/en/repositories/working-with-files/using-files/viewing-a-file#ignore-commits-in-the-blame-view
2022-07-08 17:00:34 +02:00
Dag
abfc6b4633 feat: introduce template engine (#2899) 2022-07-08 14:17:25 +02:00
Jan Tojnar
951092eef3 Fix coding style missed by phpbcf (#2901)
$ composer require --dev friendsofphp/php-cs-fixer

$ echo >.php-cs-fixer.dist.php "<?php

$finder = PhpCsFixer\Finder::create()
    ->in(__DIR__);

$rules = [
    '@PSR12' => true,
    // '@PSR12:risky' => true,
    '@PHP74Migration' => true,
    // '@PHP74Migration:risky' => true,
    // buggy, duplicates existing comment sometimes
    'no_break_comment' => false,
    'array_syntax' => true,
    'lowercase_static_reference' => true,
    'visibility_required' => false,
    // Too much noise
    'binary_operator_spaces' => false,
    'heredoc_indentation' => false,
    'trailing_comma_in_multiline' => false,
];

$config = new PhpCsFixer\Config();

return $config
    ->setRules($rules)
    // ->setRiskyAllowed(true)
    ->setFinder($finder);

"

$ vendor/bin/php-cs-fixer --version
PHP CS Fixer 3.8.0 BerSzcz against war! by Fabien Potencier and Dariusz Ruminski.
PHP runtime: 8.1.7

$ vendor/bin/php-cs-fixer fix
$ rm .php-cs-fixer.cache
$ vendor/bin/php-cs-fixer fix
2022-07-08 13:00:52 +02:00
Jan Tojnar
dbf8c5b7ae refactor(BridgeFactory): make methods only accept valid class names (#2897)
This moves the responsibility for getting a valid class name
to the users of BridgeFactory, avoiding the repeated sanitation.
Improper use can also be checked statically.
2022-07-08 12:54:23 +02:00
sal0max
20bf2aa4fe [ExplosmBridge] merge ExplosmBridge and CyanideAndHappinessBridge (#2844) 2022-07-08 00:23:29 +02:00
llamasblade
f887ce8f63 [HytaleBridge] Add bridge (#2900) 2022-07-07 15:12:35 +02:00
Tokariew
ea45717a28 [Instagram] fix: add ds_user_id (#2881)
Fix #2876
2022-07-07 12:08:21 +02:00
Jan Tojnar
d107f8ed30 Improve Factory variable names (#2895) 2022-07-06 12:14:04 +02:00
Bocki
e3dad86bca [core] prtester fix for optgroups (#2896) 2022-07-06 11:26:53 +02:00
Joseph
6c52e9bbc6 [TelegramBridge] Support telegram.me in detect params regex (#2891) 2022-07-06 03:48:49 +02:00
Jan Tojnar
e254dfbb9c ci: Fix PHPCompatibility again (#2892)
The fix in 66568e3a39 prevented an error
when installing phpcompatibility/php-compatibility but there was still
a warning before that when installing dealerdirect/phpcodesniffer-composer-installer.
With Composer 2.3.9, this is now an error too, so we need to move
the config change before that: https://getcomposer.org/changelog/2.3.9
2022-07-06 03:39:58 +02:00
Jan Tojnar
b444fa71f5 docs: Update requirements
This was forgotten in 8365a7a34d.
2022-07-06 03:34:37 +02:00
Jan Tojnar
ab6aca3163 lib/Configuration: Remove redundant comment
It was just getting out of sync:

- Minimum PHP version was bumped in 8365a7a34d
- Cache directory permission check was removed in 8e2b65556f
- Whitelist permission check was removed in d4e867f240
2022-07-06 03:34:37 +02:00
Jan Tojnar
7ee942621d composer: Update lockfile
composer.json was modified in 8365a7a34d
but the changes were not propagated to the lockfile,
resulting in warnings on every installation.
2022-07-06 03:34:37 +02:00
Dag
192fc0ee9b [FeedMerge] feat: remove duplicates (#2888)
Fix #2855
2022-07-05 15:39:00 +02:00
Dag
321ec7c8c1 refactor: move cache logic into the factory (#2884) 2022-07-05 13:20:01 +02:00
Dag
5b9b579652 refactor: remove unused class (#2883) 2022-07-05 10:50:39 +02:00
Dag
e918bda735 chore: introduce CONTRIBUTORS.md (#2839) 2022-07-04 07:33:23 +02:00
sal0max
7d941c2898 [Flaschenpost] Add bridge (#2808) 2022-07-04 07:29:22 +02:00
Dag
4f75591060 Reformat codebase v4 (#2872)
Reformat code base to PSR12

Co-authored-by: rssbridge <noreply@github.com>
2022-07-01 15:10:30 +02:00
Jan Tojnar
66568e3a39 ci: Fix PHPCompatibility (#2873)
> For additional security you should declare the allow-plugins config with a list of packages names that are allowed to run code. See https://getcomposer.org/allow-plugins
> You have until July 2022 to add the setting. Composer will then switch the default behavior to disallow all plugins.

Oops, it is July now.
2022-07-01 15:02:04 +02:00
Dag
9f2f1e526d [Instructables] refactor: conform to PSR2 (#2870) 2022-07-01 02:19:47 +02:00
Patrick Collins
2c7a9d7c45 [MangaDex] improve date handling (#2864)
prioritize new chapters rather than just edited ones.
should avoid batch-renaming drowning out new chapters, and existing items being re-sorted in the feed when they're edited.
documentation here: https://api.mangadex.org/docs/dates/
2022-06-26 08:50:51 +02:00
Dag
5076d09de6 refactor: prepare for PSR2 (#2859) 2022-06-24 18:29:35 +02:00
Dag
d2313bddcc feat: print which bridge is being processed (#2860) 2022-06-24 14:40:17 +02:00
Jan Tojnar
b1ae7603bf ci: Install PHPUnit as a Composer dependency (#2857)
Now that we dropped support for deprecated PHP versions,
we can use the same PHPUnit version on all supported PHP version.
Let’s install it as a Composer dependency to have the same
PHPUnit version on the CI as on developers’ computers.
2022-06-24 12:00:58 +02:00
KamaleiZestri
556f0b4237 [NewgroundsBridge] Add Bridge (#2849) 2022-06-24 11:59:24 +02:00
Yaman Qalieh
1e7ad6ed51 [PixivBridge] Remove backwards compatability hack (#2846)
There is no need for this since the context is guessed if it's not
provided.
2022-06-24 11:31:24 +02:00
Dag
92782e6c34 [GoogleSearch] feat: add verbatim option (#2858)
The verbatim option is the same as wrapping the query in quotes e.g. "rss-bridge".
2022-06-24 11:18:27 +02:00
Yaman Qalieh
1cfcacbbeb [BugzillaBridge] Add new bridge (#2825) 2022-06-24 11:04:49 +02:00
Yaman Qalieh
7d31d32750 [core] Fix bugs in release helper and document (#2819) 2022-06-24 11:02:33 +02:00
Yaman Qalieh
abb4c17a0d bridges: Update maintainer (#2856) 2022-06-22 13:07:54 -04:00
Dag
a166899633 [FeedMerge] fix bugs (#2854)
* [FeedMerge] fix: sort items by timestamp descending

* [FeedMerge] fix: fetch 10 most recent items

This fixes a bug where the bridge e.g. fetched 10 items from the first feed and then nothing from the rest
2022-06-22 18:34:05 +02:00
Dag
7dc3449207 [KilledByGoogle] fix: broken enclosure url (#2852)
* [KilledByGoogle] fix: broken enclosure url

The previous enclosure url was HTTP 404.

Also add link to items.

* fix: close unclosed <a> tag
2022-06-22 18:33:48 +02:00
Dag
bde00447f1 [Telegram] fix: remove all enclosures except for videos (#2850) 2022-06-22 18:33:21 +02:00
Dag
9d5f59e2db [GoogleSearch] fix: improve bridge (#2848)
Sort properly by date.
Fix php errors.
Improve the date parsing logic.
Improve the content parsing by also including those with · as separator
2022-06-22 18:32:54 +02:00
Dag
e7aebb223d fix: catch everything (#2837)
Improve ux.
2022-06-22 18:32:22 +02:00
Dag
ee80f4918e refactor: action (#2836) 2022-06-22 18:30:37 +02:00
Dag
fad0dbb6ef refactor: fix exception handling (#2835)
* refactor: fix exception handling

The removed catch is never uses in php versions above 7.
The need for multiple catch statements like this is to support both php 5 and 7.

* remove traces of old exception handling

* add typehints

* dont treat exception code 0 specially
2022-06-22 18:30:06 +02:00
Dag
07927008eb refactor: CacheFactory (#2834) 2022-06-22 18:29:28 +02:00
Dag
b7b9378484 refactor: ActionFactory (#2833) 2022-06-22 18:28:07 +02:00
Dag
af5648d928 refactor: FormatFactory (#2832) 2022-06-22 18:27:20 +02:00
Austin Huang
e9b8a1f9f9 [Mastodon] Use ActivityPub outbox for Mastodon (et al.) feed (#2756)
* Use ActivityPub outbox for Mastodon (et al.) feed

closes #2754

* Better description for Mastodon bridge

I mean I could rename it to ActivityPub bridge if the maintainer so pleases

* [Mastodon] Please the lint

* [Mastodon] address feedback

* [Mastodon] fix link, address spelling case bug

* refactor

* [Mastodon] add username cache, fix try-catch, rename

* [Mastodon] shorten description to satisfy the lint

* [Mastodon] address feedback

* [Mastodon] support Secure Mode instances

* [Mastodon] add config documentation

* [Mastodon] update docs

Co-authored-by: Dag <me@dvikan.no>
2022-06-20 19:11:46 -04:00
Dag
8365a7a34d chore: bump required php version to 7.4 (#2838)
* chore: require min php 7.4

* Revert "feat: backport php 7.3 functions (#2803)"

This reverts commit 6df5a4bc14.

* [BandcampDaily] use array_key_first

* hard fail on php versions below 7.4

* update phpcompat linter
2022-06-19 21:45:33 +02:00
Joseph
192dc4dae2 [TikTokBridge] Add bridge (#2828) 2022-06-18 21:59:39 -04:00
Korytov Pavel
c78c1254a8 [NovayaGazetaEuropeBridge] Add bridge (#2827) 2022-06-18 21:57:40 -04:00
Yaman Qalieh
65e6d9f454 [XPathAbstract] Improve Media Url regex (#2845) 2022-06-19 02:19:32 +02:00
Gilles
ce63d8a706 [YGGTorrentBridge] Changed base URL and one parameter name (#2826) 2022-06-17 23:06:59 -04:00
Eugene Molotov
d0bea1627e [InstagramBridge] Fix incorrect cache timeout calculation (#2840)
It is expected that getCacheTimeout returns integer. In fact
it returned boolean value which lead to situation, where Instagram feeds
were not cached.
2022-06-18 03:02:31 +02:00
Dag
c6ba3e5280 [Parler] fix: use new api endpoint (#2831)
They also modified the json structure.
2022-06-17 21:18:29 +02:00
Jan Tojnar
10eb1c9a95 [FormatAbstract]: Ensure sanitizeHtml is given string (#2791)
Sometimes `Item::getContent` returns `null`, in which case `sanitizeHtml`
would pass it to `str_replace`, which would raise `E_DEPRECATED` on PHP 8.1.
2022-06-17 20:46:15 +02:00
Yaman Qalieh
9ac494b350 [AstrophysicsDataSystemBridge] Add bridge (#2796) 2022-06-17 20:00:31 +02:00
Joseph
c6100d95ca [UberNewsroomBridge] Add more regions & use region name from JSON (#2817) 2022-06-14 22:18:16 -04:00
Yaman Qalieh
33e3d9b596 [Kanali6Bridge] Add bridge (#2798) 2022-06-14 20:08:55 -04:00
553 changed files with 67980 additions and 58731 deletions

8
.devcontainer/Dockerfile Normal file
View File

@@ -0,0 +1,8 @@
FROM rssbridge/rss-bridge:latest
RUN apt-get update && \
apt-get install --yes --no-install-recommends \
git && \
pecl install xdebug && \
pear install PHP_CodeSniffer && \
docker-php-ext-enable xdebug

View File

@@ -0,0 +1,27 @@
{
"name": "rss-bridge dev",
"build": { "dockerfile": "Dockerfile" },
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
// Set *default* container specific settings.json values on container create.
"settings": {
"php.validate.executablePath": "/usr/local/bin/php",
"phpSniffer.executablesFolder": "/usr/local/bin/",
"phpcs.executablePath": "/usr/local/bin/phpcs",
"phpcs.lintOnType": false
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"xdebug.php-debug",
"bmewburn.vscode-intelephense-client",
"philfontaine.autolaunch",
"eamodio.gitlens",
"shevaua.phpcs"
]
}
},
"forwardPorts": [3100, 9000, 9003],
"postCreateCommand": "cp .devcontainer/nginx.conf /etc/nginx/conf.d/default.conf && cp .devcontainer/xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini && mkdir .vscode && cp .devcontainer/launch.json .vscode && echo '*' > whitelist.txt && chmod a+x \"$(pwd)\" && rm -rf /var/www/html && ln -s \"$(pwd)\" /var/www/html && nginx && php-fpm -D"
}

49
.devcontainer/launch.json Normal file
View File

@@ -0,0 +1,49 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9003,
"auto": true
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 0,
"runtimeArgs": [
"-dxdebug.start_with_request=yes"
],
"env": {
"XDEBUG_MODE": "debug,develop",
"XDEBUG_CONFIG": "client_port=${port}"
}
},
{
"name": "Launch Built-in web server",
"type": "php",
"request": "launch",
"runtimeArgs": [
"-dxdebug.mode=debug",
"-dxdebug.start_with_request=yes",
"-S",
"localhost:0"
],
"program": "",
"cwd": "${workspaceRoot}",
"port": 9003,
"serverReadyAction": {
"pattern": "Development Server \\(http://localhost:([0-9]+)\\) started",
"uriFormat": "http://localhost:%s",
"action": "openExternally"
}
}
]
}

17
.devcontainer/nginx.conf Normal file
View File

@@ -0,0 +1,17 @@
server {
listen 3100 default_server;
root /workspaces/rss-bridge;
access_log /var/log/nginx/rssbridge.access.log;
error_log /var/log/nginx/rssbridge.error.log;
index index.php;
location ~ /(\.|vendor|tests) {
deny all;
return 403; # Forbidden
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass 127.0.0.1:9000;
}
}

7
.devcontainer/xdebug.ini Normal file
View File

@@ -0,0 +1,7 @@
[xdebug]
xdebug.mode=develop,debug
xdebug.client_host=localhost
xdebug.client_port=9003
xdebug.start_with_request=yes
xdebug.discover_client_host=false
xdebug.log='/var/www/html/xdebug.log'

4
.git-blame-ignore-revs Normal file
View File

@@ -0,0 +1,4 @@
# Reformat code base to PSR12
4f75591060d95208a301bc6bf460d875631b29cc
# Fix coding style missed by phpbcf
951092eef374db048b77bac85e75e3547bfac702

20
.github/prtester.py vendored
View File

@@ -16,6 +16,7 @@ def testBridges(bridges,status):
if bridge.get('data-ref'): # Some div entries are empty, this ignores those
bridgeid = bridge.get('id')
bridgeid = bridgeid.split('-')[1] # this extracts a readable bridge name from the bridge metadata
print(bridgeid + "\n")
bridgestring = '/?action=display&bridge=' + bridgeid + '&format=Html'
forms = bridge.find_all("form")
formid = 1
@@ -51,20 +52,27 @@ def testBridges(bridges,status):
for listing in lists:
selectionvalue = ''
listname = listing.get('name')
if 'optgroup' in listing.contents[0].name:
listing = list(itertools.chain.from_iterable(listing))
for selectionentry in listing:
cleanlist = []
for option in listing.contents:
if 'optgroup' in option.name:
cleanlist.extend(option)
else:
cleanlist.append(option)
firstselectionentry = 1
for selectionentry in cleanlist:
if firstselectionentry:
selectionvalue = selectionentry.get('value')
firstselectionentry = 0
else:
if 'selected' in selectionentry.attrs:
selectionvalue = selectionentry.get('value')
break
if selectionvalue == '':
selectionvalue = listing.contents[0].get('value')
formstring = formstring + '&' + listname + '=' + selectionvalue
if not errormessages:
# if all example/default values are present, form the full request string, run the request, replace the static css
# file with the url of em's public instance and then upload it to termpad.com, a pastebin-like-site.
r = requests.get(URL + bridgestring + formstring)
pagetext = r.text.replace('static/HtmlFormat.css','https://feed.eugenemolotov.ru/static/HtmlFormat.css')
pagetext = r.text.replace('static/style.css','https://rss-bridge.org/bridge01/static/style.css')
pagetext = pagetext.encode("utf_8")
termpad = requests.post(url="https://termpad.com/", data=pagetext)
termpadurl = termpad.text

View File

@@ -17,11 +17,11 @@ jobs:
steps:
-
name: Checkout
uses: actions/checkout@v2.3.4
uses: actions/checkout@v3
-
name: Docker meta
id: docker_meta
uses: docker/metadata-action@v3.5.0
uses: docker/metadata-action@v4
with:
images: |
${{ env.DOCKERHUB_SLUG }}
@@ -33,26 +33,26 @@ jobs:
type=raw,value=stable,enable=${{ startsWith(github.ref, 'refs/tags/20') }}
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1.6.0
uses: docker/setup-buildx-action@v2
-
name: Login to DockerHub
uses: docker/login-action@v1.10.0
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
-
name: Login to GitHub Container Registry
uses: docker/login-action@v1.10.0
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Build and push
uses: docker/bake-action@v1.6.0
uses: docker/bake-action@v2
with:
files: |
./docker-bake.hcl

View File

@@ -9,11 +9,11 @@ jobs:
documentation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
persist-credentials: false
- name: Setup PHP
uses: shivammathur/setup-php@2.17.1
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
- name: Install dependencies
@@ -21,7 +21,7 @@ jobs:
- name: Generate documentation
run: daux generate
- name: Deploy same repository 🚀
uses: JamesIves/github-pages-deploy-action@v4.2.5
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: "static"
branch: gh-pages

View File

@@ -11,9 +11,9 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
php-versions: ['7.1', '7.2', '7.3', '7.4']
php-versions: ['7.4']
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
@@ -24,12 +24,13 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
php-versions: ['7.1', '7.4']
php-versions: ['7.4']
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
- run: composer global config --no-plugins allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
- run: composer global require dealerdirect/phpcodesniffer-composer-installer
- run: composer global require phpcompatibility/php-compatibility
- run: ~/.composer/vendor/bin/phpcs . --standard=phpcompatibility.xml --warning-severity=0 --extensions=php -p
@@ -37,7 +38,7 @@ jobs:
executable_php_files_check:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- run: |
if find -name "*.php" -executable -type f -print -exec false {} +
then

View File

@@ -11,7 +11,7 @@ jobs:
# Needs additional permissions https://github.com/actions/first-interaction/issues/10#issuecomment-1041402989
steps:
- name: Check out self
uses: actions/checkout@v2.3.2
uses: actions/checkout@v3
with:
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
@@ -31,7 +31,7 @@ jobs:
docker build -t prbuild .;
docker run -d -v $GITHUB_WORKSPACE/whitelist.txt:/app/whitelist.txt -v $GITHUB_WORKSPACE/DEBUG:/app/DEBUG -p 3001:80 prbuild
- name: Setup python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: '3.7'
cache: 'pip'
@@ -48,8 +48,7 @@ jobs:
body="${body//'%'/'%25'}";
body="${body//$'\n'/'%0A'}";
body="${body//$'\r'/'%0D'}";
echo "::set-output name=bodylength::${#body}"
echo "::set-output name=body::$body"
echo "bodylength=${#body}" >> $GITHUB_OUTPUT
- name: Find Comment
if: ${{ steps.testrun.outputs.bodylength > 130 }}
uses: peter-evans/find-comment@v2
@@ -64,6 +63,5 @@ jobs:
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
${{ steps.testrun.outputs.body }}
body-file: comment.txt
edit-mode: replace

View File

@@ -7,28 +7,15 @@ on:
branches: [ master ]
jobs:
phpunit7:
runs-on: ubuntu-20.04
strategy:
matrix:
php-versions: ['7.1', '7.2', '7.3']
steps:
- uses: actions/checkout@v2
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
- run: composer global require phpunit/phpunit ^7
- run: phpunit --configuration=phpunit.xml --include-path=lib/
phpunit8:
runs-on: ubuntu-20.04
strategy:
matrix:
php-versions: ['7.3', '7.4', '8.0', '8.1']
php-versions: ['7.4', '8.0', '8.1']
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
- run: composer global require phpunit/phpunit ^8
- run: phpunit --configuration=phpunit.xml --include-path=lib/
- run: composer install
- run: composer test

223
CONTRIBUTORS.md Normal file
View File

@@ -0,0 +1,223 @@
# Contributors
* [16mhz](https://github.com/16mhz)
* [adamchainz](https://github.com/adamchainz)
* [Ahiles3005](https://github.com/Ahiles3005)
* [akirk](https://github.com/akirk)
* [Albirew](https://github.com/Albirew)
* [aledeg](https://github.com/aledeg)
* [alex73](https://github.com/alex73)
* [alexAubin](https://github.com/alexAubin)
* [Alkarex](https://github.com/Alkarex)
* [AmauryCarrade](https://github.com/AmauryCarrade)
* [arnd-s](https://github.com/arnd-s)
* [ArthurHoaro](https://github.com/ArthurHoaro)
* [Astalaseven](https://github.com/Astalaseven)
* [Astyan-42](https://github.com/Astyan-42)
* [austinhuang0131](https://github.com/austinhuang0131)
* [AxorPL](https://github.com/AxorPL)
* [ayacoo](https://github.com/ayacoo)
* [az5he6ch](https://github.com/az5he6ch)
* [b1nj](https://github.com/b1nj)
* [benasse](https://github.com/benasse)
* [Binnette](https://github.com/Binnette)
* [BoboTiG](https://github.com/BoboTiG)
* [Bockiii](https://github.com/Bockiii)
* [captn3m0](https://github.com/captn3m0)
* [chemel](https://github.com/chemel)
* [Chouchen](https://github.com/Chouchen)
* [ckiw](https://github.com/ckiw)
* [cn-tools](https://github.com/cn-tools)
* [cnlpete](https://github.com/cnlpete)
* [corenting](https://github.com/corenting)
* [couraudt](https://github.com/couraudt)
* [csisoap](https://github.com/csisoap)
* [da2x](https://github.com/da2x)
* [dabenzel](https://github.com/dabenzel)
* [Daiyousei](https://github.com/Daiyousei)
* [dawidsowa](https://github.com/dawidsowa)
* [DevonHess](https://github.com/DevonHess)
* [dhuschde](https://github.com/dhuschde)
* [disk0x](https://github.com/disk0x)
* [DJCrashdummy](https://github.com/DJCrashdummy)
* [Djuuu](https://github.com/Djuuu)
* [DnAp](https://github.com/DnAp)
* [dominik-th](https://github.com/dominik-th)
* [Draeli](https://github.com/Draeli)
* [Dreckiger-Dan](https://github.com/Dreckiger-Dan)
* [drego85](https://github.com/drego85)
* [drklee3](https://github.com/drklee3)
* [DRogueRonin](https://github.com/DRogueRonin)
* [dvikan](https://github.com/dvikan)
* [eggwhalefrog](https://github.com/eggwhalefrog)
* [em92](https://github.com/em92)
* [eMerzh](https://github.com/eMerzh)
* [EtienneM](https://github.com/EtienneM)
* [f0086](https://github.com/f0086)
* [fanch317](https://github.com/fanch317)
* [fatuuse](https://github.com/fatuuse)
* [fivefilters](https://github.com/fivefilters)
* [floviolleau](https://github.com/floviolleau)
* [fluffy-critter](https://github.com/fluffy-critter)
* [fmachen](https://github.com/fmachen)
* [Frenzie](https://github.com/Frenzie)
* [fulmeek](https://github.com/fulmeek)
* [ggiessen](https://github.com/ggiessen)
* [gileri](https://github.com/gileri)
* [Ginko-Aloe](https://github.com/Ginko-Aloe)
* [girlpunk](https://github.com/girlpunk)
* [Glandos](https://github.com/Glandos)
* [gloony](https://github.com/gloony)
* [GregThib](https://github.com/GregThib)
* [griffaurel](https://github.com/griffaurel)
* [Grummfy](https://github.com/Grummfy)
* [gsantner](https://github.com/gsantner)
* [guigot](https://github.com/guigot)
* [hollowleviathan](https://github.com/hollowleviathan)
* [hpacleb](https://github.com/hpacleb)
* [hunhejj](https://github.com/hunhejj)
* [husim0](https://github.com/husim0)
* [IceWreck](https://github.com/IceWreck)
* [imagoiq](https://github.com/imagoiq)
* [j0k3r](https://github.com/j0k3r)
* [JackNUMBER](https://github.com/JackNUMBER)
* [jacquesh](https://github.com/jacquesh)
* [jakubvalenta](https://github.com/jakubvalenta)
* [JasonGhent](https://github.com/JasonGhent)
* [jcgoette](https://github.com/jcgoette)
* [jdesgats](https://github.com/jdesgats)
* [jdigilio](https://github.com/jdigilio)
* [JeremyRand](https://github.com/JeremyRand)
* [JimDog546](https://github.com/JimDog546)
* [jNullj](https://github.com/jNullj)
* [Jocker666z](https://github.com/Jocker666z)
* [johnnygroovy](https://github.com/johnnygroovy)
* [johnpc](https://github.com/johnpc)
* [joni1993](https://github.com/joni1993)
* [jtojnar](https://github.com/jtojnar)
* [KamaleiZestri](https://github.com/KamaleiZestri)
* [kkoyung](https://github.com/kkoyung)
* [klimplant](https://github.com/klimplant)
* [KN4CK3R](https://github.com/KN4CK3R)
* [kolarcz](https://github.com/kolarcz)
* [kranack](https://github.com/kranack)
* [kraoc](https://github.com/kraoc)
* [krisu5](https://github.com/krisu5)
* [l1n](https://github.com/l1n)
* [laBecasse](https://github.com/laBecasse)
* [lagaisse](https://github.com/lagaisse)
* [lalannev](https://github.com/lalannev)
* [langfingaz](https://github.com/langfingaz)
* [lassana](https://github.com/lassana)
* [ldidry](https://github.com/ldidry)
* [Leomaradan](https://github.com/Leomaradan)
* [leyrer](https://github.com/leyrer)
* [liamka](https://github.com/liamka)
* [Limero](https://github.com/Limero)
* [LogMANOriginal](https://github.com/LogMANOriginal)
* [lorenzos](https://github.com/lorenzos)
* [lukasklinger](https://github.com/lukasklinger)
* [m0zes](https://github.com/m0zes)
* [Mar-Koeh](https://github.com/Mar-Koeh)
* [marcus-at-localhost](https://github.com/marcus-at-localhost)
* [marius8510000-bot](https://github.com/marius8510000-bot)
* [matthewseal](https://github.com/matthewseal)
* [mcbyte-it](https://github.com/mcbyte-it)
* [mdemoss](https://github.com/mdemoss)
* [melangue](https://github.com/melangue)
* [metaMMA](https://github.com/metaMMA)
* [mibe](https://github.com/mibe)
* [mickaelBert](https://github.com/mickaelBert)
* [mightymt](https://github.com/mightymt)
* [mitsukarenai](https://github.com/mitsukarenai)
* [Monocularity](https://github.com/Monocularity)
* [MonsieurPoutounours](https://github.com/MonsieurPoutounours)
* [mr-flibble](https://github.com/mr-flibble)
* [mro](https://github.com/mro)
* [mschwld](https://github.com/mschwld)
* [muekoeff](https://github.com/muekoeff)
* [mw80](https://github.com/mw80)
* [mxmehl](https://github.com/mxmehl)
* [Mynacol](https://github.com/Mynacol)
* [nel50n](https://github.com/nel50n)
* [niawag](https://github.com/niawag)
* [Niehztog](https://github.com/Niehztog)
* [NikNikYkt](https://github.com/NikNikYkt)
* [Nono-m0le](https://github.com/Nono-m0le)
* [obsiwitch](https://github.com/obsiwitch)
* [Ololbu](https://github.com/Ololbu)
* [ORelio](https://github.com/ORelio)
* [otakuf](https://github.com/otakuf)
* [Park0](https://github.com/Park0)
* [Paroleen](https://github.com/Paroleen)
* [Patricol](https://github.com/Patricol)
* [paulchen](https://github.com/paulchen)
* [PaulVayssiere](https://github.com/PaulVayssiere)
* [pellaeon](https://github.com/pellaeon)
* [PeterDaveHello](https://github.com/PeterDaveHello)
* [Peterr-K](https://github.com/Peterr-K)
* [Piranhaplant](https://github.com/Piranhaplant)
* [pirnz](https://github.com/pirnz)
* [pit-fgfjiudghdf](https://github.com/pit-fgfjiudghdf)
* [pitchoule](https://github.com/pitchoule)
* [pmaziere](https://github.com/pmaziere)
* [Pofilo](https://github.com/Pofilo)
* [prysme01](https://github.com/prysme01)
* [pubak42](https://github.com/pubak42)
* [Qluxzz](https://github.com/Qluxzz)
* [quentinus95](https://github.com/quentinus95)
* [quickwick](https://github.com/quickwick)
* [rakoo](https://github.com/rakoo)
* [RawkBob](https://github.com/RawkBob)
* [regisenguehard](https://github.com/regisenguehard)
* [Riduidel](https://github.com/Riduidel)
* [rogerdc](https://github.com/rogerdc)
* [Roliga](https://github.com/Roliga)
* [ronansalmon](https://github.com/ronansalmon)
* [rremizov](https://github.com/rremizov)
* [s0lesurviv0r](https://github.com/s0lesurviv0r)
* [sal0max](https://github.com/sal0max)
* [sebsauvage](https://github.com/sebsauvage)
* [shutosg](https://github.com/shutosg)
* [simon816](https://github.com/simon816)
* [Simounet](https://github.com/Simounet)
* [somini](https://github.com/somini)
* [SpangleLabs](https://github.com/SpangleLabs)
* [SqrtMinusOne](https://github.com/SqrtMinusOne)
* [squeek502](https://github.com/squeek502)
* [StelFux](https://github.com/StelFux)
* [stjohnjohnson](https://github.com/stjohnjohnson)
* [Stopka](https://github.com/Stopka)
* [Strubbl](https://github.com/Strubbl)
* [sublimz](https://github.com/sublimz)
* [sunchaserinfo](https://github.com/sunchaserinfo)
* [SuperSandro2000](https://github.com/SuperSandro2000)
* [sysadminstory](https://github.com/sysadminstory)
* [t0stiman](https://github.com/t0stiman)
* [tameroski](https://github.com/tameroski)
* [teromene](https://github.com/teromene)
* [tgkenney](https://github.com/tgkenney)
* [thefranke](https://github.com/thefranke)
* [TheRadialActive](https://github.com/TheRadialActive)
* [theScrabi](https://github.com/theScrabi)
* [thezeroalpha](https://github.com/thezeroalpha)
* [thibaultcouraud](https://github.com/thibaultcouraud)
* [timendum](https://github.com/timendum)
* [TitiTestScalingo](https://github.com/TitiTestScalingo)
* [tomaszkane](https://github.com/tomaszkane)
* [tomershvueli](https://github.com/tomershvueli)
* [TotalCaesar659](https://github.com/TotalCaesar659)
* [tpikonen](https://github.com/tpikonen)
* [TReKiE](https://github.com/TReKiE)
* [triatic](https://github.com/triatic)
* [User123698745](https://github.com/User123698745)
* [VerifiedJoseph](https://github.com/VerifiedJoseph)
* [vitkabele](https://github.com/vitkabele)
* [WalterBarrett](https://github.com/WalterBarrett)
* [wtuuju](https://github.com/wtuuju)
* [xurxof](https://github.com/xurxof)
* [yamanq](https://github.com/yamanq)
* [yardenac](https://github.com/yardenac)
* [ymeister](https://github.com/ymeister)
* [yue-dongchen](https://github.com/yue-dongchen)
* [ZeNairolf](https://github.com/ZeNairolf)

View File

@@ -1,4 +1,6 @@
FROM php:7.4.29-fpm
FROM lwthiker/curl-impersonate:0.5-ff-slim-buster AS curlimpersonate
FROM php:8.0.27-fpm-buster AS rssbridge
LABEL description="RSS-Bridge is a PHP project capable of generating RSS and Atom feeds for websites that don't have one."
LABEL repository="https://github.com/RSS-Bridge/rss-bridge"
@@ -9,16 +11,26 @@ RUN apt-get update && \
nginx \
zlib1g-dev \
libzip-dev \
libmemcached-dev && \
libmemcached-dev \
nss-plugin-pem \
libicu-dev && \
docker-php-ext-install zip && \
docker-php-ext-install intl && \
pecl install memcached && \
docker-php-ext-enable memcached && \
docker-php-ext-enable opcache && \
mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
COPY ./config/nginx.conf /etc/nginx/sites-enabled/default
COPY --chown=www-data:www-data ./ /app/
COPY --from=curlimpersonate /usr/local/lib/libcurl-impersonate-ff.so /usr/local/lib/curl-impersonate/
ENV LD_PRELOAD /usr/local/lib/curl-impersonate/libcurl-impersonate-ff.so
ENV CURL_IMPERSONATE ff91esr
EXPOSE 80
ENTRYPOINT ["/app/docker-entrypoint.sh"]

561
README.md
View File

@@ -1,42 +1,242 @@
# RSS-Bridge
![RSS-Bridge](static/logo_600px.png)
===
RSS-Bridge is a PHP project capable of generating RSS and Atom feeds for websites that don't have one.
[![LICENSE](https://img.shields.io/badge/license-UNLICENSE-blue.svg)](UNLICENSE)
[![GitHub release](https://img.shields.io/github/release/rss-bridge/rss-bridge.svg?logo=github)](https://github.com/rss-bridge/rss-bridge/releases/latest)
[![irc.libera.chat](https://img.shields.io/badge/irc.libera.chat-%23rssbridge-blue.svg)](https://web.libera.chat/#rssbridge)
[![Chat on Matrix](https://matrix.to/img/matrix-badge.svg)](https://matrix.to/#/#rssbridge:libera.chat)
[![Actions Status](https://img.shields.io/github/workflow/status/RSS-Bridge/rss-bridge/Tests/master?label=GitHub%20Actions&logo=github)](https://github.com/RSS-Bridge/rss-bridge/actions)
[![Docker Build Status](https://img.shields.io/docker/cloud/build/rssbridge/rss-bridge?logo=docker)](https://hub.docker.com/r/rssbridge/rss-bridge/)
[![Actions Status](https://img.shields.io/github/actions/workflow/status/RSS-Bridge/rss-bridge/tests.yml?branch=master&label=GitHub%20Actions&logo=github)](https://github.com/RSS-Bridge/rss-bridge/actions)
RSS-Bridge is a PHP project capable of generating RSS and Atom feeds for websites that don't have one. It can be used on webservers or as a stand-alone application in CLI mode.
|||
|:-:|:-:|
|![Screenshot #1](/static/screenshot-1.png?raw=true)|![Screenshot #2](/static/screenshot-2.png?raw=true)|
|![Screenshot #3](/static/screenshot-3.png?raw=true)|![Screenshot #4](/static/screenshot-4.png?raw=true)|
|![Screenshot #5](/static/screenshot-5.png?raw=true)|![Screenshot #6](/static/screenshot-6.png?raw=true)|
|![Screenshot #7](/static/twitter-form.png?raw=true)|![Screenshot #8](/static/twitter-rasmus.png?raw=true)|
**Important**: RSS-Bridge is __not__ a feed reader or feed aggregator, but a tool to generate feeds that are consumed by feed readers and feed aggregators. Find a list of feed aggregators on [Wikipedia](https://en.wikipedia.org/wiki/Comparison_of_feed_aggregators).
## A subset of bridges
Supported sites/pages (examples)
===
* `Bandcamp` : Returns last release from [bandcamp](https://bandcamp.com/) for a tag
* `Cryptome` : Returns the most recent documents from [Cryptome.org](https://cryptome.org/)
* `DansTonChat`: Most recent quotes from [danstonchat.com](https://danstonchat.com/)
* `DuckDuckGo`: Most recent results from [DuckDuckGo.com](https://duckduckgo.com/)
* `Facebook` : Returns the latest posts on a page or profile on [Facebook](https://facebook.com/) (There is an [issue](https://github.com/RSS-Bridge/rss-bridge/issues/2047) for public instances)
* `FlickrExplore` : [Latest interesting images](https://www.flickr.com/explore) from Flickr
* `GoogleSearch` : Most recent results from Google Search
* `Identi.ca` : Identica user timeline (Should be compatible with other Pump.io instances)
* `Instagram`: Most recent photos from an Instagram user (It is recommended to [configure](https://rss-bridge.github.io/rss-bridge/Bridge_Specific/Instagram.html) this bridge to work)
* `OpenClassrooms`: Lastest tutorials from [openclassrooms.com](https://openclassrooms.com/)
* `Pinterest`: Most recent photos from user or search
* `ScmbBridge`: Newest stories from [secouchermoinsbete.fr](https://secouchermoinsbete.fr/)
* `ThePirateBay` : Returns the newest indexed torrents from [The Pirate Bay](https://thepiratebay.se/) with keywords
* `Twitter` : Return keyword/hashtag search or user timeline
* `Wikipedia`: highlighted articles from [Wikipedia](https://wikipedia.org/) in English, German, French or Esperanto
* `YouTube` : YouTube user channel, playlist or search
* `Twitter` : Return keyword/hashtag search or user timeline
* `Telegram` : Return the latest posts from a public group
* `Reddit` : Return the latest posts from a subreddit or user
* `Filter` : Filter an existing feed url
* `Vk` : Latest posts from a user or group
* `FeedMerge` : Merge two or more existing feeds into one
* `Twitch` : Fetch the latest videos from a channel
* `ThePirateBay` : Returns the newest indexed torrents from [The Pirate Bay](https://thepiratebay.se/) with keywords
And [many more](bridges/), thanks to the community!
Output format
===
[Full documentation](https://rss-bridge.github.io/rss-bridge/index.html)
RSS-Bridge is capable of producing several output formats:
Check out RSS-Bridge right now on https://rss-bridge.org/bridge01 or find another
[public instance](https://rss-bridge.github.io/rss-bridge/General/Public_Hosts.html).
## Tutorial
RSS-Bridge requires php 7.4 (or higher).
### Install with composer or git
```shell
cd /var/www
composer create-project --no-dev rss-bridge/rss-bridge
```
```shell
cd /var/www
git clone https://github.com/RSS-Bridge/rss-bridge.git
```
Config:
```shell
# Give the http user write permission to the cache folder
chown www-data:www-data /var/www/rss-bridge/cache
# Optionally copy over the default config file
cp config.default.ini.php config.ini.php
```
Example config for nginx:
```nginx
# /etc/nginx/sites-enabled/rssbridge
server {
listen 80;
server_name example.com;
root /var/www/rss-bridge;
index index.php;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_read_timeout 60s;
fastcgi_pass unix:/run/php/php-fpm.sock;
}
}
```
### Install with Docker:
Install by using docker image from Docker Hub:
```bash
# Create container
docker create --name=rss-bridge --publish 3000:80 rssbridge/rss-bridge
# Start container
docker start rss-bridge
```
Browse http://localhost:3000/
Install by locally building the image:
```bash
# Build image from Dockerfile
docker build -t rss-bridge .
# Create container
docker create --name rss-bridge --publish 3000:80 rss-bridge
# Start the container
docker start rss-bridge
```
Browse http://localhost:3000/
#### Install with docker-compose
Create a `docker-compose.yml` file locally with with the following content:
```yml
version: '2'
services:
rss-bridge:
image: rssbridge/rss-bridge:latest
volumes:
- </local/custom/path>:/config
ports:
- 3000:80
restart: unless-stopped
```
Then launch with `docker-compose`:
```bash
docker-compose up
```
Browse http://localhost:3000/
### Alternative installation methods
[![Deploy on Scalingo](https://cdn.scalingo.com/deploy/button.svg)](https://my.scalingo.com/deploy?source=https://github.com/sebsauvage/rss-bridge)
[![Deploy to Heroku](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)
[![Deploy to Cloudron](https://cloudron.io/img/button.svg)](https://www.cloudron.io/store/com.rssbridgeapp.cloudronapp.html)
The Heroku quick deploy currently does not work. It might possibly work if you fork this repo and
modify the `repository` in `scalingo.json`. See https://github.com/RSS-Bridge/rss-bridge/issues/2688
Learn more in
[Installation](https://rss-bridge.github.io/rss-bridge/For_Hosts/Installation.html).
## How-to
### How to create a new bridge from scratch
Create the new bridge in e.g. `bridges/BearBlogBridge.php`:
```php
<?php
class BearBlogBridge extends BridgeAbstract
{
const NAME = 'BearBlog (bearblog.dev)';
public function collectData()
{
$dom = getSimpleHTMLDOM('https://herman.bearblog.dev/blog/');
foreach ($dom->find('.blog-posts li') as $li) {
$a = $li->find('a', 0);
$this->items[] = [
'title' => $a->plaintext,
'uri' => 'https://herman.bearblog.dev' . $a->href,
];
}
}
}
```
Learn more in [bridge api](https://rss-bridge.github.io/rss-bridge/Bridge_API/index.html).
### How to enable all bridges
enabled_bridges[] = *
### How to enable some bridges
```
enabled_bridges[] = TwitchBridge
enabled_bridges[] = GettrBridge
```
### How to enable debug mode
enable_debug_mode = true
Learn more in [debug mode](https://rss-bridge.github.io/rss-bridge/For_Developers/Debug_mode.html).
### How to create a new output format
[Create a new format](https://rss-bridge.github.io/rss-bridge/Format_API/index.html).
## Explanation
We are RSS-Bridge community, a group of developers continuing the project initiated by sebsauvage,
webmaster of
[sebsauvage.net](https://sebsauvage.net), author of
[Shaarli](https://sebsauvage.net/wiki/doku.php?id=php:shaarli) and
[ZeroBin](https://sebsauvage.net/wiki/doku.php?id=php:zerobin).
See [CONTRIBUTORS.md](CONTRIBUTORS.md)
RSS-Bridge uses caching to prevent services from banning your server for repeatedly updating feeds.
The specific cache duration can be different between bridges. Cached files are deleted automatically after 24 hours.
RSS-Bridge allows you to take full control over which bridges are displayed to the user.
That way you can host your own RSS-Bridge service with your favorite collection of bridges!
## Reference
### FeedItem properties
```php
$item = [
'uri' => 'https://example.com/blog/hello',
'title' => 'Hello world',
// Publication date in unix timestamp
'timestamp' => 1668706254,
'author' => 'Alice',
'content' => 'Here be item content',
'enclosures' => [
'https://example.com/foo.png',
'https://example.com/bar.png'
],
'categories' => [
'news',
'tech',
],
// Globally unique id
'uid' => 'e7147580c8747aad',
]
```
### Output formats:
* `Atom` : Atom feed, for use in feed readers
* `Html` : Simple HTML page
@@ -44,303 +244,7 @@ RSS-Bridge is capable of producing several output formats:
* `Mrss` : MRSS feed, for use in feed readers
* `Plaintext` : Raw text, for consumption by other applications
You can extend RSS-Bridge with your own format, using the [Format API](https://rss-bridge.github.io/rss-bridge/Format_API/index.html)!
Screenshot
===
Welcome screen:
![Screenshot](/static/screenshot_rss-bridge_welcome.png?raw=true)
RSS-Bridge hashtag (#rss-bridge) search on Twitter, in Atom format (as displayed by Firefox):
![Screenshot](/static/screenshot_twitterbridge_atom.png?raw=true)
Requirements
===
RSS-Bridge requires PHP 7.1 or higher with following extensions enabled:
- [`openssl`](https://secure.php.net/manual/en/book.openssl.php)
- [`libxml`](https://secure.php.net/manual/en/book.libxml.php)
- [`mbstring`](https://secure.php.net/manual/en/book.mbstring.php)
- [`simplexml`](https://secure.php.net/manual/en/book.simplexml.php)
- [`curl`](https://secure.php.net/manual/en/book.curl.php)
- [`json`](https://secure.php.net/manual/en/book.json.php)
- [`filter`](https://secure.php.net/manual/en/book.filter.php)
- [`zip`](https://secure.php.net/manual/en/book.zip.php) (for some bridges)
- [`sqlite3`](https://www.php.net/manual/en/book.sqlite3.php) (only when using SQLiteCache)
Find more information on our [Documentation](https://rss-bridge.github.io/rss-bridge/index.html)
Enable / Disable bridges
===
RSS-Bridge allows you to take full control over which bridges are displayed to the user. That way you can host your own RSS-Bridge service with your favorite collection of bridges!
Find more information on the [Documentation](https://rss-bridge.github.io/rss-bridge/For_Hosts/Whitelisting.html)
**Notice**: By default, RSS-Bridge will only show a small subset of bridges. Make sure to read up on [whitelisting](https://rss-bridge.github.io/rss-bridge/For_Hosts/Whitelisting.html) to unlock the full potential of RSS-Bridge!
Deploy
===
Thanks to the community, hosting your own instance of RSS-Bridge is as easy as clicking a button!
*Note: External providers' applications are packaged by 3rd parties. Use at your own discretion.*
[![Deploy on Scalingo](https://cdn.scalingo.com/deploy/button.svg)](https://my.scalingo.com/deploy?source=https://github.com/sebsauvage/rss-bridge)
[![Deploy to Heroku](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)
[![Deploy to Cloudron](https://cloudron.io/img/button.svg)](https://www.cloudron.io/store/com.rssbridgeapp.cloudronapp.html)
Getting involved
===
There are many ways for you to getting involved with RSS-Bridge. Here are a few things:
- Share RSS-Bridge with your friends (Twitter, Facebook, ..._you name it_...)
- Report broken bridges or bugs by opening [Issues](https://github.com/RSS-Bridge/rss-bridge/issues) on GitHub
- Request new features or suggest ideas (via [Issues](https://github.com/RSS-Bridge/rss-bridge/issues))
- Discuss bugs, features, ideas or [issues](https://github.com/RSS-Bridge/rss-bridge/issues)
- Add new bridges or improve the API
- Improve the [Documentation](https://rss-bridge.github.io/rss-bridge/)
- Host an instance of RSS-Bridge for your personal use or make it available to the community :sparkling_heart:
Authors
===
We are RSS-Bridge community, a group of developers continuing the project initiated by sebsauvage, webmaster of [sebsauvage.net](https://sebsauvage.net), author of [Shaarli](https://sebsauvage.net/wiki/doku.php?id=php:shaarli) and [ZeroBin](https://sebsauvage.net/wiki/doku.php?id=php:zerobin).
**Contributors** (sorted alphabetically):
<!--
Use this script to generate the list automatically (using the GitHub API):
./contrib/prepare_release/fetch_contributors.php
-->
* [16mhz](https://github.com/16mhz)
* [adamchainz](https://github.com/adamchainz)
* [Ahiles3005](https://github.com/Ahiles3005)
* [akirk](https://github.com/akirk)
* [Albirew](https://github.com/Albirew)
* [aledeg](https://github.com/aledeg)
* [alex73](https://github.com/alex73)
* [alexAubin](https://github.com/alexAubin)
* [Alkarex](https://github.com/Alkarex)
* [AmauryCarrade](https://github.com/AmauryCarrade)
* [arnd-s](https://github.com/arnd-s)
* [ArthurHoaro](https://github.com/ArthurHoaro)
* [Astalaseven](https://github.com/Astalaseven)
* [Astyan-42](https://github.com/Astyan-42)
* [austinhuang0131](https://github.com/austinhuang0131)
* [AxorPL](https://github.com/AxorPL)
* [ayacoo](https://github.com/ayacoo)
* [az5he6ch](https://github.com/az5he6ch)
* [b1nj](https://github.com/b1nj)
* [benasse](https://github.com/benasse)
* [Binnette](https://github.com/Binnette)
* [BoboTiG](https://github.com/BoboTiG)
* [Bockiii](https://github.com/Bockiii)
* [captn3m0](https://github.com/captn3m0)
* [chemel](https://github.com/chemel)
* [Chouchen](https://github.com/Chouchen)
* [ckiw](https://github.com/ckiw)
* [cn-tools](https://github.com/cn-tools)
* [cnlpete](https://github.com/cnlpete)
* [corenting](https://github.com/corenting)
* [couraudt](https://github.com/couraudt)
* [csisoap](https://github.com/csisoap)
* [da2x](https://github.com/da2x)
* [dabenzel](https://github.com/dabenzel)
* [Daiyousei](https://github.com/Daiyousei)
* [dawidsowa](https://github.com/dawidsowa)
* [DevonHess](https://github.com/DevonHess)
* [dhuschde](https://github.com/dhuschde)
* [disk0x](https://github.com/disk0x)
* [DJCrashdummy](https://github.com/DJCrashdummy)
* [Djuuu](https://github.com/Djuuu)
* [DnAp](https://github.com/DnAp)
* [dominik-th](https://github.com/dominik-th)
* [Draeli](https://github.com/Draeli)
* [Dreckiger-Dan](https://github.com/Dreckiger-Dan)
* [drego85](https://github.com/drego85)
* [drklee3](https://github.com/drklee3)
* [DRogueRonin](https://github.com/DRogueRonin)
* [dvikan](https://github.com/dvikan)
* [eggwhalefrog](https://github.com/eggwhalefrog)
* [em92](https://github.com/em92)
* [eMerzh](https://github.com/eMerzh)
* [EtienneM](https://github.com/EtienneM)
* [f0086](https://github.com/f0086)
* [fanch317](https://github.com/fanch317)
* [fatuuse](https://github.com/fatuuse)
* [fivefilters](https://github.com/fivefilters)
* [floviolleau](https://github.com/floviolleau)
* [fluffy-critter](https://github.com/fluffy-critter)
* [fmachen](https://github.com/fmachen)
* [Frenzie](https://github.com/Frenzie)
* [fulmeek](https://github.com/fulmeek)
* [ggiessen](https://github.com/ggiessen)
* [gileri](https://github.com/gileri)
* [Ginko-Aloe](https://github.com/Ginko-Aloe)
* [girlpunk](https://github.com/girlpunk)
* [Glandos](https://github.com/Glandos)
* [gloony](https://github.com/gloony)
* [GregThib](https://github.com/GregThib)
* [griffaurel](https://github.com/griffaurel)
* [Grummfy](https://github.com/Grummfy)
* [gsantner](https://github.com/gsantner)
* [guigot](https://github.com/guigot)
* [hollowleviathan](https://github.com/hollowleviathan)
* [hpacleb](https://github.com/hpacleb)
* [hunhejj](https://github.com/hunhejj)
* [husim0](https://github.com/husim0)
* [IceWreck](https://github.com/IceWreck)
* [imagoiq](https://github.com/imagoiq)
* [j0k3r](https://github.com/j0k3r)
* [JackNUMBER](https://github.com/JackNUMBER)
* [jacquesh](https://github.com/jacquesh)
* [jakubvalenta](https://github.com/jakubvalenta)
* [JasonGhent](https://github.com/JasonGhent)
* [jcgoette](https://github.com/jcgoette)
* [jdesgats](https://github.com/jdesgats)
* [jdigilio](https://github.com/jdigilio)
* [JeremyRand](https://github.com/JeremyRand)
* [JimDog546](https://github.com/JimDog546)
* [jNullj](https://github.com/jNullj)
* [Jocker666z](https://github.com/Jocker666z)
* [johnnygroovy](https://github.com/johnnygroovy)
* [johnpc](https://github.com/johnpc)
* [joni1993](https://github.com/joni1993)
* [jtojnar](https://github.com/jtojnar)
* [KamaleiZestri](https://github.com/KamaleiZestri)
* [kkoyung](https://github.com/kkoyung)
* [klimplant](https://github.com/klimplant)
* [KN4CK3R](https://github.com/KN4CK3R)
* [kolarcz](https://github.com/kolarcz)
* [kranack](https://github.com/kranack)
* [kraoc](https://github.com/kraoc)
* [krisu5](https://github.com/krisu5)
* [l1n](https://github.com/l1n)
* [laBecasse](https://github.com/laBecasse)
* [lagaisse](https://github.com/lagaisse)
* [lalannev](https://github.com/lalannev)
* [langfingaz](https://github.com/langfingaz)
* [lassana](https://github.com/lassana)
* [ldidry](https://github.com/ldidry)
* [Leomaradan](https://github.com/Leomaradan)
* [leyrer](https://github.com/leyrer)
* [liamka](https://github.com/liamka)
* [Limero](https://github.com/Limero)
* [LogMANOriginal](https://github.com/LogMANOriginal)
* [lorenzos](https://github.com/lorenzos)
* [lukasklinger](https://github.com/lukasklinger)
* [m0zes](https://github.com/m0zes)
* [Mar-Koeh](https://github.com/Mar-Koeh)
* [marcus-at-localhost](https://github.com/marcus-at-localhost)
* [marius8510000-bot](https://github.com/marius8510000-bot)
* [matthewseal](https://github.com/matthewseal)
* [mcbyte-it](https://github.com/mcbyte-it)
* [mdemoss](https://github.com/mdemoss)
* [melangue](https://github.com/melangue)
* [metaMMA](https://github.com/metaMMA)
* [mibe](https://github.com/mibe)
* [mickaelBert](https://github.com/mickaelBert)
* [mightymt](https://github.com/mightymt)
* [mitsukarenai](https://github.com/mitsukarenai)
* [Monocularity](https://github.com/Monocularity)
* [MonsieurPoutounours](https://github.com/MonsieurPoutounours)
* [mr-flibble](https://github.com/mr-flibble)
* [mro](https://github.com/mro)
* [mschwld](https://github.com/mschwld)
* [muekoeff](https://github.com/muekoeff)
* [mw80](https://github.com/mw80)
* [mxmehl](https://github.com/mxmehl)
* [Mynacol](https://github.com/Mynacol)
* [nel50n](https://github.com/nel50n)
* [niawag](https://github.com/niawag)
* [Niehztog](https://github.com/Niehztog)
* [NikNikYkt](https://github.com/NikNikYkt)
* [Nono-m0le](https://github.com/Nono-m0le)
* [obsiwitch](https://github.com/obsiwitch)
* [Ololbu](https://github.com/Ololbu)
* [ORelio](https://github.com/ORelio)
* [otakuf](https://github.com/otakuf)
* [Park0](https://github.com/Park0)
* [Paroleen](https://github.com/Paroleen)
* [Patricol](https://github.com/Patricol)
* [paulchen](https://github.com/paulchen)
* [PaulVayssiere](https://github.com/PaulVayssiere)
* [pellaeon](https://github.com/pellaeon)
* [PeterDaveHello](https://github.com/PeterDaveHello)
* [Peterr-K](https://github.com/Peterr-K)
* [Piranhaplant](https://github.com/Piranhaplant)
* [pirnz](https://github.com/pirnz)
* [pit-fgfjiudghdf](https://github.com/pit-fgfjiudghdf)
* [pitchoule](https://github.com/pitchoule)
* [pmaziere](https://github.com/pmaziere)
* [Pofilo](https://github.com/Pofilo)
* [prysme01](https://github.com/prysme01)
* [pubak42](https://github.com/pubak42)
* [Qluxzz](https://github.com/Qluxzz)
* [quentinus95](https://github.com/quentinus95)
* [quickwick](https://github.com/quickwick)
* [rakoo](https://github.com/rakoo)
* [RawkBob](https://github.com/RawkBob)
* [regisenguehard](https://github.com/regisenguehard)
* [Riduidel](https://github.com/Riduidel)
* [rogerdc](https://github.com/rogerdc)
* [Roliga](https://github.com/Roliga)
* [ronansalmon](https://github.com/ronansalmon)
* [rremizov](https://github.com/rremizov)
* [s0lesurviv0r](https://github.com/s0lesurviv0r)
* [sal0max](https://github.com/sal0max)
* [sebsauvage](https://github.com/sebsauvage)
* [shutosg](https://github.com/shutosg)
* [simon816](https://github.com/simon816)
* [Simounet](https://github.com/Simounet)
* [somini](https://github.com/somini)
* [SpangleLabs](https://github.com/SpangleLabs)
* [SqrtMinusOne](https://github.com/SqrtMinusOne)
* [squeek502](https://github.com/squeek502)
* [StelFux](https://github.com/StelFux)
* [stjohnjohnson](https://github.com/stjohnjohnson)
* [Stopka](https://github.com/Stopka)
* [Strubbl](https://github.com/Strubbl)
* [sublimz](https://github.com/sublimz)
* [sunchaserinfo](https://github.com/sunchaserinfo)
* [SuperSandro2000](https://github.com/SuperSandro2000)
* [sysadminstory](https://github.com/sysadminstory)
* [t0stiman](https://github.com/t0stiman)
* [tameroski](https://github.com/tameroski)
* [teromene](https://github.com/teromene)
* [tgkenney](https://github.com/tgkenney)
* [thefranke](https://github.com/thefranke)
* [TheRadialActive](https://github.com/TheRadialActive)
* [theScrabi](https://github.com/theScrabi)
* [thezeroalpha](https://github.com/thezeroalpha)
* [thibaultcouraud](https://github.com/thibaultcouraud)
* [timendum](https://github.com/timendum)
* [TitiTestScalingo](https://github.com/TitiTestScalingo)
* [tomaszkane](https://github.com/tomaszkane)
* [tomershvueli](https://github.com/tomershvueli)
* [TotalCaesar659](https://github.com/TotalCaesar659)
* [tpikonen](https://github.com/tpikonen)
* [TReKiE](https://github.com/TReKiE)
* [triatic](https://github.com/triatic)
* [User123698745](https://github.com/User123698745)
* [VerifiedJoseph](https://github.com/VerifiedJoseph)
* [vitkabele](https://github.com/vitkabele)
* [WalterBarrett](https://github.com/WalterBarrett)
* [wtuuju](https://github.com/wtuuju)
* [xurxof](https://github.com/xurxof)
* [yamanq](https://github.com/yamanq)
* [yardenac](https://github.com/yardenac)
* [ymeister](https://github.com/ymeister)
* [yue-dongchen](https://github.com/yue-dongchen)
* [ZeNairolf](https://github.com/ZeNairolf)
Licenses
===
### Licenses
The source code for RSS-Bridge is [Public Domain](UNLICENSE).
@@ -349,18 +253,9 @@ RSS-Bridge uses third party libraries with their own license:
* [`Parsedown`](https://github.com/erusev/parsedown) licensed under the [MIT License](https://opensource.org/licenses/MIT)
* [`PHP Simple HTML DOM Parser`](https://simplehtmldom.sourceforge.io/docs/1.9/index.html) licensed under the [MIT License](https://opensource.org/licenses/MIT)
* [`php-urljoin`](https://github.com/fluffy-critter/php-urljoin) licensed under the [MIT License](https://opensource.org/licenses/MIT)
* [php polyfills](https://github.com/symfony/polyfill) licensed under the [MIT License](https://opensource.org/licenses/MIT)
* [`Laravel framework`](https://github.com/laravel/framework/) licensed under the [MIT License](https://opensource.org/licenses/MIT)
Technical notes
===
* RSS-Bridge uses caching to prevent services from banning your server for repeatedly updating feeds. The specific cache duration can be different between bridges. Cached files are deleted automatically after 24 hours.
* You can implement your own bridge, [following these instructions](https://rss-bridge.github.io/rss-bridge/Bridge_API/index.html).
* You can enable debug mode to disable caching. Find more information on the [Wiki](https://rss-bridge.github.io/rss-bridge/For_Developers/Debug_mode.html)
Rant
===
## Rant
*Dear so-called "social" websites.*

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of RSS-Bridge, a PHP project capable of generating RSS and
* Atom feeds for websites that don't have one.
@@ -21,67 +22,48 @@
* - Returns a responsive web page that automatically checks all whitelisted
* bridges (using JavaScript) if no bridge is specified.
*/
class ConnectivityAction extends ActionAbstract {
public function execute() {
class ConnectivityAction implements ActionInterface
{
private BridgeFactory $bridgeFactory;
public function __construct()
{
$this->bridgeFactory = new BridgeFactory();
}
public function execute(array $request)
{
if (!Debug::isEnabled()) {
returnError('This action is only available in debug mode!', 400);
throw new \Exception('This action is only available in debug mode!');
}
if(!isset($this->userData['bridge'])) {
$this->returnEntryPage();
return;
if (!isset($request['bridge'])) {
return render_template('connectivity.html.php');
}
$bridgeName = $this->userData['bridge'];
$this->reportBridgeConnectivity($bridgeName);
$bridgeClassName = $this->bridgeFactory->createBridgeClassName($request['bridge']);
return $this->reportBridgeConnectivity($bridgeClassName);
}
/**
* Generates a report about the bridge connectivity status and sends it back
* to the user.
*
* The report is generated as Json-formatted string in the format
* {
* "bridge": "<bridge-name>",
* "successful": true/false
* }
*
* @param string $bridgeName Name of the bridge to generate the report for
* @return void
*/
private function reportBridgeConnectivity($bridgeName) {
$bridgeFac = new \BridgeFactory();
if(!$bridgeFac->isWhitelisted($bridgeName)) {
header('Content-Type: text/html');
returnServerError('Bridge is not whitelisted!');
private function reportBridgeConnectivity($bridgeClassName)
{
if (!$this->bridgeFactory->isEnabled($bridgeClassName)) {
throw new \Exception('Bridge is not whitelisted!');
}
header('Content-Type: text/json');
$retVal = array(
'bridge' => $bridgeName,
$retVal = [
'bridge' => $bridgeClassName,
'successful' => false,
'http_code' => 200,
);
];
$bridge = $bridgeFac->create($bridgeName);
if($bridge === false) {
echo json_encode($retVal);
return;
}
$curl_opts = array(
$bridge = $this->bridgeFactory->create($bridgeClassName);
$curl_opts = [
CURLOPT_CONNECTTIMEOUT => 5
);
];
try {
$reply = getContents($bridge::URI, array(), $curl_opts, true);
$reply = getContents($bridge::URI, [], $curl_opts, true);
if ($reply['code'] === 200) {
$retVal['successful'] = true;
@@ -89,45 +71,10 @@ class ConnectivityAction extends ActionAbstract {
$retVal['http_code'] = 301;
}
}
} catch(Exception $e) {
} catch (\Exception $e) {
$retVal['successful'] = false;
}
echo json_encode($retVal);
}
private function returnEntryPage() {
echo <<<EOD
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="static/bootstrap.min.css">
<link
rel="stylesheet"
href="https://use.fontawesome.com/releases/v5.6.3/css/all.css"
integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/"
crossorigin="anonymous">
<link rel="stylesheet" href="static/connectivity.css">
<script src="static/connectivity.js" type="text/javascript"></script>
</head>
<body>
<div id="main-content" class="container">
<div class="progress">
<div class="progress-bar" role="progressbar" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div id="status-message" class="sticky-top alert alert-primary alert-dismissible fade show" role="alert">
<i id="status-icon" class="fas fa-sync"></i>
<span>...</span>
<button type="button" class="close" data-dismiss="alert" aria-label="Close" onclick="stopConnectivityChecks()">
<span aria-hidden="true">&times;</span>
</button>
</div>
<input type="text" class="form-control" id="search" onkeyup="search()" placeholder="Search for bridge..">
</div>
</body>
</html>
EOD;
return new Response(Json::encode($retVal), 200, ['Content-Type' => 'text/json']);
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of RSS-Bridge, a PHP project capable of generating RSS and
* Atom feeds for websites that don't have one.
@@ -11,27 +12,28 @@
* @link https://github.com/rss-bridge/rss-bridge
*/
class DetectAction extends ActionAbstract {
public function execute() {
$targetURL = $this->userData['url']
or returnClientError('You must specify a url!');
class DetectAction implements ActionInterface
{
public function execute(array $request)
{
$targetURL = $request['url'] ?? null;
$format = $request['format'] ?? null;
$format = $this->userData['format']
or returnClientError('You must specify a format!');
if (!$targetURL) {
throw new \Exception('You must specify a url!');
}
if (!$format) {
throw new \Exception('You must specify a format!');
}
$bridgeFac = new \BridgeFactory();
$bridgeFactory = new BridgeFactory();
foreach($bridgeFac->getBridgeNames() as $bridgeName) {
if(!$bridgeFac->isWhitelisted($bridgeName)) {
foreach ($bridgeFactory->getBridgeClassNames() as $bridgeClassName) {
if (!$bridgeFactory->isEnabled($bridgeClassName)) {
continue;
}
$bridge = $bridgeFac->create($bridgeName);
if($bridge === false) {
continue;
}
$bridge = $bridgeFactory->create($bridgeClassName);
$bridgeParams = $bridge->detectParameters($targetURL);
@@ -39,14 +41,13 @@ class DetectAction extends ActionAbstract {
continue;
}
$bridgeParams['bridge'] = $bridgeName;
$bridgeParams['bridge'] = $bridgeClassName;
$bridgeParams['format'] = $format;
header('Location: ?action=display&' . http_build_query($bridgeParams), true, 301);
die();
$url = '?action=display&' . http_build_query($bridgeParams);
return new Response('', 301, ['Location' => $url]);
}
returnClientError('No bridge found for given URL: ' . $targetURL);
throw new \Exception('No bridge found for given URL: ' . $targetURL);
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of RSS-Bridge, a PHP project capable of generating RSS and
* Atom feeds for websites that don't have one.
@@ -11,255 +12,249 @@
* @link https://github.com/rss-bridge/rss-bridge
*/
class DisplayAction extends ActionAbstract {
private function get_return_code($error) {
$returnCode = $error->getCode();
if ($returnCode === 301 || $returnCode === 302) {
# Don't pass redirect codes to the exterior
$returnCode = 508;
}
return $returnCode;
class DisplayAction implements ActionInterface
{
public function execute(array $request)
{
if (Configuration::getConfig('system', 'enable_maintenance_mode')) {
return new Response('503 Service Unavailable', 503);
}
public function execute() {
$bridge = array_key_exists('bridge', $this->userData) ? $this->userData['bridge'] : null;
$bridgeFactory = new BridgeFactory();
$format = $this->userData['format']
or returnClientError('You must specify a format!');
$bridgeClassName = $bridgeFactory->createBridgeClassName($request['bridge'] ?? '');
$bridgeFac = new \BridgeFactory();
// whitelist control
if(!$bridgeFac->isWhitelisted($bridge)) {
throw new \Exception('This bridge is not whitelisted', 401);
die;
$format = $request['format'] ?? null;
if (!$format) {
throw new \Exception('You must specify a format!');
}
if (!$bridgeFactory->isEnabled($bridgeClassName)) {
throw new \Exception('This bridge is not whitelisted');
}
// Data retrieval
$bridge = $bridgeFac->create($bridge);
$formatFactory = new FormatFactory();
$format = $formatFactory->create($format);
$bridge = $bridgeFactory->create($bridgeClassName);
$bridge->loadConfiguration();
$noproxy = array_key_exists('_noproxy', $this->userData)
&& filter_var($this->userData['_noproxy'], FILTER_VALIDATE_BOOLEAN);
if(defined('PROXY_URL') && PROXY_BYBRIDGE && $noproxy) {
$noproxy = $request['_noproxy'] ?? null;
if (
Configuration::getConfig('proxy', 'url')
&& Configuration::getConfig('proxy', 'by_bridge')
&& $noproxy
) {
// This const is only used once in getContents()
define('NOPROXY', true);
}
// Cache timeout
$cache_timeout = -1;
if(array_key_exists('_cache_timeout', $this->userData)) {
if(!CUSTOM_CACHE_TIMEOUT) {
unset($this->userData['_cache_timeout']);
$uri = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) . '?' . http_build_query($this->userData);
header('Location: ' . $uri, true, 301);
die();
}
$cache_timeout = filter_var($this->userData['_cache_timeout'], FILTER_VALIDATE_INT);
$cacheTimeout = $request['_cache_timeout'] ?? null;
if (Configuration::getConfig('cache', 'custom_timeout') && $cacheTimeout) {
$cacheTimeout = (int) $cacheTimeout;
} else {
$cache_timeout = $bridge->getCacheTimeout();
// At this point the query argument might still be in the url but it won't be used
$cacheTimeout = $bridge->getCacheTimeout();
}
// Remove parameters that don't concern bridges
$bridge_params = array_diff_key(
$this->userData,
$request,
array_fill_keys(
array(
[
'action',
'bridge',
'format',
'_noproxy',
'_cache_timeout',
'_error_time'
), '')
],
''
)
);
// Remove parameters that don't concern caches
$cache_params = array_diff_key(
$this->userData,
$request,
array_fill_keys(
array(
[
'action',
'format',
'_noproxy',
'_cache_timeout',
'_error_time'
), '')
],
''
)
);
// Initialize cache
$cacheFac = new CacheFactory();
$cacheFac->setWorkingDir(PATH_LIB_CACHES);
$cache = $cacheFac->create(Configuration::getConfig('cache', 'type'));
$cache = RssBridge::getCache();
$cache->setScope('');
$cache->purgeCache(86400); // 24 hours
$cache->setKey($cache_params);
// This cache purge will basically delete all cache items older than 24h, regardless of scope and key
$cache->purgeCache(86400);
$items = array();
$infos = array();
$items = [];
$infos = [];
$mtime = $cache->getTime();
if($mtime !== false
&& (time() - $cache_timeout < $mtime)
&& !Debug::isEnabled()) { // Load cached data
if (
$mtime
&& (time() - $cacheTimeout < $mtime)
&& !Debug::isEnabled()
) {
// At this point we found the feed in the cache and debug mode is disabled
// Send "Not Modified" response if client supports it
// Implementation based on https://stackoverflow.com/a/10847262
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
// The client wants to know if the feed has changed since its last check
$stime = strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']);
if($mtime <= $stime) { // Cached data is older or same
header('Last-Modified: ' . gmdate('D, d M Y H:i:s ', $mtime) . 'GMT', true, 304);
die();
if ($mtime <= $stime) {
$lastModified2 = gmdate('D, d M Y H:i:s ', $mtime) . 'GMT';
return new Response('', 304, ['Last-Modified' => $lastModified2]);
}
}
// Load the feed from cache and prepare it
$cached = $cache->loadData();
if (isset($cached['items']) && isset($cached['extraInfos'])) {
foreach ($cached['items'] as $item) {
$items[] = new \FeedItem($item);
$items[] = new FeedItem($item);
}
$infos = $cached['extraInfos'];
}
} else { // Collect new data
} else {
// At this point we did NOT find the feed in the cache or debug mode is enabled.
try {
$bridge->setDatas($bridge_params);
$bridge->collectData();
$items = $bridge->getItems();
// Transform "legacy" items to FeedItems if necessary.
// Remove this code when support for "legacy" items ends!
if (isset($items[0]) && is_array($items[0])) {
$feedItems = array();
$feedItems = [];
foreach ($items as $item) {
$feedItems[] = new \FeedItem($item);
$feedItems[] = new FeedItem($item);
}
$items = $feedItems;
}
$infos = array(
$infos = [
'name' => $bridge->getName(),
'uri' => $bridge->getURI(),
'donationUri' => $bridge->getDonationURI(),
'icon' => $bridge->getIcon()
);
} catch(Error $e) {
error_log($e);
if(logBridgeError($bridge::NAME, $e->getCode()) >= Configuration::getConfig('error', 'report_limit')) {
if(Configuration::getConfig('error', 'output') === 'feed') {
$item = new \FeedItem();
// Create "new" error message every 24 hours
$this->userData['_error_time'] = urlencode((int)(time() / 86400));
// Error 0 is a special case (i.e. "trying to get property of non-object")
if($e->getCode() === 0) {
$item->setTitle(
'Bridge encountered an unexpected situation! ('
. $this->userData['_error_time']
. ')'
);
];
} catch (\Throwable $e) {
if ($e instanceof HttpException) {
// Produce a smaller log record for http exceptions
Logger::warning(sprintf('Exception in %s: %s', $bridgeClassName, create_sane_exception_message($e)));
} else {
$item->setTitle(
'Bridge returned error '
. $e->getCode()
. '! ('
. $this->userData['_error_time']
. ')'
);
// Log the exception
Logger::error(sprintf('Exception in %s', $bridgeClassName), ['e' => $e]);
}
$item->setURI(
(isset($_SERVER['REQUEST_URI']) ? parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) : '')
. '?'
. http_build_query($this->userData)
);
$item->setTimestamp(time());
$item->setContent(buildBridgeException($e, $bridge));
$items[] = $item;
} elseif(Configuration::getConfig('error', 'output') === 'http') {
header('Content-Type: text/html', true, $this->get_return_code($e));
die(buildTransformException($e, $bridge));
}
}
} catch(Exception $e) {
error_log($e);
if(logBridgeError($bridge::NAME, $e->getCode()) >= Configuration::getConfig('error', 'report_limit')) {
// Emit error only if we are passed the error report limit
$errorCount = self::logBridgeError($bridge->getName(), $e->getCode());
if ($errorCount >= Configuration::getConfig('error', 'report_limit')) {
if (Configuration::getConfig('error', 'output') === 'feed') {
$item = new \FeedItem();
// Create "new" error message every 24 hours
$this->userData['_error_time'] = urlencode((int)(time() / 86400));
$item->setURI(
(isset($_SERVER['REQUEST_URI']) ? parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) : '')
. '?'
. http_build_query($this->userData)
);
$item->setTitle(
'Bridge returned error '
. $e->getCode()
. '! ('
. $this->userData['_error_time']
. ')'
);
$item->setTimestamp(time());
$item->setContent(buildBridgeException($e, $bridge));
$items[] = $item;
// Emit the error as a feed item in a feed so that feed readers can pick it up
$items[] = $this->createFeedItemFromException($e, $bridge);
} elseif (Configuration::getConfig('error', 'output') === 'http') {
header('Content-Type: text/html', true, $this->get_return_code($e));
die(buildTransformException($e, $bridge));
// Emit as a regular web response
throw $e;
}
}
}
// Store data in cache
$cache->saveData(array(
'items' => array_map(function($i){ return $i->toArray(); }, $items),
// Unfortunately need to set scope and key again because they might be modified
$cache->setScope('');
$cache->setKey($cache_params);
$cache->saveData([
'items' => array_map(function (FeedItem $item) {
return $item->toArray();
}, $items),
'extraInfos' => $infos
));
]);
}
// Data transformation
try {
$formatFac = new FormatFactory();
$formatFac->setWorkingDir(PATH_LIB_FORMATS);
$format = $formatFac->create($format);
$format->setItems($items);
$format->setExtraInfos($infos);
$lastModified = $cache->getTime();
$format->setLastModified($lastModified);
$headers = [];
if ($lastModified) {
header('Last-Modified: ' . gmdate('D, d M Y H:i:s ', $lastModified) . 'GMT');
$headers['Last-Modified'] = gmdate('D, d M Y H:i:s ', $lastModified) . 'GMT';
}
$headers['Content-Type'] = $format->getMimeType() . '; charset=' . $format->getCharset();
return new Response($format->stringify(), 200, $headers);
}
header('Content-Type: ' . $format->getMimeType() . '; charset=' . $format->getCharset());
echo $format->stringify();
} catch(Error $e) {
error_log($e);
header('Content-Type: text/html', true, $e->getCode());
die(buildTransformException($e, $bridge));
} catch(Exception $e) {
error_log($e);
header('Content-Type: text/html', true, $e->getCode());
die(buildTransformException($e, $bridge));
}
private function createFeedItemFromException($e, BridgeInterface $bridge): FeedItem
{
$item = new FeedItem();
// Create a unique identifier every 24 hours
$uniqueIdentifier = urlencode((int)(time() / 86400));
$itemTitle = sprintf('Bridge returned error %s! (%s)', $e->getCode(), $uniqueIdentifier);
$item->setTitle($itemTitle);
$item->setURI(get_current_url());
$item->setTimestamp(time());
// Create an item identifier for feed readers e.g. "staysafetv twitch videos_19389"
$item->setUid($bridge->getName() . '_' . $uniqueIdentifier);
$content = render_template(__DIR__ . '/../templates/bridge-error.html.php', [
'error' => render_template(__DIR__ . '/../templates/error.html.php', ['e' => $e]),
'searchUrl' => self::createGithubSearchUrl($bridge),
'issueUrl' => self::createGithubIssueUrl($bridge, $e, create_sane_exception_message($e)),
'maintainer' => $bridge->getMaintainer(),
]);
$item->setContent($content);
return $item;
}
private static function logBridgeError($bridgeName, $code)
{
$cache = RssBridge::getCache();
$cache->setScope('error_reporting');
$cache->setkey([$bridgeName . '_' . $code]);
if ($report = $cache->loadData()) {
$report = Json::decode($report);
$report['time'] = time();
$report['count']++;
} else {
$report = [
'error' => $code,
'time' => time(),
'count' => 1,
];
}
$cache->saveData(Json::encode($report));
return $report['count'];
}
private static function createGithubIssueUrl($bridge, $e, string $message): string
{
return sprintf('https://github.com/RSS-Bridge/rss-bridge/issues/new?%s', http_build_query([
'title' => sprintf('%s failed with error %s', $bridge->getName(), $e->getCode()),
'body' => sprintf(
"```\n%s\n\n%s\n\nQuery string: %s\nVersion: %s\nOs: %s\nPHP version: %s\n```",
$message,
implode("\n", trace_to_call_points(trace_from_exception($e))),
$_SERVER['QUERY_STRING'] ?? '',
Configuration::getVersion(),
PHP_OS_FAMILY,
phpversion() ?: 'Unknown'
),
'labels' => 'Bridge-Broken',
'assignee' => $bridge->getMaintainer(),
]));
}
private static function createGithubSearchUrl($bridge): string
{
return sprintf(
'https://github.com/RSS-Bridge/rss-bridge/issues?q=%s',
urlencode('is:issue is:open ' . $bridge->getName())
);
}
}

View File

@@ -0,0 +1,36 @@
<?php
final class FrontpageAction implements ActionInterface
{
public function execute(array $request)
{
$showInactive = (bool) ($request['show_inactive'] ?? null);
$activeBridges = 0;
$bridgeFactory = new BridgeFactory();
$bridgeClassNames = $bridgeFactory->getBridgeClassNames();
$formatFactory = new FormatFactory();
$formats = $formatFactory->getFormatNames();
$body = '';
foreach ($bridgeClassNames as $bridgeClassName) {
if ($bridgeFactory->isEnabled($bridgeClassName)) {
$body .= BridgeCard::displayBridgeCard($bridgeClassName, $formats);
$activeBridges++;
} elseif ($showInactive) {
$body .= BridgeCard::displayBridgeCard($bridgeClassName, $formats, false) . PHP_EOL;
}
}
return render(__DIR__ . '/../templates/frontpage.html.php', [
'messages' => [],
'admin_email' => Configuration::getConfig('admin', 'email'),
'admin_telegram' => Configuration::getConfig('admin', 'telegram'),
'bridges' => $body,
'active_bridges' => $activeBridges,
'total_bridges' => count($bridgeClassNames),
'show_inactive' => $showInactive,
]);
}
}

15
actions/HealthAction.php Normal file
View File

@@ -0,0 +1,15 @@
<?php
declare(strict_types=1);
class HealthAction implements ActionInterface
{
public function execute(array $request)
{
$response = [
'code' => 200,
'message' => 'all is good',
];
return new Response(Json::encode($response), 200, ['content-type' => 'application/json']);
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of RSS-Bridge, a PHP project capable of generating RSS and
* Atom feeds for websites that don't have one.
@@ -11,32 +12,21 @@
* @link https://github.com/rss-bridge/rss-bridge
*/
class ListAction extends ActionAbstract {
public function execute() {
$list = new StdClass();
$list->bridges = array();
class ListAction implements ActionInterface
{
public function execute(array $request)
{
$list = new \stdClass();
$list->bridges = [];
$list->total = 0;
$bridgeFac = new \BridgeFactory();
$bridgeFactory = new BridgeFactory();
foreach($bridgeFac->getBridgeNames() as $bridgeName) {
foreach ($bridgeFactory->getBridgeClassNames() as $bridgeClassName) {
$bridge = $bridgeFactory->create($bridgeClassName);
$bridge = $bridgeFac->create($bridgeName);
if($bridge === false) { // Broken bridge, show as inactive
$list->bridges[$bridgeName] = array(
'status' => 'inactive'
);
continue;
}
$status = $bridgeFac->isWhitelisted($bridgeName) ? 'active' : 'inactive';
$list->bridges[$bridgeName] = array(
'status' => $status,
$list->bridges[$bridgeClassName] = [
'status' => $bridgeFactory->isEnabled($bridgeClassName) ? 'active' : 'inactive',
'uri' => $bridge->getURI(),
'donationUri' => $bridge->getDonationURI(),
'name' => $bridge->getName(),
@@ -44,13 +34,9 @@ class ListAction extends ActionAbstract {
'parameters' => $bridge->getParameters(),
'maintainer' => $bridge->getMaintainer(),
'description' => $bridge->getDescription()
);
];
}
$list->total = count($list->bridges);
header('Content-Type: application/json');
echo json_encode($list, JSON_PRETTY_PRINT);
return new Response(Json::encode($list), 200, ['Content-Type' => 'application/json']);
}
}

View File

@@ -0,0 +1,50 @@
<?php
/**
* This file is part of RSS-Bridge, a PHP project capable of generating RSS and
* Atom feeds for websites that don't have one.
*
* For the full license information, please view the UNLICENSE file distributed
* with this source code.
*
* @package Core
* @license http://unlicense.org/ UNLICENSE
* @link https://github.com/rss-bridge/rss-bridge
*/
class SetBridgeCacheAction implements ActionInterface
{
public function execute(array $request)
{
$authenticationMiddleware = new ApiAuthenticationMiddleware();
$authenticationMiddleware($request);
$key = $request['key'] or returnClientError('You must specify key!');
$bridgeFactory = new BridgeFactory();
$bridgeClassName = $bridgeFactory->createBridgeClassName($request['bridge'] ?? '');
// whitelist control
if (!$bridgeFactory->isEnabled($bridgeClassName)) {
throw new \Exception('This bridge is not whitelisted', 401);
die;
}
$bridge = $bridgeFactory->create($bridgeClassName);
$bridge->loadConfiguration();
$value = $request['value'];
$cache = RssBridge::getCache();
$cache->setScope(get_class($bridge));
if (!is_array($key)) {
// not sure if $key is an array when it comes in from request
$key = [$key];
}
$cache->setKey($key);
$cache->saveData($value);
header('Content-Type: text/plain');
echo 'done';
}
}

View File

@@ -1,17 +1,19 @@
<?php
class ABCNewsBridge extends BridgeAbstract {
class ABCNewsBridge extends BridgeAbstract
{
const NAME = 'ABC News Bridge';
const URI = 'https://www.abc.net.au';
const DESCRIPTION = 'Topics of the Australian Broadcasting Corporation';
const MAINTAINER = 'yue-dongchen';
const PARAMETERS = array(
array(
'topic' => array(
const PARAMETERS = [
[
'topic' => [
'type' => 'list',
'name' => 'Region',
'title' => 'Choose state',
'values' => array(
'values' => [
'ACT' => 'act',
'NSW' => 'nsw',
'NT' => 'nt',
@@ -20,26 +22,28 @@ class ABCNewsBridge extends BridgeAbstract {
'TAS' => 'tas',
'VIC' => 'vic',
'WA' => 'wa'
),
)
)
);
],
]
]
];
public function collectData() {
$url = 'https://www.abc.net.au/news/' . $this->getInput('topic');
$html = getSimpleHTMLDOM($url)->find('.YAJzu._2FvRw.ZWhbj._3BZxh', 0);
$html = defaultLinkTo($html, $this->getURI());
foreach($html->find('._2H7Su') as $article) {
$item = array();
$title = $article->find('._3T9Id.fmhNa.nsZdE._2c2Zy._1tOey._3EOTW', 0);
$item['title'] = $title->plaintext;
$item['uri'] = $title->href;
$item['content'] = $article->find('.rMkro._1cBaI._3PhF6._10YQT._1yL-m', 0)->plaintext;
$item['timestamp'] = strtotime($article->find('time', 0)->datetime);
$this->items[] = $item;
public function collectData()
{
$url = sprintf('https://www.abc.net.au/news/%s', $this->getInput('topic'));
$dom = getSimpleHTMLDOM($url);
$dom = $dom->find('div[data-component="CardList"]', 0);
if (!$dom) {
throw new \Exception(sprintf('Unable to find css selector on `%s`', $url));
}
$dom = defaultLinkTo($dom, $this->getURI());
foreach ($dom->find('div[data-component="GenericCard"]') as $article) {
$a = $article->find('a', 0);
$this->items[] = [
'title' => $a->plaintext,
'uri' => $a->href,
'content' => $article->find('[data-component="CardDescription"]', 0)->plaintext,
'timestamp' => strtotime($article->find('time', 0)->datetime),
];
}
}
}

116
bridges/ABolaBridge.php Normal file
View File

@@ -0,0 +1,116 @@
<?php
class ABolaBridge extends BridgeAbstract
{
const NAME = 'A Bola';
const URI = 'https://abola.pt/';
const DESCRIPTION = 'Returns news from the Portuguese sports newspaper A BOLA.PT';
const MAINTAINER = 'rmscoelho';
const CACHE_TIMEOUT = 3600;
const PARAMETERS = [
[
'feed' => [
'name' => 'News Feed',
'type' => 'list',
'title' => 'Feeds from the Portuguese sports newspaper A BOLA.PT',
'values' => [
'Últimas' => 'Nnh/Noticias',
'Seleção Nacional' => 'Selecao/Noticias',
'Futebol Nacional' => [
'Notícias' => 'Nacional/Noticias',
'Primeira Liga' => 'Nacional/Liga/Noticias',
'Liga 2' => 'Nacional/Liga2/Noticias',
'Liga 3' => 'Nacional/Liga3/Noticias',
'Liga Revelação' => 'Nacional/Liga-Revelacao/Noticias',
'Campeonato de Portugal' => 'Nacional/Campeonato-Portugal/Noticias',
'Distritais' => 'Nacional/Distritais/Noticias',
'Taça de Portugal' => 'Nacional/TPortugal/Noticias',
'Futebol Feminino' => 'Nacional/FFeminino/Noticias',
'Futsal' => 'Nacional/Futsal/Noticias',
],
'Futebol Internacional' => [
'Notícias' => 'Internacional/Noticias/Noticias',
'Liga dos Campeões' => 'Internacional/Liga-dos-campeoes/Noticias',
'Liga Europa' => 'Internacional/Liga-europa/Noticias',
'Liga Conferência' => 'Internacional/Liga-conferencia/Noticias',
'Liga das Nações' => 'Internacional/Liga-das-nacoes/Noticias',
'UEFA Youth League' => 'Internacional/Uefa-Youth-League/Noticias',
],
'Mercado' => 'Mercado',
'Modalidades' => 'Modalidades/Noticias',
'Motores' => 'Motores/Noticias',
]
]
]
];
public function getIcon()
{
return 'https://abola.pt/img/icons/favicon-96x96.png';
}
public function getName()
{
return !is_null($this->getKey('feed')) ? self::NAME . ' | ' . $this->getKey('feed') : self::NAME;
}
public function getURI()
{
return self::URI . $this->getInput('feed');
}
public function collectData()
{
$url = sprintf('https://abola.pt/%s', $this->getInput('feed'));
$dom = getSimpleHTMLDOM($url);
if ($this->getInput('feed') !== 'Mercado') {
$dom = $dom->find('div#body_Todas1_upNoticiasTodas', 0);
} else {
$dom = $dom->find('div#body_NoticiasMercado_upNoticiasTodas', 0);
}
if (!$dom) {
throw new \Exception(sprintf('Unable to find css selector on `%s`', $url));
}
$dom = defaultLinkTo($dom, $this->getURI());
foreach ($dom->find('div.media') as $key => $article) {
//Get thumbnail
$image = $article->find('.media-img', 0)->style;
$image = preg_replace('/background-image: url\(/i', '', $image);
$image = substr_replace($image, '', -4);
$image = preg_replace('/https:\/\//i', '', $image);
$image = preg_replace('/www\./i', '', $image);
$image = preg_replace('/\/\//', '/', $image);
$image = preg_replace('/\/\/\//', '//', $image);
$image = substr($image, 7);
$image = 'https://' . $image;
$image = preg_replace('/ptimg/', 'pt/img', $image);
$image = preg_replace('/\/\/bola/', 'www.abola', $image);
//Timestamp
$date = date('Y/m/d');
if (!is_null($article->find("span#body_Todas1_rptNoticiasTodas_lblData_$key", 0))) {
$date = $article->find("span#body_Todas1_rptNoticiasTodas_lblData_$key", 0)->plaintext;
$date = preg_replace('/\./', '/', $date);
}
$time = $article->find("span#body_Todas1_rptNoticiasTodas_lblHora_$key", 0)->plaintext;
$date = explode('/', $date);
$time = explode(':', $time);
$year = $date[0];
$month = $date[1];
$day = $date[2];
$hour = $time[0];
$minute = $time[1];
$timestamp = mktime($hour, $minute, 0, $month, $day, $year);
//Content
$image = '<img src="' . $image . '" alt="' . $article->find('h4 span', 0)->plaintext . '" />';
$description = '<p>' . $article->find('.media-texto > span', 0)->plaintext . '</p>';
$content = $image . '</br>' . $description;
$a = $article->find('.media-body > a', 0);
$this->items[] = [
'title' => $a->find('h4 span', 0)->plaintext,
'uri' => $a->href,
'content' => $content,
'timestamp' => $timestamp,
];
}
}
}

View File

@@ -1,49 +1,75 @@
<?php
class AO3Bridge extends BridgeAbstract {
class AO3Bridge extends BridgeAbstract
{
const NAME = 'AO3';
const URI = 'https://archiveofourown.org/';
const CACHE_TIMEOUT = 1800;
const DESCRIPTION = 'Returns works or chapters from Archive of Our Own';
const MAINTAINER = 'Obsidienne';
const PARAMETERS = array(
'List' => array(
'url' => array(
const PARAMETERS = [
'List' => [
'url' => [
'name' => 'url',
'required' => true,
// Example: F/F tag, complete works only
'exampleValue' => 'https://archiveofourown.org/works?work_search[complete]=T&tag_id=F*s*F',
),
),
'Bookmarks' => array(
'user' => array(
],
],
'Bookmarks' => [
'user' => [
'name' => 'user',
'required' => true,
// Example: Nyaaru's bookmarks
'exampleValue' => 'Nyaaru',
),
),
'Work' => array(
'id' => array(
],
],
'Work' => [
'id' => [
'name' => 'id',
'required' => true,
// Example: latest chapters from A Better Past by LysSerris
'exampleValue' => '18181853',
),
)
);
],
]
];
// Feed for lists of works (e.g. recent works, search results, filtered tags,
// bookmarks, series, collections).
private function collectList($url) {
public function collectData()
{
switch ($this->queriedContext) {
case 'Bookmarks':
$user = $this->getInput('user');
$this->title = $user;
$url = self::URI
. '/users/' . $user
. '/bookmarks?bookmark_search[sort_column]=bookmarkable_date';
$this->collectList($url);
break;
case 'List':
$this->collectList($this->getInput('url'));
break;
case 'Work':
$this->collectWork($this->getInput('id'));
break;
}
}
/**
* Feed for lists of works (e.g. recent works, search results, filtered tags,
* bookmarks, series, collections).
*/
private function collectList($url)
{
$html = getSimpleHTMLDOM($url);
$html = defaultLinkTo($html, self::URI);
foreach ($html->find('.index.group > li') as $element) {
$item = array();
$item = [];
$title = $element->find('div h4 a', 0);
if (!isset($title)) continue; // discard deleted works
if (!isset($title)) {
continue; // discard deleted works
}
$item['title'] = $title->plaintext;
$item['content'] = $element;
$item['uri'] = $title->href;
@@ -60,16 +86,20 @@ class AO3Bridge extends BridgeAbstract {
}
}
// Feed for recent chapters of a specific work.
private function collectWork($id) {
/**
* Feed for recent chapters of a specific work.
*/
private function collectWork($id)
{
$url = self::URI . "/works/$id/navigate";
$html = getSimpleHTMLDOM($url);
$response = _http_request($url, ['useragent' => 'rss-bridge bot (https://github.com/RSS-Bridge/rss-bridge)']);
$html = \str_get_html($response['body']);
$html = defaultLinkTo($html, self::URI);
$this->title = $html->find('h2 a', 0)->plaintext;
foreach ($html->find('ol.index.group > li') as $element) {
$item = array();
$item = [];
$item['title'] = $element->find('a', 0)->plaintext;
$item['content'] = $element;
@@ -88,31 +118,17 @@ class AO3Bridge extends BridgeAbstract {
$this->items = array_reverse($this->items);
}
public function collectData() {
switch($this->queriedContext) {
case 'Bookmarks':
$user = $this->getInput('user');
$this->title = $user;
$url = self::URI
. '/users/' . $user
. '/bookmarks?bookmark_search[sort_column]=bookmarkable_date';
return $this->collectList($url);
case 'List': return $this->collectList(
$this->getInput('url')
);
case 'Work': return $this->collectWork(
$this->getInput('id')
);
}
}
public function getName() {
public function getName()
{
$name = parent::getName() . " $this->queriedContext";
if (isset($this->title)) $name .= " - $this->title";
if (isset($this->title)) {
$name .= " - $this->title";
}
return $name;
}
public function getIcon() {
public function getIcon()
{
return self::URI . '/favicon.ico';
}
}

View File

@@ -0,0 +1,158 @@
<?php
class ARDAudiothekBridge extends BridgeAbstract
{
const NAME = 'ARD-Audiothek Bridge';
const URI = 'https://www.ardaudiothek.de';
const DESCRIPTION = 'Feed of any show in the ARD-Audiothek, specified by its path';
const MAINTAINER = 'Mar-Koeh';
/*
* The URL Prefix of the API
* @const APIENDPOINT https-URL of the used endpoint, ending in `/`
*/
const APIENDPOINT = 'https://api.ardaudiothek.de/';
/*
* The requested width of the preview image
* 448 and 128 have been observed on the wild
* @const IMAGEWIDTH width in px of the preview image
*/
const IMAGEWIDTH = 448;
/*
* Placeholder that will be replace by IMAGEWIDTH in the preview image URL
* @const IMAGEWIDTHPLACEHOLDER
*/
const IMAGEWIDTHPLACEHOLDER = '{width}';
/*
* File extension appended to image link in $this->icon
* @const IMAGEEXTENSION
*/
const IMAGEEXTENSION = '.jpg';
const PARAMETERS = [
[
'path' => [
'name' => 'Show Link or ID',
'required' => true,
'title' => 'Link to the show page or just its numeric suffix',
'defaultValue' => 'https://www.ardaudiothek.de/sendung/kalk-welk/10777871/'
],
'limit' => self::LIMIT,
]
];
/**
* Holds the title of the current show
*
* @var string
*/
private $title;
/**
* Holds the URI of the show
*
* @var string
*/
private $uri;
/**
* Holds the icon of the feed
*
*/
private $icon;
public function collectData()
{
$oldTz = date_default_timezone_get();
date_default_timezone_set('Europe/Berlin');
$pathComponents = explode('/', $this->getInput('path'));
if (empty($pathComponents)) {
returnClientError('Path may not be empty');
}
if (count($pathComponents) < 2) {
$showID = $pathComponents[0];
} else {
$lastKey = count($pathComponents) - 1;
$showID = $pathComponents[$lastKey];
if (strlen($showID) === 0) {
$showID = $pathComponents[$lastKey - 1];
}
}
$url = self::APIENDPOINT . 'programsets/' . $showID . '/';
$rawJSON = getContents($url);
$processedJSON = json_decode($rawJSON)->data->programSet;
$limit = $this->getInput('limit');
$answerLength = 1;
$offset = 0;
$numberOfElements = 1;
while ($answerLength != 0 && $offset < $numberOfElements && (is_null($limit) || $offset < $limit)) {
$rawJSON = getContents($url . '?offset=' . $offset);
$processedJSON = json_decode($rawJSON)->data->programSet;
$answerLength = count($processedJSON->items->nodes);
$offset = $offset + $answerLength;
$numberOfElements = $processedJSON->numberOfElements;
foreach ($processedJSON->items->nodes as $audio) {
$item = [];
$item['uri'] = $audio->sharingUrl;
$item['title'] = $audio->title;
$imageSquare = str_replace(self::IMAGEWIDTHPLACEHOLDER, self::IMAGEWIDTH, $audio->image->url1X1);
$image = str_replace(self::IMAGEWIDTHPLACEHOLDER, self::IMAGEWIDTH, $audio->image->url);
$item['enclosures'] = [
$audio->audios[0]->url,
$imageSquare
];
// synopsis in list is shortened, full synopsis is available using one request per item
$item['content'] = '<img src="' . $image . '" /><p>' . $audio->synopsis . '</p>';
$item['timestamp'] = $audio->publicationStartDateAndTime;
$item['uid'] = $audio->id;
$item['author'] = $audio->programSet->publicationService->title;
$item['categories'] = [ $audio->programSet->editorialCategories->title ];
$this->items[] = $item;
}
}
$this->title = $processedJSON->title;
$this->uri = $processedJSON->sharingUrl;
$this->icon = str_replace(self::IMAGEWIDTHPLACEHOLDER, self::IMAGEWIDTH, $processedJSON->image->url1X1);
// add image file extension to URL so icon is shown in generated RSS feeds, see
// https://github.com/RSS-Bridge/rss-bridge/blob/4aed05c7b678b5673386d61374bba13637d15487/formats/MrssFormat.php#L76
$this->icon = $this->icon . self::IMAGEEXTENSION;
$this->items = array_slice($this->items, 0, $limit);
date_default_timezone_set($oldTz);
}
/** {@inheritdoc} */
public function getURI()
{
if (!empty($this->uri)) {
return $this->uri;
}
return parent::getURI();
}
/** {@inheritdoc} */
public function getName()
{
if (!empty($this->title)) {
return $this->title;
}
return parent::getName();
}
/** {@inheritdoc} */
public function getIcon()
{
if (!empty($this->icon)) {
return $this->icon;
}
return parent::getIcon();
}
}

View File

@@ -1,5 +1,7 @@
<?php
class ARDMediathekBridge extends BridgeAbstract {
class ARDMediathekBridge extends BridgeAbstract
{
const NAME = 'ARD-Mediathek Bridge';
const URI = 'https://www.ardmediathek.de';
const DESCRIPTION = 'Feed of any series in the ARD-Mediathek, specified by its path';
@@ -39,18 +41,19 @@ class ARDMediathekBridge extends BridgeAbstract {
*/
const IMAGEWIDTHPLACEHOLDER = '{width}';
const PARAMETERS = array(
array(
'path' => array(
const PARAMETERS = [
[
'path' => [
'name' => 'Show Link or ID',
'required' => true,
'title' => 'Link to the show page or just its alphanumeric suffix',
'defaultValue' => 'https://www.ardmediathek.de/sendung/45-min/Y3JpZDovL25kci5kZS8xMzkx/'
)
)
);
]
]
];
public function collectData() {
public function collectData()
{
$oldTz = date_default_timezone_get();
date_default_timezone_set('Europe/Berlin');
@@ -69,20 +72,20 @@ class ARDMediathekBridge extends BridgeAbstract {
}
}
$url = SELF::APIENDPOINT . $showID . '/?pageSize=' . SELF::PAGESIZE;
$url = self::APIENDPOINT . $showID . '/?pageSize=' . self::PAGESIZE;
$rawJSON = getContents($url);
$processedJSON = json_decode($rawJSON);
foreach ($processedJSON->teasers as $video) {
$item = array();
$item = [];
// there is also ->links->self->id, ->links->self->urlId, ->links->target->id, ->links->target->urlId
$item['uri'] = SELF::VIDEOLINKPREFIX . $video->id . '/';
$item['uri'] = self::VIDEOLINKPREFIX . $video->id . '/';
// there is also ->mediumTitle and ->shortTitle
$item['title'] = $video->longTitle;
// in the test, aspect16x9 was the only child of images, not sure whether that is always true
$item['enclosures'] = array(
str_replace(SELF::IMAGEWIDTHPLACEHOLDER, SELF::IMAGEWIDTH, $video->images->aspect16x9->src)
);
$item['enclosures'] = [
str_replace(self::IMAGEWIDTHPLACEHOLDER, self::IMAGEWIDTH, $video->images->aspect16x9->src)
];
$item['content'] = '<img src="' . $item['enclosures'][0] . '" /><p>';
$item['timestamp'] = $video->broadcastedOn;
$item['uid'] = $video->id;

View File

@@ -1,21 +1,23 @@
<?php
class ASRockNewsBridge extends BridgeAbstract {
class ASRockNewsBridge extends BridgeAbstract
{
const NAME = 'ASRock News Bridge';
const URI = 'https://www.asrock.com';
const DESCRIPTION = 'Returns latest news articles';
const MAINTAINER = 'VerifiedJoseph';
const PARAMETERS = array();
const PARAMETERS = [];
const CACHE_TIMEOUT = 3600; // 1 hour
public function collectData() {
public function collectData()
{
$html = getSimpleHTMLDOM(self::URI . '/news/index.asp');
$html = defaultLinkTo($html, self::URI . '/news/');
foreach ($html->find('div.inner > a') as $index => $a) {
$item = array();
$item = [];
$articlePath = $a->href;
@@ -32,7 +34,12 @@ class ASRockNewsBridge extends BridgeAbstract {
$item['content'] = $contents->innertext;
$item['timestamp'] = $this->extractDate($a->plaintext);
$item['enclosures'][] = $a->find('img', 0)->src;
$img = $a->find('img', 0);
if ($img) {
$item['enclosures'][] = $img->src;
}
$this->items[] = $item;
if (count($this->items) >= 10) {
@@ -41,7 +48,8 @@ class ASRockNewsBridge extends BridgeAbstract {
}
}
private function extractDate($text) {
private function extractDate($text)
{
$dateRegex = '/^([0-9]{4}\/[0-9]{1,2}\/[0-9]{1,2})/';
$text = trim($text);

View File

@@ -1,6 +1,7 @@
<?php
class AcrimedBridge extends FeedExpander {
class AcrimedBridge extends FeedExpander
{
const MAINTAINER = 'qwertygc';
const NAME = 'Acrimed Bridge';
const URI = 'https://www.acrimed.org/';
@@ -17,14 +18,16 @@ class AcrimedBridge extends FeedExpander {
]
];
public function collectData(){
public function collectData()
{
$this->collectExpandableDatas(
static::URI . 'spip.php?page=backend',
$this->getInput('limit')
);
}
protected function parseItem($newsItem){
protected function parseItem($newsItem)
{
$item = parent::parseItem($newsItem);
$articlePage = getSimpleHTMLDOM($newsItem->link);

View File

@@ -1,16 +1,17 @@
<?php
class AirBreizhBridge extends BridgeAbstract {
class AirBreizhBridge extends BridgeAbstract
{
const MAINTAINER = 'fanch317';
const NAME = 'Air Breizh';
const URI = 'https://www.airbreizh.asso.fr/';
const DESCRIPTION = 'Returns newests publications on Air Breizh';
const PARAMETERS = array(
'Publications' => array(
'theme' => array(
const PARAMETERS = [
'Publications' => [
'theme' => [
'name' => 'Thematique',
'type' => 'list',
'values' => array(
'values' => [
'Tout' => '',
'Rapport d\'activite' => 'rapport-dactivite',
'Etude' => 'etudes',
@@ -18,22 +19,24 @@ class AirBreizhBridge extends BridgeAbstract {
'Autres documents' => 'autres-documents',
'Plan Régional de Surveillance de la qualité de lair' => 'prsqa',
'Transport' => 'transport'
)
)
)
);
]
]
]
];
public function getIcon() {
public function getIcon()
{
return 'https://www.airbreizh.asso.fr/voy_content/uploads/2017/11/favicon.png';
}
public function collectData(){
public function collectData()
{
$html = '';
$html = getSimpleHTMLDOM(static::URI . 'publications/?fwp_publications_thematiques=' . $this->getInput('theme'))
or returnClientError('No results for this query.');
foreach ($html->find('article') as $article) {
$item = array();
$item = [];
// Title
$item['title'] = $article->find('h2', 0)->plaintext;
// Author

View File

@@ -1,24 +1,25 @@
<?php
class AlbionOnlineBridge extends BridgeAbstract {
class AlbionOnlineBridge extends BridgeAbstract
{
const NAME = 'Albion Online Changelog';
const MAINTAINER = 'otakuf';
const URI = 'https://albiononline.com';
const DESCRIPTION = 'Returns the changes made to the Albion Online';
const CACHE_TIMEOUT = 3600; // 60min
const PARAMETERS = array( array(
'postcount' => array(
const PARAMETERS = [ [
'postcount' => [
'name' => 'Limit',
'type' => 'number',
'required' => true,
'title' => 'Maximum number of items to return',
'defaultValue' => 5,
),
'language' => array(
],
'language' => [
'name' => 'Language',
'type' => 'list',
'values' => array(
'values' => [
'English' => 'en',
'Deutsch' => 'de',
'Polski' => 'pl',
@@ -26,19 +27,20 @@ class AlbionOnlineBridge extends BridgeAbstract {
'Русский' => 'ru',
'Português' => 'pt',
'Español' => 'es',
),
],
'title' => 'Language of changelog posts',
'defaultValue' => 'en',
),
'full' => array(
],
'full' => [
'name' => 'Full changelog',
'type' => 'checkbox',
'required' => false,
'title' => 'Enable to receive the full changelog post for each item'
),
));
],
]];
public function collectData() {
public function collectData()
{
$api = 'https://albiononline.com/';
// Example: https://albiononline.com/en/changelog/1/5
$url = $api . $this->getInput('language') . '/changelog/1/' . $this->getInput('postcount');
@@ -46,7 +48,7 @@ class AlbionOnlineBridge extends BridgeAbstract {
$html = getSimpleHTMLDOM($url);
foreach ($html->find('li') as $data) {
$item = array();
$item = [];
$item['uri'] = self::URI . $data->find('a', 0)->getAttribute('href');
$item['title'] = trim(explode('|', $data->find('span', 0)->plaintext)[0]);
// Time below work only with en lang. Need to think about solution. May be separate request like getFullChangelog, but to english list for all language
@@ -65,7 +67,8 @@ class AlbionOnlineBridge extends BridgeAbstract {
}
}
private function getFullChangelog($url) {
private function getFullChangelog($url)
{
$html = getSimpleHTMLDOMCached($url);
$html = defaultLinkTo($html, self::URI);
return $html->find('div.small-12.columns', 1)->innertext;

View File

@@ -1,33 +1,35 @@
<?php
class AlfaBankByBridge extends BridgeAbstract {
class AlfaBankByBridge extends BridgeAbstract
{
const MAINTAINER = 'lassana';
const NAME = 'AlfaBank.by Новости';
const URI = 'https://www.alfabank.by';
const DESCRIPTION = 'Уведомления Alfa-Now — новости от Альфа-Банка';
const CACHE_TIMEOUT = 3600; // 1 hour
const PARAMETERS = array(
'News' => array(
'business' => array(
const PARAMETERS = [
'News' => [
'business' => [
'name' => 'Альфа Бизнес',
'type' => 'list',
'title' => 'В зависимости от выбора, возращает уведомления для" .
" клиентов физ. лиц либо для клиентов-юридических лиц и ИП',
'values' => array(
'values' => [
'Новости' => 'news',
'Новости бизнеса' => 'newsBusiness'
),
],
'defaultValue' => 'news'
),
'fullContent' => array(
],
'fullContent' => [
'name' => 'Включать содержимое',
'type' => 'checkbox',
'title' => 'Если выбрано, содержимое уведомлений вставляется в поток (работает медленно)'
)
)
);
]
]
];
public function collectData() {
public function collectData()
{
$business = $this->getInput('business') == 'newsBusiness';
$fullContent = $this->getInput('fullContent') == 'on';
@@ -40,7 +42,7 @@ class AlfaBankByBridge extends BridgeAbstract {
foreach ($html->find('a.notifications__item') as $element) {
if ($limit < 10) {
$item = array();
$item = [];
$item['uid'] = 'urn:sha1:' . hash('sha1', $element->getAttribute('data-notification-id'));
$item['title'] = $element->find('div.item-title', 0)->innertext;
$item['timestamp'] = DateTime::createFromFormat(
@@ -67,17 +69,19 @@ class AlfaBankByBridge extends BridgeAbstract {
}
}
public function getIcon() {
public function getIcon()
{
return static::URI . '/local/images/favicon.ico';
}
private function ruMonthsToEn($date) {
$ruMonths = array(
private function ruMonthsToEn($date)
{
$ruMonths = [
'Января', 'Февраля', 'Марта', 'Апреля', 'Мая', 'Июня',
'Июля', 'Августа', 'Сентября', 'Октября', 'Ноября', 'Декабря' );
$enMonths = array(
'Июля', 'Августа', 'Сентября', 'Октября', 'Ноября', 'Декабря' ];
$enMonths = [
'January', 'February', 'March', 'April', 'May', 'June',
'July', 'August', 'September', 'October', 'November', 'December' );
'July', 'August', 'September', 'October', 'November', 'December' ];
return str_replace($ruMonths, $enMonths, $date);
}
}

View File

@@ -0,0 +1,85 @@
<?php
class AllSidesBridge extends BridgeAbstract
{
const NAME = 'AllSides';
const URI = 'https://www.allsides.com';
const DESCRIPTION = 'Balanced news and media bias ratings.';
const MAINTAINER = 'Oliver Nutter';
const PARAMETERS = [
'global' => [
'limit' => [
'name' => 'Number of posts to return',
'type' => 'number',
'defaultValue' => 10,
'required' => false,
'title' => 'Zero or negative values return all posts (ignored if not fetching full article)',
],
'fetch' => [
'name' => 'Fetch full article content',
'type' => 'checkbox',
'defaultValue' => 'checked',
],
],
'Headline Roundups' => [],
];
private const ROUNDUPS_URI = self::URI . '/headline-roundups';
public function collectData()
{
switch ($this->queriedContext) {
case 'Headline Roundups':
$index = getSimpleHTMLDOM(self::ROUNDUPS_URI);
defaultLinkTo($index, self::ROUNDUPS_URI);
$entries = $index->find('table.views-table > tbody > tr');
$limit = (int) $this->getInput('limit');
$fetch = (bool) $this->getInput('fetch');
if ($limit > 0 && $fetch) {
$entries = array_slice($entries, 0, $limit);
}
foreach ($entries as $entry) {
$item = [
'title' => $entry->find('.views-field-name', 0)->text(),
'uri' => $entry->find('a', 0)->href,
'timestamp' => $entry->find('.date-display-single', 0)->content,
'author' => 'AllSides Staff',
];
if ($fetch) {
$article = getSimpleHTMLDOMCached($item['uri']);
defaultLinkTo($article, $item['uri']);
$item['content'] = $article->find('.story-id-page-description', 0);
foreach ($article->find('.page-tags a') as $tag) {
$item['categories'][] = $tag->text();
}
}
$this->items[] = $item;
}
break;
}
}
public function getName()
{
if ($this->queriedContext) {
return self::NAME . " - {$this->queriedContext}";
}
return self::NAME;
}
public function getURI()
{
switch ($this->queriedContext) {
case 'Headline Roundups':
return self::ROUNDUPS_URI;
}
return self::URI;
}
}

144
bridges/AllegroBridge.php Normal file
View File

@@ -0,0 +1,144 @@
<?php
class AllegroBridge extends BridgeAbstract
{
const NAME = 'Allegro';
const URI = 'https://www.allegro.pl';
const DESCRIPTION = 'Returns the search results from the Allegro.pl shopping and bidding portal';
const MAINTAINER = 'wrobelda';
const PARAMETERS = [[
'url' => [
'name' => 'Search URL',
'title' => 'Copy the URL from your browser\'s address bar after searching for your items and paste it here',
'exampleValue' => 'https://allegro.pl/kategoria/swieze-warzywa-cebula-318660',
'required' => true,
],
'sessioncookie' => [
'name' => 'The \'wdctx\' session cookie',
'title' => 'Paste the value of the \'wdctx\' cookie from your browser if you want to prevent Allegro imposing rate limits',
'pattern' => '^.{250,};?$',
// phpcs:ignore
'exampleValue' => 'v4.1-oCrmXTMqv2ppC21GTUCKLmUwRPP1ssQVALKuqwsZ1VXjcKgL2vO5TTRM5xMxS9GiyqxF1gAeyc-63dl0coUoBKXCXi_nAmr95yyqGpq2RAFoneZ4L399E8n6iYyemcuGARjAoSfjvLHJCEwvvHHynSgaxlFBu7hUnKfuy39zo9sSQdyTUjotJg3CAZ53q9v2raAnPCyGOAR4ytRILd9p24EJnxp7_oR0XbVPIo1hDa4WmjXFOxph8rHaO5tWd',
'required' => false,
],
'includeSponsoredOffers' => [
'type' => 'checkbox',
'name' => 'Include Sponsored Offers'
]
]];
public function getName()
{
parse_str(parse_url($this->getInput('url'), PHP_URL_QUERY), $fields);
if ($query = array_key_exists('string', $fields) ? urldecode($fields['string']) : false) {
return $query;
}
return parent::getName();
}
public function getURI()
{
return $this->getInput('url') ?? parent::getURI();
}
public function collectData()
{
# make sure we order by the most recently listed offers
$url = preg_replace('/([?&])order=[^&]+(&|$)/', '$1', $this->getInput('url'));
$url .= (parse_url($url, PHP_URL_QUERY) ? '&' : '?') . 'order=n';
$opts = [];
// If a session cookie is provided
if ($sessioncookie = $this->getInput('sessioncookie')) {
$opts[CURLOPT_COOKIE] = 'wdctx=' . $sessioncookie;
}
$html = getSimpleHTMLDOM($url, [], $opts);
# if no results found
if ($html->find('.mzmg_6m.m9qz_yo._6a66d_-fJr5')) {
return;
}
$results = $html->find('._6a66d_V7Lel article');
if (!$this->getInput('includeSponsoredOffers')) {
$results = array_filter($results, function ($node) {
return $node->{'data-analytics-view-label'} != 'showSponsoredItems';
});
}
foreach ($results as $post) {
$item = [];
$item['uri'] = $post->find('._6a66d_LX75-', 0)->href;
//TODO: port this over, whatever it does, from https://github.com/MK-PL/AllegroRSS
// if (arrayLinks.includes('events/clicks?')) {
// let sponsoredLink = new URL(arrayLinks).searchParams.get('redirect')
// arrayLinks = sponsoredLink.slice(0, sponsoredLink.indexOf('?'))
// }
$item['title'] = $post->find('._6a66d_LX75-', 0)->innertext;
$item['uid'] = $post->{'data-analytics-view-value'};
$descriptionPatterns = ['/<\s*dt[^>]*>\b/', '/<\/dt>/', '/<\s*dd[^>]*>\b/', '/<\/dd>/'];
$descriptionReplacements = ['<span>', ':</span> ', '<strong>', '&emsp;</strong> '];
$description = $post->find('.m7er_k4.mpof_5r.mpof_z0_s', 0)->innertext;
$descriptionPretty = preg_replace($descriptionPatterns, $descriptionReplacements, $description);
$buyNowAuction = $post->find('.mqu1_g3.mvrt_0.mgn2_12', 0)->innertext ?? '';
$buyNowAuction = str_replace('</span><span', '</span> <span', $buyNowAuction);
$auctionTimeLeft = $post->find('._6a66d_ImOzU', 0)->innertext ?? '';
$price = $post->find('._6a66d_6R3iN', 0)->plaintext;
$price = empty($auctionTimeLeft) ? $price : $price . '- kwota licytacji';
$image = $post->find('._6a66d_44ioA img', 0)->{'data-src'} ?: $post->find('._6a66d_44ioA img', 0)->src ?? false;
if ($image) {
$item['enclosures'] = [$image . '#.image'];
}
$offerExtraInfo = array_filter($post->find('.mqu1_g3.mgn2_12'), function ($node) {
return empty($node->find('.mvrt_0'));
});
$offerExtraInfo = $offerExtraInfo[0]->plaintext ?? '';
$isSmart = $post->find('._6a66d_TC2Zk', 0)->innertext ?? '';
if (str_contains($isSmart, 'z kurierem')) {
$offerExtraInfo .= ', Smart z kurierem';
} else {
$offerExtraInfo .= ', Smart';
}
$item['categories'] = [];
$parameters = $post->find('dd');
foreach ($parameters as $parameter) {
if (in_array(strtolower($parameter->innertext), ['brak', 'nie'])) {
continue;
}
$item['categories'][] = $parameter->innertext;
}
$item['content'] = $descriptionPretty
. '<div><strong>'
. $price
. '</strong></div><div>'
. $auctionTimeLeft
. '</div><div>'
. $buyNowAuction
. '</div><dl>'
. $offerExtraInfo
. '</dl><hr>';
$this->items[] = $item;
}
}
}

View File

@@ -1,17 +1,18 @@
<?php
class AllocineFRBridge extends BridgeAbstract {
class AllocineFRBridge extends BridgeAbstract
{
const MAINTAINER = 'superbaillot.net';
const NAME = 'Allo Cine Bridge';
const CACHE_TIMEOUT = 25200; // 7h
const URI = 'https://www.allocine.fr';
const DESCRIPTION = 'Bridge for allocine.fr';
const PARAMETERS = array( array(
'category' => array(
const PARAMETERS = [ [
'category' => [
'name' => 'Emission',
'type' => 'list',
'title' => 'Sélectionner l\'emission',
'values' => array(
'values' => [
'Faux Raccord' => 'faux-raccord',
'Fanzone' => 'fanzone',
'Game In Ciné' => 'game-in-cine',
@@ -27,14 +28,14 @@ class AllocineFRBridge extends BridgeAbstract {
'Complètement...' => 'completement',
'#Fun Facts' => 'fun-facts',
'Origin Story' => 'origin-story',
)
)
));
]
]
]];
public function getURI(){
public function getURI()
{
if (!is_null($this->getInput('category'))) {
$categories = array(
$categories = [
'faux-raccord' => '/video/programme-12284/',
'fanzone' => '/video/programme-12298/',
'game-in-cine' => '/video/programme-12288/',
@@ -50,7 +51,7 @@ class AllocineFRBridge extends BridgeAbstract {
'completement' => '/video/programme-23859/',
'fun-facts' => '/video/programme-23040/',
'origin-story' => '/video/programme-25667/'
);
];
$category = $this->getInput('category');
if (array_key_exists($category, $categories)) {
@@ -71,28 +72,21 @@ class AllocineFRBridge extends BridgeAbstract {
return $URI;
}
public function getName(){
public function getName()
{
if (!is_null($this->getInput('category'))) {
return self::NAME . ' : '
. array_search(
$this->getInput('category'),
self::PARAMETERS[$this->queriedContext]['category']['values']
);
return self::NAME . ' : ' . $this->getKey('category');
}
return parent::getName();
}
public function collectData(){
public function collectData()
{
$html = getSimpleHTMLDOM($this->getURI());
$category = array_search(
$this->getInput('category'),
self::PARAMETERS[$this->queriedContext]['category']['values']
);
foreach ($html->find('div[class=gd-col-left]', 0)->find('div[class*=video-card]') as $element) {
$item = array();
$item = [];
$title = $element->find('a[class*=meta-title-link]', 0);
$content = trim(defaultLinkTo($element->outertext, static::URI));

View File

@@ -0,0 +1,41 @@
<?php
class AllocineFRSortiesBridge extends BridgeAbstract
{
const MAINTAINER = 'Simounet';
const NAME = 'AlloCiné Sorties Bridge';
const CACHE_TIMEOUT = 25200; // 7h
const BASE_URI = 'https://www.allocine.fr';
const URI = self::BASE_URI . '/film/sorties-semaine/';
const DESCRIPTION = 'Bridge for AlloCiné - Sorties cinéma cette semaine';
public function getName()
{
return self::NAME;
}
public function collectData()
{
$html = getSimpleHTMLDOM($this->getURI());
foreach ($html->find('section.section.section-wrap', 0)->find('li.mdl') as $element) {
$item = [];
$thumb = $element->find('figure.thumbnail', 0);
$meta = $element->find('div.meta-body', 0);
$synopsis = $element->find('div.synopsis', 0);
$title = $element->find('a[class*=meta-title-link]', 0);
$content = trim(defaultLinkTo($thumb->outertext . $meta->outertext . $synopsis->outertext, static::URI));
// Replace image 'src' with the one in 'data-src'
$content = preg_replace('@src="data:image/gif;base64,[A-Za-z0-9=+\/]*"@', '', $content);
$content = preg_replace('@data-src=@', 'src=', $content);
$item['content'] = $content;
$item['title'] = trim($title->innertext);
$item['uri'] = static::BASE_URI . '/' . substr($title->href, 1);
$this->items[] = $item;
}
}
}

View File

@@ -1,35 +1,35 @@
<?php
class AmazonBridge extends BridgeAbstract {
class AmazonBridge extends BridgeAbstract
{
const MAINTAINER = 'Alexis CHEMEL';
const NAME = 'Amazon';
const URI = 'https://www.amazon.com/';
const CACHE_TIMEOUT = 3600; // 1h
const DESCRIPTION = 'Returns products from Amazon search';
const PARAMETERS = array(array(
'q' => array(
const PARAMETERS = [[
'q' => [
'name' => 'Keyword',
'required' => true,
'exampleValue' => 'watch',
),
'sort' => array(
],
'sort' => [
'name' => 'Sort by',
'type' => 'list',
'values' => array(
'values' => [
'Relevance' => 'relevanceblender',
'Price: Low to High' => 'price-asc-rank',
'Price: High to Low' => 'price-desc-rank',
'Average Customer Review' => 'review-rank',
'Newest Arrivals' => 'date-desc-rank',
),
],
'defaultValue' => 'relevanceblender',
),
'tld' => array(
],
'tld' => [
'name' => 'Country',
'type' => 'list',
'values' => array(
'values' => [
'Australia' => 'com.au',
'Brazil' => 'com.br',
'Canada' => 'ca',
@@ -41,18 +41,19 @@ class AmazonBridge extends BridgeAbstract {
'Japan' => 'co.jp',
'Mexico' => 'com.mx',
'Netherlands' => 'nl',
'Poland' => 'pl',
'Spain' => 'es',
'Sweden' => 'se',
'Turkey' => 'com.tr',
'United Kingdom' => 'co.uk',
'United States' => 'com',
),
],
'defaultValue' => 'com',
),
));
public function collectData() {
],
]];
public function collectData()
{
$baseUrl = sprintf('https://www.amazon.%s', $this->getInput('tld'));
$url = sprintf(
@@ -93,7 +94,8 @@ class AmazonBridge extends BridgeAbstract {
}
}
public function getName(){
public function getName()
{
if (!is_null($this->getInput('tld')) && !is_null($this->getInput('q'))) {
return 'Amazon.' . $this->getInput('tld') . ': ' . $this->getInput('q');
}

View File

@@ -1,25 +1,26 @@
<?php
class AmazonPriceTrackerBridge extends BridgeAbstract {
class AmazonPriceTrackerBridge extends BridgeAbstract
{
const MAINTAINER = 'captn3m0, sal0max';
const NAME = 'Amazon Price Tracker';
const URI = 'https://www.amazon.com/';
const CACHE_TIMEOUT = 3600; // 1h
const DESCRIPTION = 'Tracks price for a single product on Amazon';
const PARAMETERS = array(
array(
'asin' => array(
const PARAMETERS = [
[
'asin' => [
'name' => 'ASIN',
'required' => true,
'exampleValue' => 'B071GB1VMQ',
// https://stackoverflow.com/a/12827734
'pattern' => 'B[\dA-Z]{9}|\d{9}(X|\d)',
),
'tld' => array(
],
'tld' => [
'name' => 'Country',
'type' => 'list',
'values' => array(
'values' => [
'Australia' => 'com.au',
'Brazil' => 'com.br',
'Canada' => 'ca',
@@ -31,24 +32,25 @@ class AmazonPriceTrackerBridge extends BridgeAbstract {
'Japan' => 'co.jp',
'Mexico' => 'com.mx',
'Netherlands' => 'nl',
'Poland' => 'pl',
'Spain' => 'es',
'Sweden' => 'se',
'Turkey' => 'com.tr',
'United Kingdom' => 'co.uk',
'United States' => 'com',
),
],
'defaultValue' => 'com',
),
));
],
]];
const PRICE_SELECTORS = array(
const PRICE_SELECTORS = [
'#priceblock_ourprice',
'.priceBlockBuyingPriceString',
'#newBuyBoxPrice',
'#tp_price_block_total_price_ww',
'span.offer-price',
'.a-color-price',
);
];
const WHITESPACE = " \t\n\r\0\x0B\xC2\xA0";
@@ -57,14 +59,16 @@ class AmazonPriceTrackerBridge extends BridgeAbstract {
/**
* Generates domain name given a amazon TLD
*/
private function getDomainName() {
private function getDomainName()
{
return 'https://www.amazon.' . $this->getInput('tld');
}
/**
* Generates URI for a Amazon product page
*/
public function getURI() {
public function getURI()
{
if (!is_null($this->getInput('asin'))) {
return $this->getDomainName() . '/dp/' . $this->getInput('asin');
}
@@ -75,7 +79,8 @@ class AmazonPriceTrackerBridge extends BridgeAbstract {
* Scrapes the product title from the html page
* returns the default title if scraping fails
*/
private function getTitle($html) {
private function getTitle($html)
{
$titleTag = $html->find('#productTitle', 0);
if (!$titleTag) {
@@ -88,7 +93,8 @@ class AmazonPriceTrackerBridge extends BridgeAbstract {
/**
* Title used by the feed if none could be found
*/
private function getDefaultTitle() {
private function getDefaultTitle()
{
return 'Amazon.' . $this->getInput('tld') . ': ' . $this->getInput('asin');
}
@@ -96,7 +102,8 @@ class AmazonPriceTrackerBridge extends BridgeAbstract {
* Returns name for the feed
* Uses title (already scraped) if it has one
*/
public function getName() {
public function getName()
{
if (isset($this->title)) {
return $this->title;
} else {
@@ -104,7 +111,8 @@ class AmazonPriceTrackerBridge extends BridgeAbstract {
}
}
private function parseDynamicImage($attribute) {
private function parseDynamicImage($attribute)
{
$json = json_decode(html_entity_decode($attribute), true);
if ($json and count($json) > 0) {
@@ -115,7 +123,8 @@ class AmazonPriceTrackerBridge extends BridgeAbstract {
/**
* Returns a generated image tag for the product
*/
private function getImage($html) {
private function getImage($html)
{
$imageSrc = $html->find('#main-image-container img', 0);
if ($imageSrc) {
@@ -134,46 +143,56 @@ EOT;
* Return \simple_html_dom object
* for the entire html of the product page
*/
private function getHtml() {
private function getHtml()
{
$uri = $this->getURI();
return getSimpleHTMLDOM($uri) ?: returnServerError('Could not request Amazon.');
}
private function scrapePriceFromMetrics($html) {
private function scrapePriceFromMetrics($html)
{
$asinData = $html->find('#cerberus-data-metrics', 0);
// <div id="cerberus-data-metrics" style="display: none;"
// data-asin="B00WTHJ5SU" data-asin-price="14.99" data-asin-shipping="0"
// data-asin-currency-code="USD" data-substitute-count="-1" ... />
if ($asinData) {
return array(
return [
'price' => $asinData->getAttribute('data-asin-price'),
'currency' => $asinData->getAttribute('data-asin-currency-code'),
'shipping' => $asinData->getAttribute('data-asin-shipping')
);
];
}
return false;
}
private function scrapePriceTwister($html) {
private function scrapePriceTwister($html)
{
$str = $html->find('.twister-plus-buying-options-price-data', 0);
$data = json_decode($str->innertext, true);
if (count($data) === 1) {
$data = $data[0];
return array(
return [
'displayPrice' => $data['displayPrice'],
'currency' => $data['currency'],
'shipping' => '0',
);
];
}
return false;
}
private function scrapePriceGeneric($html) {
private function scrapePriceGeneric($html)
{
$default = [
'price' => null,
'displayPrice' => null,
'currency' => null,
'shipping' => null,
];
$priceDiv = null;
foreach (self::PRICE_SELECTORS as $sel) {
@@ -184,59 +203,51 @@ EOT;
}
if (!$priceDiv) {
return false;
return $default;
}
$priceString = str_replace(str_split(self::WHITESPACE), '', $priceDiv->plaintext);
preg_match('/(\d+\.\d{0,2})/', $priceString, $matches);
$price = $matches[0];
$price = $matches[0] ?? null;
$currency = str_replace($price, '', $priceString);
if ($price != null && $currency != null) {
return array(
return [
'price' => $price,
'displayPrice' => null,
'currency' => $currency,
'shipping' => '0'
);
];
}
return $default;
}
return false;
}
private function renderContent($image, $data) {
$price = $data['displayPrice'];
if (!$price) {
$price = "{$data['price']} {$data['currency']}";
}
$html = "$image<br>Price: $price";
if ($data['shipping'] !== '0') {
$html .= "<br>Shipping: {$data['shipping']} {$data['currency']}</br>";
}
return $html;
}
/**
* Scrape method for Amazon product page
* @return [type] [description]
*/
public function collectData() {
public function collectData()
{
$html = $this->getHtml();
$this->title = $this->getTitle($html);
$imageTag = $this->getImage($html);
$image = $this->getImage($html);
$data = $this->scrapePriceGeneric($html);
$item = array(
// render
$content = '';
$price = $data['displayPrice'];
if (!$price) {
$price = sprintf('%s %s', $data['price'], $data['currency']);
}
$content .= sprintf('%s<br>Price: %s', $image, $price);
if ($data['shipping'] !== '0') {
$content .= sprintf('<br>Shipping: %s %s</br>', $data['shipping'], $data['currency']);
}
$item = [
'title' => $this->title,
'uri' => $this->getURI(),
'content' => $this->renderContent($imageTag, $data),
'content' => $content,
// This is to ensure that feed readers notice the price change
'uid' => md5($data['price'])
);
];
$this->items[] = $item;
}

View File

@@ -1,18 +1,19 @@
<?php
class AnidexBridge extends BridgeAbstract {
class AnidexBridge extends BridgeAbstract
{
const MAINTAINER = 'ORelio';
const NAME = 'Anidex';
const URI = 'http://anidex.info/'; // anidex.info has ddos-guard so we need to use anidex.moe
const ALTERNATE_URI = 'https://anidex.moe/'; // anidex.moe returns 301 unless Host is set to anidex.info
const ALTERNATE_HOST = 'anidex.info'; // Correct host for requesting anidex.moe without 301 redirect
const DESCRIPTION = 'Returns the newest torrents, with optional search criteria.';
const PARAMETERS = array(
array(
'id' => array(
const PARAMETERS = [
[
'id' => [
'name' => 'Category',
'type' => 'list',
'values' => array(
'values' => [
'All categories' => '0',
'Anime' => '1,2,3',
'Anime - Sub' => '1',
@@ -34,12 +35,12 @@ class AnidexBridge extends BridgeAbstract {
'Pictures' => '14',
'Adult Video' => '15',
'Other' => '16'
)
),
'lang_id' => array(
]
],
'lang_id' => [
'name' => 'Language',
'type' => 'list',
'values' => array(
'values' => [
'All languages' => '0',
'English' => '1',
'Japanese' => '2',
@@ -72,52 +73,52 @@ class AnidexBridge extends BridgeAbstract {
'Spanish (LATAM)' => '29',
'Persian' => '30',
'Malaysian' => '31'
)
),
'group_id' => array(
]
],
'group_id' => [
'name' => 'Group ID',
'type' => 'number'
),
'r' => array(
],
'r' => [
'name' => 'Hide Remakes',
'type' => 'checkbox'
),
'b' => array(
],
'b' => [
'name' => 'Only Batches',
'type' => 'checkbox'
),
'a' => array(
],
'a' => [
'name' => 'Only Authorized',
'type' => 'checkbox'
),
'q' => array(
],
'q' => [
'name' => 'Keyword',
'description' => 'Keyword(s)',
'type' => 'text'
),
'h' => array(
],
'h' => [
'name' => 'Adult content',
'type' => 'list',
'values' => array(
'values' => [
'No filter' => '0',
'Hide +18' => '1',
'Only +18' => '2'
)
)
)
);
public function collectData() {
]
]
]
];
public function collectData()
{
// Build Search URL from user-provided parameters
$search_url = self::ALTERNATE_URI . '?s=upload_timestamp&o=desc';
foreach (array('id', 'lang_id', 'group_id') as $param_name) {
foreach (['id', 'lang_id', 'group_id'] as $param_name) {
$param = $this->getInput($param_name);
if (!empty($param) && intval($param) != 0 && ctype_digit(str_replace(',', '', $param))) {
$search_url .= '&' . $param_name . '=' . $param;
}
}
foreach (array('r', 'b', 'a') as $param_name) {
foreach (['r', 'b', 'a'] as $param_name) {
$param = $this->getInput($param_name);
if (!empty($param) && boolval($param)) {
$search_url .= '&' . $param_name . '=1';
@@ -127,14 +128,14 @@ class AnidexBridge extends BridgeAbstract {
if (!empty($query)) {
$search_url .= '&q=' . urlencode($query);
}
$opt = array();
$opt = [];
$h = $this->getInput('h');
if (!empty($h) && intval($h) != 0 && ctype_digit($h)) {
$opt[CURLOPT_COOKIE] = 'anidex_h_toggle=' . $h;
}
// We need to use a different Host HTTP header to reach the correct page on ALTERNATE_URI
$headers = array('Host: ' . self::ALTERNATE_HOST);
$headers = ['Host: ' . self::ALTERNATE_HOST];
// The HTTPS certificate presented by anidex.moe is for anidex.info. We need to ignore this.
// As a consequence, the bridge is intentionally marked as insecure by setting self::URI to http://
@@ -144,16 +145,18 @@ class AnidexBridge extends BridgeAbstract {
// Retrieve torrent listing from search results, which does not contain torrent description
$html = getSimpleHTMLDOM($search_url, $headers, $opt);
$links = $html->find('a');
$results = array();
foreach ($links as $link)
if (strpos($link->href, '/torrent/') === 0 && !in_array($link->href, $results))
$results = [];
foreach ($links as $link) {
if (strpos($link->href, '/torrent/') === 0 && !in_array($link->href, $results)) {
$results[] = $link->href;
if (empty($results) && empty($this->getInput('q')))
}
}
if (empty($results) && empty($this->getInput('q'))) {
returnServerError('No results from Anidex: ' . $search_url);
}
//Process each item individually
foreach ($results as $element) {
//Limit total amount of requests
if (count($this->items) >= 20) {
break;
@@ -163,14 +166,12 @@ class AnidexBridge extends BridgeAbstract {
//Ignore entries without valid torrent ID
if ($torrent_id != 0 && ctype_digit($torrent_id)) {
//Retrieve data for this torrent ID
$item_browse_uri = self::URI . 'torrent/' . $torrent_id;
$item_fetch_uri = self::ALTERNATE_URI . 'torrent/' . $torrent_id;
//Retrieve full description from torrent page (cached for 24 hours: 86400 seconds)
if ($item_html = getSimpleHTMLDOMCached($item_fetch_uri, 86400, $headers, $opt)) {
//Retrieve data from page contents
$item_title = str_replace(' (Torrent) - AniDex ', '', $item_html->find('title', 0)->plaintext);
$item_desc = $item_html->find('div.panel-body', 0);
@@ -200,12 +201,12 @@ class AnidexBridge extends BridgeAbstract {
}
//Build and add final item
$item = array();
$item = [];
$item['uri'] = $item_browse_uri;
$item['title'] = $item_title;
$item['author'] = $item_author;
$item['timestamp'] = $item_date;
$item['enclosures'] = array($item_image);
$item['enclosures'] = [$item_image];
$item['content'] = $item_desc;
$this->items[] = $item;
}

View File

@@ -1,33 +1,31 @@
<?php
class AnimeUltimeBridge extends BridgeAbstract {
class AnimeUltimeBridge extends BridgeAbstract
{
const MAINTAINER = 'ORelio';
const NAME = 'Anime-Ultime';
const URI = 'http://www.anime-ultime.net/';
const CACHE_TIMEOUT = 10800; // 3h
const DESCRIPTION = 'Returns the newest releases posted on Anime-Ultime.';
const PARAMETERS = array( array(
'type' => array(
const PARAMETERS = [ [
'type' => [
'name' => 'Type',
'type' => 'list',
'values' => array(
'values' => [
'Everything' => '',
'Anime' => 'A',
'Drama' => 'D',
'Tokusatsu' => 'T'
)
)
));
]
]
]];
private $filter = 'Releases';
public function collectData(){
public function collectData()
{
//Add type filter if provided
$typeFilter = array_search(
$this->getInput('type'),
self::PARAMETERS[$this->queriedContext]['type']['values']
);
$typeFilter = $this->getKey('type');
//Build date and filters for making requests
$thismonth = date('mY') . $typeFilter;
@@ -35,8 +33,7 @@ class AnimeUltimeBridge extends BridgeAbstract {
//Process each HTML page until having 10 releases
$processedOK = 0;
foreach (array($thismonth, $lastmonth) as $requestFilter) {
foreach ([$thismonth, $lastmonth] as $requestFilter) {
$url = self::URI . 'history-0-1/' . $requestFilter;
$html = getContents($url);
// Convert html from iso-8859-1 => utf8
@@ -45,7 +42,6 @@ class AnimeUltimeBridge extends BridgeAbstract {
//Relases are sorted by day : process each day individually
foreach ($html->find('div.history', 0)->find('h3') as $daySection) {
//Retrieve day and build date information
$dateString = $daySection->plaintext;
$day = intval(substr($dateString, strpos($dateString, ' ') + 1, 2));
@@ -61,7 +57,6 @@ class AnimeUltimeBridge extends BridgeAbstract {
//Process each release of that day, ignoring first table row: contains table headers
while (!is_null($release = $release->next_sibling())) {
if (count($release->find('td')) > 0) {
//Retrieve metadata from table columns
$item_link_element = $release->find('td', 0)->find('a', 0);
$item_uri = self::URI . $item_link_element->href;
@@ -86,7 +81,6 @@ class AnimeUltimeBridge extends BridgeAbstract {
$item_type = $release->find('td', 4)->plaintext;
if (!empty($item_uri)) {
// Retrieve description from description page
$html_item = getContents($item_uri);
// Convert html from iso-8859-1 => utf8
@@ -95,7 +89,8 @@ class AnimeUltimeBridge extends BridgeAbstract {
$html_item,
strpos($html_item, 'class="principal_contain" align="center">') + 41
);
$item_description = substr($item_description,
$item_description = substr(
$item_description,
0,
strpos($item_description, '<div id="table">')
);
@@ -106,18 +101,18 @@ class AnimeUltimeBridge extends BridgeAbstract {
$item_description = str_replace("\n", '', $item_description);
//Build and add final item
$item = array();
$item = [];
$item['uri'] = $item_uri;
$item['title'] = $item_name . ' ' . $item_type . ' ' . $item_episode;
$item['author'] = $item_fansub;
$item['timestamp'] = $item_date;
$item['enclosures'] = array($item_image);
$item['enclosures'] = [$item_image];
$item['content'] = $item_description;
$this->items[] = $item;
$processedOK++;
//Stop processing once limit is reached
if ($processedOK >= 10)
if ($processedOK >= 10) {
return;
}
}
@@ -125,15 +120,12 @@ class AnimeUltimeBridge extends BridgeAbstract {
}
}
}
}
public function getName() {
public function getName()
{
if (!is_null($this->getInput('type'))) {
$typeFilter = array_search(
$this->getInput('type'),
self::PARAMETERS[$this->queriedContext]['type']['values']
);
return 'Latest ' . $typeFilter . ' - Anime-Ultime Bridge';
return 'Latest ' . $this->getKey('type') . ' - Anime-Ultime Bridge';
}
return parent::getName();

View File

@@ -1,23 +1,23 @@
<?php
class AppleAppStoreBridge extends BridgeAbstract {
class AppleAppStoreBridge extends BridgeAbstract
{
const MAINTAINER = 'captn3m0';
const NAME = 'Apple App Store';
const URI = 'https://apps.apple.com/';
const CACHE_TIMEOUT = 3600; // 1h
const DESCRIPTION = 'Returns version updates for a specific application';
const PARAMETERS = array(array(
'id' => array(
const PARAMETERS = [[
'id' => [
'name' => 'Application ID',
'required' => true,
'exampleValue' => '310633997'
),
'p' => array(
],
'p' => [
'name' => 'Platform',
'type' => 'list',
'values' => array(
'values' => [
'iPad' => 'ipad',
'iPhone' => 'iphone',
'Mac' => 'mac',
@@ -26,36 +26,51 @@ class AppleAppStoreBridge extends BridgeAbstract {
// but not yet tested
'Web' => 'web',
'Apple TV' => 'appletv',
),
],
'defaultValue' => 'iphone',
),
'country' => array(
],
'country' => [
'name' => 'Store Country',
'type' => 'list',
'values' => array(
'values' => [
'US' => 'US',
'India' => 'IN',
'Canada' => 'CA',
'Germany' => 'DE',
),
'Netherlands' => 'NL',
'Belgium (NL)' => 'BENL',
'Belgium (FR)' => 'BEFR',
'France' => 'FR',
'Italy' => 'IT',
'United Kingdom' => 'UK',
'Spain' => 'ES',
'Portugal' => 'PT',
'Australia' => 'AU',
'New Zealand' => 'NZ',
'Indonesia' => 'ID',
'Brazil' => 'BR',
],
'defaultValue' => 'US',
),
));
],
]];
const PLATFORM_MAPPING = array(
const PLATFORM_MAPPING = [
'iphone' => 'ios',
'ipad' => 'ios',
);
];
private function makeHtmlUrl($id, $country){
private function makeHtmlUrl($id, $country)
{
return 'https://apps.apple.com/' . $country . '/app/id' . $id;
}
private function makeJsonUrl($id, $platform, $country){
private function makeJsonUrl($id, $platform, $country)
{
return "https://amp-api.apps.apple.com/v1/catalog/$country/apps/$id?platform=$platform&extend=versionHistory";
}
public function getName(){
public function getName()
{
if (isset($this->name)) {
return $this->name . ' - AppStore Updates';
}
@@ -66,7 +81,8 @@ class AppleAppStoreBridge extends BridgeAbstract {
/**
* In case of some platforms, the data is present in the initial response
*/
private function getDataFromShoebox($id, $platform, $country){
private function getDataFromShoebox($id, $platform, $country)
{
$uri = $this->makeHtmlUrl($id, $country);
$html = getSimpleHTMLDOMCached($uri, 3600);
$script = $html->find('script[id="shoebox-ember-data-store"]', 0);
@@ -75,7 +91,8 @@ class AppleAppStoreBridge extends BridgeAbstract {
return $json['data'];
}
private function getJWTToken($id, $platform, $country){
private function getJWTToken($id, $platform, $country)
{
$uri = $this->makeHtmlUrl($id, $country);
$html = getSimpleHTMLDOMCached($uri, 3600);
@@ -89,13 +106,14 @@ class AppleAppStoreBridge extends BridgeAbstract {
return $json->MEDIA_API->token;
}
private function getAppData($id, $platform, $country, $token){
private function getAppData($id, $platform, $country, $token)
{
$uri = $this->makeJsonUrl($id, $platform, $country);
$headers = array(
$headers = [
"Authorization: Bearer $token",
'Origin: https://apps.apple.com',
);
];
$json = json_decode(getContents($uri, $headers), true);
@@ -106,7 +124,8 @@ class AppleAppStoreBridge extends BridgeAbstract {
* Parses the version history from the data received
* @return array list of versions with details on each element
*/
private function getVersionHistory($data, $platform){
private function getVersionHistory($data, $platform)
{
switch ($platform) {
case 'mac':
return $data['relationships']['platforms']['data'][0]['attributes']['versionHistory'];
@@ -116,7 +135,8 @@ class AppleAppStoreBridge extends BridgeAbstract {
}
}
public function collectData() {
public function collectData()
{
$id = $this->getInput('id');
$country = $this->getInput('country');
$platform = $this->getInput('p');
@@ -136,7 +156,7 @@ class AppleAppStoreBridge extends BridgeAbstract {
$author = $data['attributes']['artistName'];
foreach ($versionHistory as $row) {
$item = array();
$item = [];
$item['content'] = nl2br($row['releaseNotes']);
$item['title'] = $name . ' - ' . $row['versionDisplay'];

View File

@@ -1,25 +1,27 @@
<?php
class AppleMusicBridge extends BridgeAbstract {
class AppleMusicBridge extends BridgeAbstract
{
const NAME = 'Apple Music';
const URI = 'https://www.apple.com';
const DESCRIPTION = 'Fetches the latest releases from an artist';
const MAINTAINER = 'bockiii';
const PARAMETERS = array(array(
'artist' => array(
const PARAMETERS = [[
'artist' => [
'name' => 'Artist ID',
'exampleValue' => '909253',
'required' => true,
),
'limit' => array(
],
'limit' => [
'name' => 'Latest X Releases (max 50)',
'defaultValue' => '10',
'required' => true,
),
));
],
]];
const CACHE_TIMEOUT = 21600; // 6 hours
public function collectData() {
public function collectData()
{
# Limit the amount of releases to 50
if ($this->getInput('limit') > 50) {
$limit = 50;
@@ -38,7 +40,7 @@ class AppleMusicBridge extends BridgeAbstract {
foreach ($json->results as $obj) {
if ($obj->wrapperType === 'collection') {
$this->items[] = array(
$this->items[] = [
'title' => $obj->artistName . ' - ' . $obj->collectionName,
'uri' => $obj->collectionViewUrl,
'timestamp' => $obj->releaseDate,
@@ -48,7 +50,7 @@ class AppleMusicBridge extends BridgeAbstract {
. $obj->artistName . ' - ' . $obj->collectionName
. '<br>'
. $obj->copyright,
);
];
}
}
}

View File

@@ -1,56 +1,63 @@
<?php
class ArtStationBridge extends BridgeAbstract {
class ArtStationBridge extends BridgeAbstract
{
const NAME = 'ArtStation';
const URI = 'https://www.artstation.com';
const DESCRIPTION = 'Fetches the latest ten artworks from a search query on ArtStation.';
const MAINTAINER = 'thefranke';
const CACHE_TIMEOUT = 3600; // 1h
const PARAMETERS = array(
'Search Query' => array(
'q' => array(
const PARAMETERS = [
'Search Query' => [
'q' => [
'name' => 'Search term',
'required' => true,
'exampleValue' => 'bird'
)
)
);
]
]
];
public function getIcon() {
public function getIcon()
{
return 'https://www.artstation.com/assets/favicon-58653022bc38c1905ac7aa1b10bffa6b.ico';
}
public function getName() {
public function getName()
{
return self::NAME . ': ' . $this->getInput('q');
}
private function fetchSearch($searchQuery) {
private function fetchSearch($searchQuery)
{
$data = '{"query":"' . $searchQuery . '","page":1,"per_page":50,"sorting":"date",';
$data .= '"pro_first":"1","filters":[],"additional_fields":[]}';
$header = array(
$header = [
'Content-Type: application/json',
'Accept: application/json'
);
];
$opts = array(
$opts = [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $data,
CURLOPT_RETURNTRANSFER => true
);
];
$jsonSearchURL = self::URI . '/api/v2/search/projects.json';
$jsonSearchStr = getContents($jsonSearchURL, $header, $opts);
return json_decode($jsonSearchStr);
}
private function fetchProject($hashID) {
private function fetchProject($hashID)
{
$jsonProjectURL = self::URI . '/projects/' . $hashID . '.json';
$jsonProjectStr = getContents($jsonProjectURL);
return json_decode($jsonProjectStr);
}
public function collectData() {
public function collectData()
{
$searchTerm = $this->getInput('q');
$jsonQuery = $this->fetchSearch($searchTerm);
@@ -59,7 +66,7 @@ class ArtStationBridge extends BridgeAbstract {
$jsonProject = $this->fetchProject($media->hash_id);
// create item
$item = array();
$item = [];
$item['title'] = $media->title;
$item['uri'] = $media->url;
$item['timestamp'] = strtotime($jsonProject->published_at);
@@ -76,17 +83,19 @@ class ArtStationBridge extends BridgeAbstract {
$numAssets = count($jsonProject->assets);
if ($numAssets > 1)
if ($numAssets > 1) {
$item['content'] .= '<p><a href="'
. $media->url
. '">Project contains '
. ($numAssets - 1)
. ' more item(s).</a></p>';
}
$this->items[] = $item;
if (count($this->items) >= 10)
if (count($this->items) >= 10) {
break;
}
}
}
}

View File

@@ -1,22 +1,22 @@
<?php
class Arte7Bridge extends BridgeAbstract {
class Arte7Bridge extends BridgeAbstract
{
const NAME = 'Arte +7';
const URI = 'https://www.arte.tv/';
const MAINTAINER = 'imagoiq';
const CACHE_TIMEOUT = 1800; // 30min
const DESCRIPTION = 'Returns newest videos from ARTE +7';
const API_TOKEN = 'Nzc1Yjc1ZjJkYjk1NWFhN2I2MWEwMmRlMzAzNjI5NmU3NWU3ODg4ODJjOWMxNTMxYzEzZGRjYjg2ZGE4MmIwOA';
const PARAMETERS = array(
const PARAMETERS = [
'global' => [
'sort_by' => array(
'sort_by' => [
'type' => 'list',
'name' => 'Sort by',
'required' => false,
'defaultValue' => null,
'values' => array(
'values' => [
'Default' => null,
'Video rights start date' => 'videoRightsBegin',
'Video rights end date' => 'videoRightsEnd',
@@ -27,18 +27,18 @@ class Arte7Bridge extends BridgeAbstract {
'Number of views per period' => 'viewsPeriod',
'Available screens' => 'availableScreens',
'Episode' => 'episode'
),
),
'sort_direction' => array(
],
],
'sort_direction' => [
'type' => 'list',
'name' => 'Sort direction',
'required' => false,
'defaultValue' => 'DESC',
'values' => array(
'values' => [
'Ascending' => 'ASC',
'Descending' => 'DESC'
),
),
],
],
'exclude_trailers' => [
'name' => 'Exclude trailers',
'type' => 'checkbox',
@@ -46,23 +46,23 @@ class Arte7Bridge extends BridgeAbstract {
'defaultValue' => false
],
],
'Category' => array(
'lang' => array(
'Category' => [
'lang' => [
'type' => 'list',
'name' => 'Language',
'values' => array(
'values' => [
'Français' => 'fr',
'Deutsch' => 'de',
'English' => 'en',
'Español' => 'es',
'Polski' => 'pl',
'Italiano' => 'it'
),
),
'cat' => array(
],
],
'cat' => [
'type' => 'list',
'name' => 'Category',
'values' => array(
'values' => [
'All videos' => null,
'News & society' => 'ACT',
'Series & fiction' => 'SER',
@@ -73,32 +73,33 @@ class Arte7Bridge extends BridgeAbstract {
'History' => 'HIST',
'Science' => 'SCI',
'Other' => 'AUT'
)
),
),
'Collection' => array(
'lang' => array(
]
],
],
'Collection' => [
'lang' => [
'type' => 'list',
'name' => 'Language',
'values' => array(
'values' => [
'Français' => 'fr',
'Deutsch' => 'de',
'English' => 'en',
'Español' => 'es',
'Polski' => 'pl',
'Italiano' => 'it'
)
),
'col' => array(
]
],
'col' => [
'name' => 'Collection id',
'required' => true,
'title' => 'ex. RC-014095 pour https://www.arte.tv/de/videos/RC-014095/blow-up/',
'exampleValue' => 'RC-014095'
)
)
);
]
]
];
public function collectData(){
public function collectData()
{
switch ($this->queriedContext) {
case 'Category':
$category = $this->getInput('cat');
@@ -120,9 +121,9 @@ class Arte7Bridge extends BridgeAbstract {
. ($category != null ? '&category.code=' . $category : '')
. ($collectionId != null ? '&collections.collectionId=' . $collectionId : '');
$header = array(
$header = [
'Authorization: Bearer ' . self::API_TOKEN
);
];
$input = getContents($url, $header);
$input_json = json_decode($input, true);
@@ -134,15 +135,16 @@ class Arte7Bridge extends BridgeAbstract {
$durationSeconds = $element['durationSeconds'];
$item = array();
$item = [];
$item['uri'] = $element['url'];
$item['id'] = $element['id'];
$item['timestamp'] = strtotime($element['videoRightsBegin']);
$item['title'] = $element['title'];
if(!empty($element['subtitle']))
if (!empty($element['subtitle'])) {
$item['title'] = $element['title'] . ' | ' . $element['subtitle'];
}
$durationMinutes = round((int)$durationSeconds / 60);
$item['content'] = $element['teaserText']

View File

@@ -1,16 +1,18 @@
<?php
class AsahiShimbunAJWBridge extends BridgeAbstract {
class AsahiShimbunAJWBridge extends BridgeAbstract
{
const NAME = 'Asahi Shimbun AJW';
const BASE_URI = 'http://www.asahi.com';
const URI = self::BASE_URI . '/ajw/';
const DESCRIPTION = 'Asahi Shimbun - Asia & Japan Watch';
const MAINTAINER = 'somini';
const PARAMETERS = array(
array(
'section' => array(
const PARAMETERS = [
[
'section' => [
'type' => 'list',
'name' => 'Section',
'values' => array(
'values' => [
'Japan » Social Affairs' => 'japan/social',
'Japan » People' => 'japan/people',
'Japan » 3/11 Disaster' => 'japan/0311disaster',
@@ -26,17 +28,19 @@ class AsahiShimbunAJWBridge extends BridgeAbstract {
'Asia » World' => 'asia_world/world',
'Opinion » Editorial' => 'opinion/editorial',
'Opinion » Vox Populi' => 'opinion/vox',
),
],
'defaultValue' => 'politics',
)
)
);
]
]
];
private function getSectionURI($section) {
return self::getURI() . $section . '/';
private function getSectionURI($section)
{
return $this->getURI() . $section . '/';
}
public function collectData() {
public function collectData()
{
$html = getSimpleHTMLDOM($this->getSectionURI($this->getInput('section')));
foreach ($html->find('#MainInner li a') as $element) {
@@ -44,7 +48,7 @@ class AsahiShimbunAJWBridge extends BridgeAbstract {
Debug::log('Skip Headline, it is repeated below');
continue;
}
$item = array();
$item = [];
$item['uri'] = self::BASE_URI . $element->href;
$e_lead = $element->find('span.Lead', 0);
@@ -64,7 +68,12 @@ class AsahiShimbunAJWBridge extends BridgeAbstract {
$e_video->outertext = '';
$element->innertext = "VIDEO: $element->innertext";
}
$e_title = $element->find('.title', 0);
if ($e_title) {
$item['title'] = $e_title->innertext;
} else {
$item['title'] = $element->innertext;
}
$this->items[] = $item;
}

View File

@@ -1,33 +1,36 @@
<?php
class AskfmBridge extends BridgeAbstract {
class AskfmBridge extends BridgeAbstract
{
const MAINTAINER = 'az5he6ch, logmanoriginal';
const NAME = 'Ask.fm Answers';
const URI = 'https://ask.fm/';
const CACHE_TIMEOUT = 300; //5 min
const DESCRIPTION = 'Returns answers from an Ask.fm user';
const PARAMETERS = array(
'Ask.fm username' => array(
'u' => array(
const PARAMETERS = [
'Ask.fm username' => [
'u' => [
'name' => 'Username',
'required' => true,
'exampleValue' => 'ApprovedAndReal'
)
)
);
]
]
];
public function collectData(){
public function collectData()
{
$html = getSimpleHTMLDOM($this->getURI());
$html = defaultLinkTo($html, self::URI);
foreach ($html->find('article.streamItem-answer') as $element) {
$item = array();
$item = [];
$item['uri'] = $element->find('a.streamItem_meta', 0)->href;
$question = trim($element->find('header.streamItem_header', 0)->innertext);
$item['title'] = trim(
htmlspecialchars_decode($element->find('header.streamItem_header', 0)->plaintext,
htmlspecialchars_decode(
$element->find('header.streamItem_header', 0)->plaintext,
ENT_QUOTES
)
);
@@ -56,7 +59,8 @@ class AskfmBridge extends BridgeAbstract {
}
}
public function getName(){
public function getName()
{
if (!is_null($this->getInput('u'))) {
return self::NAME . ' : ' . $this->getInput('u');
}
@@ -64,7 +68,8 @@ class AskfmBridge extends BridgeAbstract {
return parent::getName();
}
public function getURI(){
public function getURI()
{
if (!is_null($this->getInput('u'))) {
return self::URI . urlencode($this->getInput('u'));
}

View File

@@ -1,15 +1,17 @@
<?php
class AssociatedPressNewsBridge extends BridgeAbstract {
class AssociatedPressNewsBridge extends BridgeAbstract
{
const NAME = 'Associated Press News Bridge';
const URI = 'https://apnews.com/';
const DESCRIPTION = 'Returns newest articles by topic';
const MAINTAINER = 'VerifiedJoseph';
const PARAMETERS = array(
'Standard Topics' => array(
'topic' => array(
const PARAMETERS = [
'Standard Topics' => [
'topic' => [
'name' => 'Topic',
'type' => 'list',
'values' => array(
'values' => [
'AP Top News' => 'apf-topnews',
'Sports' => 'apf-sports',
'Entertainment' => 'apf-entertainment',
@@ -27,19 +29,19 @@ class AssociatedPressNewsBridge extends BridgeAbstract {
'Photo Galleries' => 'PhotoGalleries',
'Fact Checks' => 'APFactCheck',
'Videos' => 'apf-videos',
),
],
'defaultValue' => 'apf-topnews',
),
),
'Custom Topic' => array(
'topic' => array(
],
],
'Custom Topic' => [
'topic' => [
'name' => 'Topic',
'type' => 'text',
'required' => true,
'exampleValue' => 'europe'
),
)
);
],
]
];
const CACHE_TIMEOUT = 900; // 15 mins
@@ -47,8 +49,9 @@ class AssociatedPressNewsBridge extends BridgeAbstract {
private $tagEndpoint = 'https://afs-prod.appspot.com/api/v2/feed/tag?tags=';
private $feedName = '';
public function detectParameters($url) {
$params = array();
public function detectParameters($url)
{
$params = [];
if (preg_match($this->detectParamRegex, $url, $matches) > 0) {
$params['topic'] = $matches[1];
@@ -59,7 +62,8 @@ class AssociatedPressNewsBridge extends BridgeAbstract {
return null;
}
public function collectData() {
public function collectData()
{
switch ($this->getInput('topic')) {
case 'Podcasts':
returnClientError('Podcasts topic feed is not supported');
@@ -72,7 +76,8 @@ class AssociatedPressNewsBridge extends BridgeAbstract {
}
}
public function getURI() {
public function getURI()
{
if (!is_null($this->getInput('topic'))) {
return self::URI . $this->getInput('topic');
}
@@ -80,7 +85,8 @@ class AssociatedPressNewsBridge extends BridgeAbstract {
return parent::getURI();
}
public function getName() {
public function getName()
{
if (!empty($this->feedName)) {
return $this->feedName . ' - Associated Press';
}
@@ -88,7 +94,8 @@ class AssociatedPressNewsBridge extends BridgeAbstract {
return parent::getName();
}
private function getTagURI() {
private function getTagURI()
{
if (!is_null($this->getInput('topic'))) {
return $this->tagEndpoint . $this->getInput('topic');
}
@@ -96,7 +103,8 @@ class AssociatedPressNewsBridge extends BridgeAbstract {
return parent::getURI();
}
private function collectCardData() {
private function collectCardData()
{
$json = getContents($this->getTagURI())
or returnServerError('Could not request: ' . $this->getTagURI());
@@ -109,7 +117,7 @@ class AssociatedPressNewsBridge extends BridgeAbstract {
$this->feedName = $tagContents['tagObjs'][0]['name'];
foreach ($tagContents['cards'] as $card) {
$item = array();
$item = [];
// skip hub peeks & Notifications
if ($card['cardType'] == 'Hub Peek' || $card['cardType'] == 'Notification') {
@@ -141,8 +149,11 @@ class AssociatedPressNewsBridge extends BridgeAbstract {
$this->processIframes($html);
if (!is_null($storyContent['leadPhotoId'])) {
$item['enclosures'][] = 'https://storage.googleapis.com/afs-prod/media/'
. $storyContent['leadPhotoId'] . '/800.jpeg';
$leadPhotoUrl = sprintf('https://storage.googleapis.com/afs-prod/media/%s/800.jpeg', $storyContent['leadPhotoId']);
$leadPhotoImageTag = sprintf('<img src="%s">', $leadPhotoUrl);
// Move the image to the beginning of the content
$html = $leadPhotoImageTag . $html;
// Explicitly not adding it to the item's enclosures!
}
}
@@ -178,8 +189,8 @@ class AssociatedPressNewsBridge extends BridgeAbstract {
}
}
private function processMediaPlaceholders($html, $id) {
private function processMediaPlaceholders($html, $id)
{
if ($html->find('div.media-placeholder', 0)) {
// Fetch page content
$json = getContents('https://afs-prod.appspot.com/api/v2/content/' . $id);
@@ -216,11 +227,10 @@ EOD;
/*
Create full coverage links (HubLinks)
*/
private function processHubLinks($html, $storyContent) {
private function processHubLinks($html, $storyContent)
{
if (!empty($storyContent['richEmbeds'])) {
foreach ($storyContent['richEmbeds'] as $embed) {
if ($embed['type'] === 'Hub Link') {
$url = self::URI . $embed['tag']['id'];
$div = $html->find('div[id=' . $embed['id'] . ']', 0);
@@ -235,7 +245,8 @@ EOD;
}
}
private function processVideo($storyContent) {
private function processVideo($storyContent)
{
$video = $storyContent['media'][0];
if ($video['type'] === 'YouTube') {
@@ -255,8 +266,8 @@ EOD;
}
// Remove datawrapper.dwcdn.net iframes and related javaScript
private function processIframes($html) {
private function processIframes($html)
{
foreach ($html->find('iframe') as $index => $iframe) {
if (preg_match('/datawrapper\.dwcdn\.net/', $iframe->src)) {
$iframe->outertext = '';

View File

@@ -0,0 +1,53 @@
<?php
class AstrophysicsDataSystemBridge extends BridgeAbstract
{
const NAME = 'SAO/NASA Astrophysics Data System';
const DESCRIPTION = 'Returns the latest publications from a query';
const URI = 'https://ui.adsabs.harvard.edu';
const PARAMETERS = [
'Publications' => [
'query' => [
'name' => 'query',
'title' => 'Same format as the search bar on the website',
'exampleValue' => 'author:"huchra, john"',
'required' => true
]
]];
private $feedTitle;
public function getName()
{
if ($this->queriedContext === 'Publications') {
return $this->feedTitle;
}
return parent::getName();
}
public function getURI()
{
if ($this->queriedContext === 'Publications') {
return self::URI . '/search/?q=' . urlencode($this->getInput('query'));
}
return parent::getURI();
}
public function collectData()
{
$headers = [
'Cookie: core=always;'
];
$html = str_get_html(defaultLinkTo(getContents($this->getURI(), $headers), self::URI));
$this->feedTitle = html_entity_decode($html->find('title', 0)->plaintext);
foreach ($html->find('div.row > ul > li') as $pub) {
$item = [];
$item['title'] = $pub->find('h3.s-results-title', 0)->plaintext;
$item['content'] = $pub->find('div.s-results-links', 0);
$item['uri'] = $pub->find('a.abs-redirect-link', 0)->href;
$item['author'] = rtrim($pub->find('li.article-author', 0)->plaintext, ' ;');
$item['timestamp'] = $pub->find('div[aria-label="date published"]', 0)->plaintext;
$this->items[] = $item;
}
}
}

View File

@@ -1,22 +1,24 @@
<?php
class AtmoNouvelleAquitaineBridge extends BridgeAbstract {
class AtmoNouvelleAquitaineBridge extends BridgeAbstract
{
const NAME = 'Atmo Nouvelle Aquitaine';
const URI = 'https://www.atmo-nouvelleaquitaine.org';
const DESCRIPTION = 'Fetches the latest air polution of cities in Nouvelle Aquitaine from Atmo';
const MAINTAINER = 'floviolleau';
const PARAMETERS = array(array(
'cities' => array(
const PARAMETERS = [[
'cities' => [
'name' => 'Choisir une ville',
'type' => 'list',
'values' => self::CITIES
)
));
]
]];
const CACHE_TIMEOUT = 7200;
private $dom;
private function getClosest($search, $arr) {
private function getClosest($search, $arr)
{
$closest = null;
foreach ($arr as $key => $value) {
if ($closest === null || abs((int)$search - $closest) > abs((int)$key - (int)$search)) {
@@ -26,7 +28,8 @@ class AtmoNouvelleAquitaineBridge extends BridgeAbstract {
return $arr[$closest];
}
public function collectData() {
public function collectData()
{
$uri = self::URI . '/monair/commune/' . $this->getInput('cities');
$html = getSimpleHTMLDOM($uri);
@@ -47,7 +50,8 @@ class AtmoNouvelleAquitaineBridge extends BridgeAbstract {
$this->items[] = $item;
}
private function getIndex() {
private function getIndex()
{
$index = $this->dom->find('.indice', 0)->innertext;
if ($index == 'XX') {
@@ -57,12 +61,14 @@ class AtmoNouvelleAquitaineBridge extends BridgeAbstract {
return $index;
}
private function getMaxIndexText() {
private function getMaxIndexText()
{
// will return '/100'
return $this->dom->find('.pourcent', 0)->innertext;
}
private function getQualityText($index, $indexes) {
private function getQualityText($index, $indexes)
{
if ($index == -1) {
if (array_key_exists('no-available', $indexes)) {
return $indexes['no-available'];
@@ -74,9 +80,10 @@ class AtmoNouvelleAquitaineBridge extends BridgeAbstract {
return $this->getClosest($index, $indexes);
}
private function getLegendIndexes() {
private function getLegendIndexes()
{
$rawIndexes = $this->dom->find('.prevision-legend .prevision-legend-label');
$indexes = array();
$indexes = [];
for ($i = 0; $i < count($rawIndexes); $i++) {
if ($rawIndexes[$i]->hasAttribute('data-color')) {
$indexes[$rawIndexes[$i]->getAttribute('data-color')] = $rawIndexes[$i]->innertext;
@@ -86,7 +93,8 @@ class AtmoNouvelleAquitaineBridge extends BridgeAbstract {
return $indexes;
}
private function getTomorrowTrendIndex() {
private function getTomorrowTrendIndex()
{
$tomorrowTrendDomNode = $this->dom
->find('.day-controls.raster-controls .list-raster-controls .raster-control', 2);
$tomorrowTrendIndexNode = null;
@@ -104,7 +112,8 @@ class AtmoNouvelleAquitaineBridge extends BridgeAbstract {
return $tomorrowTrendIndex;
}
private function getTomorrowTrendQualityText($trendIndex, $indexes) {
private function getTomorrowTrendQualityText($trendIndex, $indexes)
{
if ($trendIndex == -1) {
if (array_key_exists('no-available', $indexes)) {
return $indexes['no-available'];
@@ -116,7 +125,8 @@ class AtmoNouvelleAquitaineBridge extends BridgeAbstract {
return $this->getClosest($trendIndex, $indexes);
}
private function getIndexMessage() {
private function getIndexMessage()
{
$index = $this->getIndex();
$maxIndexText = $this->getMaxIndexText();
@@ -127,7 +137,8 @@ class AtmoNouvelleAquitaineBridge extends BridgeAbstract {
return "L'indice d'aujourd'hui est $index$maxIndexText.";
}
private function getQualityMessage() {
private function getQualityMessage()
{
$index = $index = $this->getIndex();
$indexes = $this->getLegendIndexes();
$quality = $this->getQualityText($index, $indexes);
@@ -139,7 +150,8 @@ class AtmoNouvelleAquitaineBridge extends BridgeAbstract {
return "La qualité de l'air est $quality.";
}
private function getTomorrowTrendIndexMessage() {
private function getTomorrowTrendIndexMessage()
{
$trendIndex = $this->getTomorrowTrendIndex();
$maxIndexText = $this->getMaxIndexText();
@@ -150,7 +162,8 @@ class AtmoNouvelleAquitaineBridge extends BridgeAbstract {
return "L'indice prévu pour demain est $trendIndex$maxIndexText.";
}
private function getTomorrowTrendQualityMessage() {
private function getTomorrowTrendQualityMessage()
{
$trendIndex = $this->getTomorrowTrendIndex();
$indexes = $this->getLegendIndexes();
$trendQuality = $this->getTomorrowTrendQualityText($trendIndex, $indexes);
@@ -161,7 +174,7 @@ class AtmoNouvelleAquitaineBridge extends BridgeAbstract {
return "La qualite de l'air pour demain sera $trendQuality.";
}
const CITIES = array(
const CITIES = [
'Aast (64460)' => '64001',
'Abère (64160)' => '64002',
'Abidos (64150)' => '64003',
@@ -4633,5 +4646,5 @@ class AtmoNouvelleAquitaineBridge extends BridgeAbstract {
'Yvrac (33370)' => '33554',
'Yvrac-et-Malleyrand (16110)' => '16425',
'Yzosse (40180)' => '40334'
);
];
}

View File

@@ -1,20 +1,22 @@
<?php
class AtmoOccitanieBridge extends BridgeAbstract {
class AtmoOccitanieBridge extends BridgeAbstract
{
const NAME = 'Atmo Occitanie';
const URI = 'https://www.atmo-occitanie.org/';
const DESCRIPTION = 'Fetches the latest air polution of cities in Occitanie from Atmo';
const MAINTAINER = 'floviolleau';
const PARAMETERS = array(array(
'city' => array(
const PARAMETERS = [[
'city' => [
'name' => 'Ville',
'required' => true,
'exampleValue' => 'cahors'
)
));
]
]];
const CACHE_TIMEOUT = 7200;
public function collectData() {
public function collectData()
{
$uri = self::URI . $this->getInput('city');
$html = getSimpleHTMLDOM($uri);

View File

@@ -1,29 +1,31 @@
<?php
class AutoJMBridge extends BridgeAbstract {
class AutoJMBridge extends BridgeAbstract
{
const NAME = 'AutoJM';
const URI = 'https://www.autojm.fr/';
const DESCRIPTION = 'Suivre les offres de véhicules proposés par AutoJM en fonction des critères de filtrages';
const MAINTAINER = 'sysadminstory';
const PARAMETERS = array(
'Afficher les offres de véhicules disponible sur la recheche AutoJM' => array(
'url' => array(
const PARAMETERS = [
'Afficher les offres de véhicules disponible sur la recheche AutoJM' => [
'url' => [
'name' => 'URL de la page de recherche',
'type' => 'text',
'required' => true,
'title' => 'URL d\'une recherche avec filtre de véhicules sans le http://www.autojm.fr/',
'exampleValue' => 'recherche?brands[]=peugeot&ranges[]=peugeot-nouvelle-308-2021-5p'
),
)
);
],
]
];
const CACHE_TIMEOUT = 3600;
public function getIcon() {
public function getIcon()
{
return self::URI . 'favicon.ico';
}
public function getName() {
public function getName()
{
switch ($this->queriedContext) {
case 'Afficher les offres de véhicules disponible sur la recheche AutoJM':
return 'AutoJM | Recherche de véhicules';
@@ -31,18 +33,17 @@ class AutoJMBridge extends BridgeAbstract {
default:
return parent::getName();
}
}
public function collectData() {
public function collectData()
{
// Get the number of result for this search
$search_url = self::URI . $this->getInput('url') . '&open=energy&onlyFilters=false';
// Set the header 'X-Requested-With' like the website does it
$header = array(
$header = [
'X-Requested-With: XMLHttpRequest'
);
];
// Get the JSON content of the form
$json = getContents($search_url, $header);
@@ -61,7 +62,6 @@ class AutoJMBridge extends BridgeAbstract {
// Go through every car of the search
$list = $html->find('div[class*=card-car card-car--listing]');
foreach ($list as $car) {
// Get the info about the car offer
$image = $car->find('div[class=card-car__header__img]', 0)->find('img', 0)->src;
// Decode HTML attribute JSON data
@@ -97,7 +97,7 @@ class AutoJMBridge extends BridgeAbstract {
}
// Construct the new item
$item = array();
$item = [];
$item['title'] = $car_model;
$item['content'] = '<p><img style="vertical-align:middle ; padding: 10px" src="' . $image . '" />'
. $car_model . '</p>';

View File

@@ -1,5 +1,7 @@
<?php
class AwwwardsBridge extends BridgeAbstract {
class AwwwardsBridge extends BridgeAbstract
{
const NAME = 'Awwwards';
const URI = 'https://www.awwwards.com/';
const DESCRIPTION = 'Fetches the latest ten sites of the day from Awwwards';
@@ -10,31 +12,33 @@ class AwwwardsBridge extends BridgeAbstract {
const SITEURI = 'https://www.awwwards.com/sites/';
const ASSETSURI = 'https://assets.awwwards.com/awards/media/cache/thumb_417_299/';
private $sites = array();
private $sites = [];
public function getIcon() {
public function getIcon()
{
return 'https://www.awwwards.com/favicon.ico';
}
private function fetchSites() {
private function fetchSites()
{
Debug::log('Fetching all sites');
$sites = getSimpleHTMLDOM(self::SITESURI);
Debug::log('Parsing all JSON data');
foreach($sites->find('li[data-model]') as $site) {
$decode = html_entity_decode($site->attr['data-model'],
ENT_QUOTES, 'utf-8');
foreach ($sites->find('.grid-sites li') as $site) {
$decode = html_entity_decode($site->attr['data-collectable-model-value'], ENT_QUOTES, 'utf-8');
$decode = json_decode($decode, true);
$this->sites[] = $decode;
}
}
public function collectData() {
public function collectData()
{
$this->fetchSites();
Debug::log('Building RSS feed');
foreach ($this->sites as $site) {
$item = array();
$item = [];
$item['title'] = $site['title'];
$item['timestamp'] = $site['createdAt'];
$item['categories'] = $site['tags'];
@@ -47,8 +51,9 @@ class AwwwardsBridge extends BridgeAbstract {
$this->items[] = $item;
if(count($this->items) >= 10)
if (count($this->items) >= 10) {
break;
}
}
}
}

View File

@@ -1,30 +1,33 @@
<?php
class BAEBridge extends BridgeAbstract {
class BAEBridge extends BridgeAbstract
{
const MAINTAINER = 'couraudt';
const NAME = 'Bourse Aux Equipiers Bridge';
const URI = 'https://www.bourse-aux-equipiers.com';
const DESCRIPTION = 'Returns the newest sailing offers.';
const PARAMETERS = array(
array(
'keyword' => array(
const PARAMETERS = [
[
'keyword' => [
'name' => 'Filtrer par mots clés',
'title' => 'Entrez le mot clé à filtrer ici'
),
'type' => array(
],
'type' => [
'name' => 'Type de recherche',
'title' => 'Afficher seuleument un certain type d\'annonce',
'type' => 'list',
'values' => array(
'values' => [
'Toutes les annonces' => false,
'Les embarquements' => 'boat',
'Les skippers' => 'skipper',
'Les équipiers' => 'crew'
)
)
)
);
]
]
]
];
public function collectData() {
public function collectData()
{
$url = $this->getURI();
$html = getSimpleHTMLDOM($url) or returnClientError('No results for this query.');
@@ -33,20 +36,21 @@ class BAEBridge extends BridgeAbstract {
$detail = $annonce->find('footer a', 0);
$htmlDetail = getSimpleHTMLDOMCached(parent::getURI() . $detail->href);
if (!$htmlDetail)
if (!$htmlDetail) {
continue;
}
$item = array();
$item = [];
$item['title'] = $annonce->find('header h2', 0)->plaintext;
$item['uri'] = parent::getURI() . $detail->href;
$content = $htmlDetail->find('article p', 0)->innertext;
if (!empty($this->getInput('keyword'))) {
$keyword = $this->remove_accents(strtolower($this->getInput('keyword')));
$cleanTitle = $this->remove_accents(strtolower($item['title']));
$keyword = $this->removeAccents(strtolower($this->getInput('keyword')));
$cleanTitle = $this->removeAccents(strtolower($item['title']));
if (strpos($cleanTitle, $keyword) === false) {
$cleanContent = $this->remove_accents(strtolower($content));
$cleanContent = $this->removeAccents(strtolower($content));
if (strpos($cleanContent, $keyword) === false) {
continue;
}
@@ -58,13 +62,14 @@ class BAEBridge extends BridgeAbstract {
$item['content'] = defaultLinkTo($content, parent::getURI());
$image = $htmlDetail->find('#zoom', 0);
if ($image) {
$item['enclosures'] = array(parent::getURI() . $image->getAttribute('src'));
$item['enclosures'] = [parent::getURI() . $image->getAttribute('src')];
}
$this->items[] = $item;
}
}
public function getURI() {
public function getURI()
{
$uri = parent::getURI();
if (!empty($this->getInput('type'))) {
if ($this->getInput('type') == 'boat') {
@@ -79,8 +84,9 @@ class BAEBridge extends BridgeAbstract {
return $uri;
}
private function remove_accents($string) {
$chars = array(
private function removeAccents($string)
{
$chars = [
// Decompositions for Latin-1 Supplement
'ª' => 'a', 'º' => 'o',
'À' => 'A', 'Á' => 'A',
@@ -254,7 +260,7 @@ class BAEBridge extends BridgeAbstract {
'Ǚ' => 'U', 'ǚ' => 'u',
// grave accent
'Ǜ' => 'U', 'ǜ' => 'u',
);
];
$string = strtr($string, $chars);

View File

@@ -1,55 +1,57 @@
<?php
class BadDragonBridge extends BridgeAbstract {
class BadDragonBridge extends BridgeAbstract
{
const NAME = 'Bad Dragon Bridge';
const URI = 'https://bad-dragon.com/';
const CACHE_TIMEOUT = 300; // 5min
const DESCRIPTION = 'Returns sales or new clearance items';
const MAINTAINER = 'Roliga';
const PARAMETERS = array(
'Sales' => array(
),
'Clearance' => array(
'ready_made' => array(
const PARAMETERS = [
'Sales' => [
],
'Clearance' => [
'ready_made' => [
'name' => 'Ready Made',
'type' => 'checkbox'
),
'flop' => array(
],
'flop' => [
'name' => 'Flops',
'type' => 'checkbox'
),
'skus' => array(
],
'skus' => [
'name' => 'Products',
'exampleValue' => 'chanceflared, crackers',
'title' => 'Comma separated list of product SKUs'
),
'onesize' => array(
],
'onesize' => [
'name' => 'One-Size',
'type' => 'checkbox'
),
'mini' => array(
],
'mini' => [
'name' => 'Mini',
'type' => 'checkbox'
),
'small' => array(
],
'small' => [
'name' => 'Small',
'type' => 'checkbox'
),
'medium' => array(
],
'medium' => [
'name' => 'Medium',
'type' => 'checkbox'
),
'large' => array(
],
'large' => [
'name' => 'Large',
'type' => 'checkbox'
),
'extralarge' => array(
],
'extralarge' => [
'name' => 'Extra Large',
'type' => 'checkbox'
),
'category' => array(
],
'category' => [
'name' => 'Category',
'type' => 'list',
'values' => array(
'values' => [
'All' => 'all',
'Accessories' => 'accessories',
'Merchandise' => 'merchandise',
@@ -59,50 +61,50 @@ class BadDragonBridge extends BridgeAbstract {
'Lil\' Squirts' => 'shooter',
'Lil\' Vibes' => 'vibrator',
'Wearables' => 'wearable'
),
],
'defaultValue' => 'all',
),
'soft' => array(
],
'soft' => [
'name' => 'Soft Firmness',
'type' => 'checkbox'
),
'med_firm' => array(
],
'med_firm' => [
'name' => 'Medium Firmness',
'type' => 'checkbox'
),
'firm' => array(
],
'firm' => [
'name' => 'Firm',
'type' => 'checkbox'
),
'split' => array(
],
'split' => [
'name' => 'Split Firmness',
'type' => 'checkbox'
),
'maxprice' => array(
],
'maxprice' => [
'name' => 'Max Price',
'type' => 'number',
'required' => true,
'defaultValue' => 300
),
'minprice' => array(
],
'minprice' => [
'name' => 'Min Price',
'type' => 'number',
'defaultValue' => 0
),
'cumtube' => array(
],
'cumtube' => [
'name' => 'Cumtube',
'type' => 'checkbox'
),
'suctionCup' => array(
],
'suctionCup' => [
'name' => 'Suction Cup',
'type' => 'checkbox'
),
'noAccessories' => array(
],
'noAccessories' => [
'name' => 'No Accessories',
'type' => 'checkbox'
)
)
);
]
]
];
/*
* This sets index $strFrom (or $strTo if set) in $outArr to 'on' if
@@ -122,14 +124,16 @@ class BadDragonBridge extends BridgeAbstract {
* [flop] => on
* )
* */
private function setParam($inArr, &$outArr, $param, $strFrom, $strTo = null) {
private function setParam($inArr, &$outArr, $param, $strFrom, $strTo = null)
{
if (isset($inArr[$param]) && in_array($strFrom, $inArr[$param])) {
$outArr[($strTo ?: $strFrom)] = 'on';
}
}
public function detectParameters($url) {
$params = array();
public function detectParameters($url)
{
$params = [];
// Sale
$regex = '/^(https?:\/\/)?bad-dragon\.com\/sales/';
@@ -146,7 +150,7 @@ class BadDragonBridge extends BridgeAbstract {
$this->setParam($urlParams, $params, 'type', 'flop');
if (isset($urlParams['skus'])) {
$skus = array();
$skus = [];
foreach ($urlParams['skus'] as $sku) {
is_string($sku) && $skus[] = $sku;
is_array($sku) && $skus[] = $sku[0];
@@ -195,7 +199,8 @@ class BadDragonBridge extends BridgeAbstract {
return null;
}
public function getName() {
public function getName()
{
switch ($this->queriedContext) {
case 'Sales':
return 'Bad Dragon Sales';
@@ -206,7 +211,8 @@ class BadDragonBridge extends BridgeAbstract {
}
}
public function getURI() {
public function getURI()
{
switch ($this->queriedContext) {
case 'Sales':
return self::URI . 'sales';
@@ -217,13 +223,14 @@ class BadDragonBridge extends BridgeAbstract {
}
}
public function collectData() {
public function collectData()
{
switch ($this->queriedContext) {
case 'Sales':
$sales = json_decode(getContents(self::URI . 'api/sales'));
foreach ($sales as $sale) {
$item = array();
$item = [];
$item['title'] = $sale->title;
$item['timestamp'] = strtotime($sale->startDate);
@@ -279,7 +286,7 @@ class BadDragonBridge extends BridgeAbstract {
. 'api/inventory-toy/product-list'));
foreach ($toyData->toys as $toy) {
$item = array();
$item = [];
$item['uri'] = $this->getURI()
. '#'
@@ -318,12 +325,12 @@ class BadDragonBridge extends BridgeAbstract {
. ($toy->cumtube ? 'Cumtube' : '')
. ($toy->suction_cup || $toy->cumtube ? '' : 'None');
// firmness
$firmnessTexts = array(
$firmnessTexts = [
'2' => 'Extra soft',
'3' => 'Soft',
'5' => 'Medium',
'8' => 'Firm'
);
];
$firmnesses = explode('/', $toy->firmness);
if (count($firmnesses) === 2) {
$content .= '<br /><b>Firmness:</b> '
@@ -342,13 +349,13 @@ class BadDragonBridge extends BridgeAbstract {
$content .= '</p>';
$item['content'] = $content;
$enclosures = array();
$enclosures = [];
foreach ($toy->images as $image) {
$enclosures[] = $image->fullFilename;
}
$item['enclosures'] = $enclosures;
$categories = array();
$categories = [];
$categories[] = $toy->sku;
$categories[] = $toy->type;
$categories[] = $toy->size;
@@ -366,7 +373,8 @@ class BadDragonBridge extends BridgeAbstract {
}
}
private function inputToURL($api = false) {
private function inputToURL($api = false)
{
$url = self::URI;
$url .= ($api ? 'api/inventory-toys?' : 'shop/clearance?');

View File

@@ -1,90 +1,106 @@
<?php
class BakaUpdatesMangaReleasesBridge extends BridgeAbstract {
class BakaUpdatesMangaReleasesBridge extends BridgeAbstract
{
const NAME = 'Baka Updates Manga Releases';
const URI = 'https://www.mangaupdates.com/';
const DESCRIPTION = 'Get the latest series releases';
const MAINTAINER = 'fulmeek, KamaleiZestri';
const PARAMETERS = array(
'By series' => array(
'series_id' => array(
const PARAMETERS = [
'By series' => [
'series_id' => [
'name' => 'Series ID',
'type' => 'number',
'required' => true,
'exampleValue' => '188066'
)
),
'By list' => array(
'list_id' => array(
]
],
'By list' => [
'list_id' => [
'name' => 'List ID and Type',
'type' => 'text',
'required' => true,
'exampleValue' => '4395&list=read'
)
)
);
]
]
];
const LIMIT_COLS = 5;
const LIMIT_ITEMS = 10;
const RELEASES_URL = 'https://www.mangaupdates.com/releases.html';
private $feedName = '';
public function collectData() {
if($this -> queriedContext == 'By series')
public function collectData()
{
if ($this -> queriedContext == 'By series') {
$this -> collectDataBySeries();
else //queriedContext == 'By list'
} else { //queriedContext == 'By list'
$this -> collectDataByList();
}
}
public function getURI(){
public function getURI()
{
if ($this -> queriedContext == 'By series') {
$series_id = $this->getInput('series_id');
if (!empty($series_id)) {
return self::URI . 'releases.html?search=' . $series_id . '&stype=series';
}
} else //queriedContext == 'By list'
} else { //queriedContext == 'By list'
return self::RELEASES_URL;
}
return self::URI;
}
public function getName(){
public function getName()
{
if (!empty($this->feedName)) {
return $this->feedName . ' - ' . self::NAME;
}
return parent::getName();
}
private function getSanitizedHash($string) {
private function getSanitizedHash($string)
{
return hash('sha1', preg_replace('/[^a-zA-Z0-9\-\.]/', '', ucwords(strtolower($string))));
}
private function filterText($text) {
private function filterText($text)
{
return rtrim($text, '* ');
}
private function filterHTML($text) {
private function filterHTML($text)
{
return $this->filterText(html_entity_decode($text));
}
private function findID($manga) {
private function findID($manga)
{
// sometimes new series are on the release list that have no ID. just drop them.
if (@$this -> filterHTML($manga -> find('a', 0) -> href) != null) {
preg_match('/id=([0-9]*)/', $this -> filterHTML($manga -> find('a', 0) -> href), $match);
return $match[1];
} else
} else {
return 0;
}
}
private function collectDataBySeries() {
private function collectDataBySeries()
{
$html = getSimpleHTMLDOM($this->getURI());
// content is an unstructured pile of divs, ugly to parse
$cols = $html->find('div#main_content div.row > div.text');
if (!$cols)
if (!$cols) {
returnServerError('No releases');
}
$rows = array_slice(
array_chunk($cols, self::LIMIT_COLS), 0, self::LIMIT_ITEMS
array_chunk($cols, self::LIMIT_COLS),
0,
self::LIMIT_ITEMS
);
if (isset($rows[0][1])) {
@@ -92,16 +108,19 @@ class BakaUpdatesMangaReleasesBridge extends BridgeAbstract {
}
foreach ($rows as $cols) {
if (count($cols) < self::LIMIT_COLS) continue;
if (count($cols) < self::LIMIT_COLS) {
continue;
}
$item = array();
$title = array();
$item = [];
$title = [];
$item['content'] = '';
$objDate = $cols[0];
if ($objDate)
if ($objDate) {
$item['timestamp'] = strtotime($objDate->plaintext);
}
$objTitle = $cols[1];
if ($objTitle) {
@@ -110,12 +129,14 @@ class BakaUpdatesMangaReleasesBridge extends BridgeAbstract {
}
$objVolume = $cols[2];
if ($objVolume && !empty($objVolume->plaintext))
if ($objVolume && !empty($objVolume->plaintext)) {
$title[] = 'Vol.' . $objVolume->plaintext;
}
$objChapter = $cols[3];
if ($objChapter && !empty($objChapter->plaintext))
if ($objChapter && !empty($objChapter->plaintext)) {
$title[] = 'Chp.' . $objChapter->plaintext;
}
$objAuthor = $cols[4];
if ($objAuthor && !empty($objAuthor->plaintext)) {
@@ -131,9 +152,10 @@ class BakaUpdatesMangaReleasesBridge extends BridgeAbstract {
}
}
private function collectDataByList() {
private function collectDataByList()
{
$this -> feedName = 'Releases';
$list = array();
$list = [];
$releasesHTML = getSimpleHTMLDOM(self::RELEASES_URL);
@@ -153,10 +175,12 @@ class BakaUpdatesMangaReleasesBridge extends BridgeAbstract {
foreach ($rows as $cols) {
//check if current manga is in user's list.
$id = $this -> findId($cols[0]);
if(!array_search($id, $list)) continue;
if (!array_search($id, $list)) {
continue;
}
$item = array();
$title = array();
$item = [];
$title = [];
$item['content'] = '';
@@ -167,8 +191,9 @@ class BakaUpdatesMangaReleasesBridge extends BridgeAbstract {
}
$objVolChap = $cols[1];
if ($objVolChap && !empty($objVolChap->plaintext))
if ($objVolChap && !empty($objVolChap->plaintext)) {
$title[] = $this -> filterHTML($objVolChap -> innertext);
}
$objAuthor = $cols[2];
if ($objAuthor && !empty($objAuthor->plaintext)) {

View File

@@ -1,120 +1,123 @@
<?php
class BandcampBridge extends BridgeAbstract {
class BandcampBridge extends BridgeAbstract
{
const MAINTAINER = 'sebsauvage, Roliga';
const NAME = 'Bandcamp Bridge';
const URI = 'https://bandcamp.com/';
const CACHE_TIMEOUT = 600; // 10min
const DESCRIPTION = 'New bandcamp releases by tag, band or album';
const PARAMETERS = array(
'By tag' => array(
'tag' => array(
const PARAMETERS = [
'By tag' => [
'tag' => [
'name' => 'tag',
'type' => 'text',
'required' => true,
'exampleValue' => 'hip-hop-rap'
)
),
'By band' => array(
'band' => array(
]
],
'By band' => [
'band' => [
'name' => 'band',
'type' => 'text',
'title' => 'Band name as seen in the band page URL',
'required' => true,
'exampleValue' => 'aesoprock'
),
'type' => array(
],
'type' => [
'name' => 'Articles are',
'type' => 'list',
'values' => array(
'values' => [
'Releases' => 'releases',
'Releases, new one when track list changes' => 'changes',
'Individual tracks' => 'tracks'
),
],
'defaultValue' => 'changes'
),
'limit' => array(
],
'limit' => [
'name' => 'limit',
'type' => 'number',
'required' => true,
'title' => 'Number of releases to return',
'defaultValue' => 5
)
),
'By label' => array(
'label' => array(
]
],
'By label' => [
'label' => [
'name' => 'label',
'type' => 'text',
'title' => 'label name as seen in the label page URL',
'required' => true
),
'type' => array(
],
'type' => [
'name' => 'Articles are',
'type' => 'list',
'values' => array(
'values' => [
'Releases' => 'releases',
'Releases, new one when track list changes' => 'changes',
'Individual tracks' => 'tracks'
),
],
'defaultValue' => 'changes'
),
'limit' => array(
],
'limit' => [
'name' => 'limit',
'type' => 'number',
'title' => 'Number of releases to return',
'defaultValue' => 5
)
),
'By album' => array(
'band' => array(
]
],
'By album' => [
'band' => [
'name' => 'band',
'type' => 'text',
'title' => 'Band name as seen in the album page URL',
'required' => true,
'exampleValue' => 'aesoprock'
),
'album' => array(
],
'album' => [
'name' => 'album',
'type' => 'text',
'title' => 'Album name as seen in the album page URL',
'required' => true,
'exampleValue' => 'appleseed'
),
'type' => array(
],
'type' => [
'name' => 'Articles are',
'type' => 'list',
'values' => array(
'values' => [
'Releases' => 'releases',
'Releases, new one when track list changes' => 'changes',
'Individual tracks' => 'tracks'
),
],
'defaultValue' => 'tracks'
)
)
);
]
]
];
const IMGURI = 'https://f4.bcbits.com/';
const IMGSIZE_300PX = 23;
const IMGSIZE_700PX = 16;
private $feedName;
public function getIcon() {
public function getIcon()
{
return 'https://s4.bcbits.com/img/bc_favicon.ico';
}
public function collectData(){
public function collectData()
{
switch ($this->queriedContext) {
case 'By tag':
$url = self::URI . 'api/hub/1/dig_deeper';
$data = $this->buildRequestJson();
$header = array(
$header = [
'Content-Type: application/json',
'Content-Length: ' . strlen($data)
);
$opts = array(
];
$opts = [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => $data
);
];
$content = getContents($url, $header, $opts);
$json = json_decode($content);
@@ -139,13 +142,13 @@ class BandcampBridge extends BridgeAbstract {
$small_img = $this->getImageUrl($entry->art_id, self::IMGSIZE_300PX);
$img = $this->getImageUrl($entry->art_id, self::IMGSIZE_700PX);
$item = array(
$item = [
'uri' => $url,
'author' => $full_artist,
'title' => $full_title
);
];
$item['content'] = "<img src='$small_img' /><br/>$full_title";
$item['enclosures'] = array($img);
$item['enclosures'] = [$img];
$this->items[] = $item;
}
break;
@@ -161,17 +164,18 @@ class BandcampBridge extends BridgeAbstract {
}
$regex = '/band_id=(\d+)/';
if(preg_match($regex, $html, $matches) == false)
if (preg_match($regex, $html, $matches) == false) {
returnServerError('Unable to find band ID on: ' . $this->getURI());
}
$band_id = $matches[1];
$tralbums = array();
$tralbums = [];
switch ($this->queriedContext) {
case 'By band':
case 'By label':
$query_data = array(
$query_data = [
'band_id' => $band_id
);
];
$band_data = $this->apiGet('mobile/22/band_details', $query_data);
$num_albums = min(count($band_data->discography), $this->getInput('limit'));
@@ -181,25 +185,26 @@ class BandcampBridge extends BridgeAbstract {
// 'a' or 't' for albums and individual tracks respectively
$tralbum_type = substr($album_basic_data->item_type, 0, 1);
$query_data = array(
$query_data = [
'band_id' => $band_id,
'tralbum_type' => $tralbum_type,
'tralbum_id' => $album_basic_data->item_id
);
];
$tralbums[] = $this->apiGet('mobile/22/tralbum_details', $query_data);
}
break;
case 'By album':
$regex = '/album=(\d+)/';
if(preg_match($regex, $html, $matches) == false)
if (preg_match($regex, $html, $matches) == false) {
returnServerError('Unable to find album ID on: ' . $this->getURI());
}
$album_id = $matches[1];
$query_data = array(
$query_data = [
'band_id' => $band_id,
'tralbum_type' => 'a',
'tralbum_id' => $album_id
);
];
$tralbums[] = $this->apiGet('mobile/22/tralbum_details', $query_data);
break;
@@ -208,11 +213,11 @@ class BandcampBridge extends BridgeAbstract {
foreach ($tralbums as $tralbum_data) {
if ($tralbum_data->type === 'a' && $this->getInput('type') === 'tracks') {
foreach ($tralbum_data->tracks as $track) {
$query_data = array(
$query_data = [
'band_id' => $band_id,
'tralbum_type' => 't',
'tralbum_id' => $track->track_id
);
];
$track_data = $this->apiGet('mobile/22/tralbum_details', $query_data);
$this->items[] = $this->buildTralbumItem($track_data);
@@ -225,7 +230,8 @@ class BandcampBridge extends BridgeAbstract {
}
}
private function buildTralbumItem($tralbum_data){
private function buildTralbumItem($tralbum_data)
{
$band_data = $tralbum_data->band;
// Format title like: ARTIST - ALBUM/TRACK (OPTIONAL RELEASER)
@@ -250,15 +256,15 @@ class BandcampBridge extends BridgeAbstract {
$small_img = $this->getImageUrl($tralbum_data->art_id, self::IMGSIZE_300PX);
$img = $this->getImageUrl($tralbum_data->art_id, self::IMGSIZE_700PX);
$item = array(
$item = [
'uri' => $tralbum_data->bandcamp_url,
'author' => $full_artist,
'title' => $full_title,
'enclosures' => array($img),
'enclosures' => [$img],
'timestamp' => $tralbum_data->release_date
);
];
$item['categories'] = array();
$item['categories'] = [];
foreach ($tralbum_data->tags as $tag) {
$item['categories'][] = $tag->norm_name;
}
@@ -289,26 +295,31 @@ class BandcampBridge extends BridgeAbstract {
return $item;
}
private function buildRequestJson(){
$requestJson = array(
private function buildRequestJson()
{
$requestJson = [
'tag' => $this->getInput('tag'),
'page' => 1,
'sort' => 'date'
);
];
return json_encode($requestJson);
}
private function getImageUrl($id, $size){
private function getImageUrl($id, $size)
{
return self::IMGURI . 'img/a' . $id . '_' . $size . '.jpg';
}
private function apiGet($endpoint, $query_data) {
private function apiGet($endpoint, $query_data)
{
$url = self::URI . 'api/' . $endpoint . '?' . http_build_query($query_data);
// todo: 429 Too Many Requests happens a lot
$data = json_decode(getContents($url));
return $data;
}
public function getURI(){
public function getURI()
{
switch ($this->queriedContext) {
case 'By tag':
if (!is_null($this->getInput('tag'))) {
@@ -345,7 +356,8 @@ class BandcampBridge extends BridgeAbstract {
return parent::getURI();
}
public function getName(){
public function getName()
{
switch ($this->queriedContext) {
case 'By tag':
if (!is_null($this->getInput('tag'))) {
@@ -378,8 +390,9 @@ class BandcampBridge extends BridgeAbstract {
return parent::getName();
}
public function detectParameters($url) {
$params = array();
public function detectParameters($url)
{
$params = [];
// By tag
$regex = '/^(https?:\/\/)?bandcamp\.com\/tag\/([^\/.&?\n]+)/';

View File

@@ -1,16 +1,18 @@
<?php
class BandcampDailyBridge extends BridgeAbstract {
class BandcampDailyBridge extends BridgeAbstract
{
const NAME = 'Bandcamp Daily Bridge';
const URI = 'https://daily.bandcamp.com';
const DESCRIPTION = 'Returns newest articles';
const MAINTAINER = 'VerifiedJoseph';
const PARAMETERS = array(
'Latest articles' => array(),
'Best of' => array(
'best-content' => array(
const PARAMETERS = [
'Latest articles' => [],
'Best of' => [
'best-content' => [
'name' => 'content',
'type' => 'list',
'values' => array(
'values' => [
'Best Ambient' => 'best-ambient',
'Best Beat Tapes' => 'best-beat-tapes',
'Best Dance 12\'s' => 'best-dance-12s',
@@ -23,15 +25,15 @@ class BandcampDailyBridge extends BridgeAbstract {
'Best Punk' => 'best-punk',
'Best Reissues' => 'best-reissues',
'Best Soul' => 'best-soul',
),
],
'defaultValue' => 'best-ambient',
),
),
'Genres' => array(
'genres-content' => array(
],
],
'Genres' => [
'genres-content' => [
'name' => 'content',
'type' => 'list',
'values' => array(
'values' => [
'Acoustic' => 'genres/acoustic',
'Alternative' => 'genres/alternative',
'Ambient' => 'genres/ambient',
@@ -57,15 +59,15 @@ class BandcampDailyBridge extends BridgeAbstract {
'Soundtrack' => 'genres/soundtrack',
'Spoken Word' => 'genres/spoken-word',
'World' => 'genres/world',
),
],
'defaultValue' => 'genres/acoustic',
),
),
'Franchises' => array(
'franchises-content' => array(
],
],
'Franchises' => [
'franchises-content' => [
'name' => 'content',
'type' => 'list',
'values' => array(
'values' => [
'Lists' => 'lists',
'Features' => 'features',
'Album of the Day' => 'album-of-the-day',
@@ -81,15 +83,16 @@ class BandcampDailyBridge extends BridgeAbstract {
'Scene Report' => 'scene-report',
'Seven Essential Releases' => 'seven-essential-releases',
'The Merch Table' => 'the-merch-table',
),
],
'defaultValue' => 'lists',
),
)
);
],
]
];
const CACHE_TIMEOUT = 3600; // 1 hour
public function collectData() {
public function collectData()
{
$html = getSimpleHTMLDOM($this->getURI())
or returnServerError('Could not request: ' . $this->getURI());
@@ -98,7 +101,7 @@ class BandcampDailyBridge extends BridgeAbstract {
$articles = $html->find('articles-list', 0);
foreach ($articles->find('div.list-article') as $index => $article) {
$item = array();
$item = [];
$articlePath = $article->find('a.title', 0)->href;
@@ -126,7 +129,8 @@ class BandcampDailyBridge extends BridgeAbstract {
}
}
public function getURI() {
public function getURI()
{
switch ($this->queriedContext) {
case 'Latest articles':
return self::URI . '/latest';
@@ -141,15 +145,15 @@ class BandcampDailyBridge extends BridgeAbstract {
}
}
public function getName() {
public function getName()
{
switch ($this->queriedContext) {
case 'Latest articles':
return $this->queriedContext . ' - Bandcamp Daily';
case 'Best of':
case 'Genres':
case 'Franchises':
// TODO Switch to array_key_first once php >= 7.3
$contentKey = key(self::PARAMETERS[$this->queriedContext]);
$contentKey = array_key_first(self::PARAMETERS[$this->queriedContext]);
$contentValues = array_flip(self::PARAMETERS[$this->queriedContext][$contentKey]['values']);
return $contentValues[$this->getInput($contentKey)] . ' - Bandcamp Daily';

View File

@@ -1,20 +1,22 @@
<?php
class BastaBridge extends BridgeAbstract {
class BastaBridge extends BridgeAbstract
{
const MAINTAINER = 'qwertygc';
const NAME = 'Bastamag Bridge';
const URI = 'https://www.bastamag.net/';
const CACHE_TIMEOUT = 7200; // 2h
const DESCRIPTION = 'Returns the newest articles.';
public function collectData(){
public function collectData()
{
$html = getSimpleHTMLDOM(self::URI . 'spip.php?page=backend');
$limit = 0;
foreach ($html->find('item') as $element) {
if ($limit < 10) {
$item = array();
$item = [];
$item['title'] = $element->find('title', 0)->innertext;
$item['uri'] = $element->find('guid', 0)->plaintext;
$item['timestamp'] = strtotime($element->find('dc:date', 0)->plaintext);

View File

@@ -1,41 +1,55 @@
<?php
class BinanceBridge extends BridgeAbstract {
class BinanceBridge extends BridgeAbstract
{
const NAME = 'Binance Blog';
const URI = 'https://www.binance.com/en/blog';
const DESCRIPTION = 'Subscribe to the Binance blog.';
const MAINTAINER = 'thefranke';
const CACHE_TIMEOUT = 3600; // 1h
public function getIcon() {
public function getIcon()
{
return 'https://bin.bnbstatic.com/static/images/common/favicon.ico';
}
public function collectData() {
public function collectData()
{
$html = getSimpleHTMLDOM(self::URI)
or returnServerError('Could not fetch Binance blog data.');
$appData = $html->find('script[id="__APP_DATA"]');
$appDataJson = json_decode($appData[0]->innertext);
$allposts = $appDataJson->routeProps->f3ac->blogListRes->list;
foreach($appDataJson->pageData->redux->blogList->blogList as $element) {
$date = $element->postTime;
$abstract = $element->brief;
$uri = self::URI . '/' . $element->lang . '/blog/' . $element->idStr;
foreach ($allposts as $element) {
$date = $element->releasedTime;
$title = $element->title;
$content = $element->content;
$category = $element->category->name;
$item = array();
$suburl = strtolower($category);
$suburl = str_replace(' ', '_', $suburl);
$uri = self::URI . '/' . $suburl . '/' . $element->idStr;
$contentHTML = getSimpleHTMLDOMCached($uri);
$contentAppData = $contentHTML->find('script[id="__APP_DATA"]');
$contentAppDataJson = json_decode($contentAppData[0]->innertext);
$content = $contentAppDataJson->routeProps->a106->blogDetail->content;
$item = [];
$item['title'] = $title;
$item['uri'] = $uri;
$item['timestamp'] = substr($date, 0, -3);
$item['author'] = 'Binance';
$item['content'] = $content;
$item['categories'] = $category;
$this->items[] = $item;
if (count($this->items) >= 10)
if (count($this->items) >= 10) {
break;
}
}
}
}

View File

@@ -1,23 +1,24 @@
<?php
class BlaguesDeMerdeBridge extends BridgeAbstract {
class BlaguesDeMerdeBridge extends BridgeAbstract
{
const MAINTAINER = 'superbaillot.net, logmanoriginal';
const NAME = 'Blagues De Merde';
const URI = 'http://www.blaguesdemerde.fr/';
const CACHE_TIMEOUT = 7200; // 2h
const DESCRIPTION = 'Blagues De Merde';
public function getIcon() {
public function getIcon()
{
return self::URI . 'assets/img/favicon.ico';
}
public function collectData(){
public function collectData()
{
$html = getSimpleHTMLDOM(self::URI);
foreach ($html->find('div.blague') as $element) {
$item = array();
$item = [];
$item['uri'] = static::URI . '#' . $element->id;
$item['author'] = $element->find('div[class="blague-footer"] p strong', 0)->plaintext;
@@ -38,8 +39,6 @@ class BlaguesDeMerdeBridge extends BridgeAbstract {
$item['timestamp'] = strtotime($matches[1]);
$this->items[] = $item;
}
}
}
}

View File

@@ -1,12 +1,14 @@
<?php
class BleepingComputerBridge extends FeedExpander {
class BleepingComputerBridge extends FeedExpander
{
const MAINTAINER = 'csisoap';
const NAME = 'Bleeping Computer';
const URI = 'https://www.bleepingcomputer.com/';
const DESCRIPTION = 'Returns the newest articles.';
protected function parseItem($item){
protected function parseItem($item)
{
$item = parent::parseItem($item);
$article_html = getSimpleHTMLDOMCached($item['uri']);
@@ -22,7 +24,8 @@ class BleepingComputerBridge extends FeedExpander {
return $item;
}
public function collectData(){
public function collectData()
{
$feed = static::URI . 'feed/';
$this->collectExpandableDatas($feed);
}

View File

@@ -1,17 +1,17 @@
<?php
class BlizzardNewsBridge extends XPathAbstract {
class BlizzardNewsBridge extends XPathAbstract
{
const NAME = 'Blizzard News';
const URI = 'https://news.blizzard.com';
const DESCRIPTION = 'Blizzard (game company) newsfeed';
const MAINTAINER = 'Niehztog';
const PARAMETERS = array(
'' => array(
'locale' => array(
const PARAMETERS = [
'' => [
'locale' => [
'name' => 'Language',
'type' => 'list',
'values' => array(
'values' => [
'Deutsch' => 'de-de',
'English (EU)' => 'en-gb',
'English (US)' => 'en-us',
@@ -27,12 +27,12 @@ class BlizzardNewsBridge extends XPathAbstract {
'ภาษาไทย' => 'th-th',
'简体中文' => 'zh-cn',
'繁體中文' => 'zh-tw'
),
],
'defaultValue' => 'en-us',
'title' => 'Select your language'
)
)
);
]
]
];
const CACHE_TIMEOUT = 3600;
const XPATH_EXPRESSION_ITEM = '/html/body/div/div[4]/div[2]/div[2]/div/div/section/ol/li/article';
@@ -49,8 +49,8 @@ class BlizzardNewsBridge extends XPathAbstract {
* Source Web page URL (should provide either HTML or XML content)
* @return string
*/
protected function getSourceUrl(){
protected function getSourceUrl()
{
$locale = $this->getInput('locale');
if ('zh-cn' === $locale) {
return 'https://cn.news.blizzard.com';

View File

@@ -1,6 +1,7 @@
<?php
class BookMyShowBridge extends BridgeAbstract {
class BookMyShowBridge extends BridgeAbstract
{
const MAINTAINER = 'captn3m0';
const NAME = 'BookMyShow Bridge';
const URI = 'https://in.bookmyshow.com';
@@ -1091,7 +1092,8 @@ class BookMyShowBridge extends BridgeAbstract {
// The city information is passed via a cookie
const URL_PREFIX = 'https://in.bookmyshow.com/serv/getData?cmd=QUICKBOOK&type=';
public function collectData(){
public function collectData()
{
$city = $this->getInput('city');
$category = $this->getInput('category');
@@ -1120,11 +1122,13 @@ class BookMyShowBridge extends BridgeAbstract {
$this->items = array_slice($this->items, 0, 15);
}
private function makeUrl($category){
private function makeUrl($category)
{
return self::URL_PREFIX . $category;
}
private function getDatesHtml($dates){
private function getDatesHtml($dates)
{
$tz = new DateTimeZone(self::TIMEZONE);
$firstDate = DateTime::createFromFormat('Ymd', $dates[0]['ShowDateCode'], $tz)
->format('D, d M Y');
@@ -1142,7 +1146,8 @@ class BookMyShowBridge extends BridgeAbstract {
* @param array $event
* @see https://gist.github.com/captn3m0/6dbd539ca67579d22d6f90fab710ccd2 Sample JSON data for various events
*/
private function generateEventHtml($event, $category){
private function generateEventHtml($event, $category)
{
$html = $this->getDatesHtml($event['arrDates']);
switch ($category) {
case self::MOVIES:
@@ -1160,7 +1165,8 @@ class BookMyShowBridge extends BridgeAbstract {
* Generates a simple Venue HTML, even for multiple venues
* spread across multiple dates as a description list.
*/
private function generateVenueHtml($venues){
private function generateVenueHtml($venues)
{
$html = '<h3>Venues</h3><table><thead><tr><th>Venue</th><th>Directions</th></tr></thead><tbody>';
foreach ($venues as $i => $venueData) {
@@ -1180,7 +1186,8 @@ class BookMyShowBridge extends BridgeAbstract {
* Generates a simple Table with event Data
* @todo Add support for jsonGenre as a tags row
*/
private function generateEventDetailsTable($event, $headers = self::TABLE_HEADERS){
private function generateEventDetailsTable($event, $headers = self::TABLE_HEADERS)
{
$table = '';
foreach ($headers as $key => $header) {
if ($header == 'Language') {
@@ -1206,7 +1213,8 @@ EOT;
return "<table>$table</table>";
}
private function generateStandardHtml($event){
private function generateStandardHtml($event)
{
$table = $this->generateEventDetailsTable($event);
$imgsrc = $event['BannerURL'];
@@ -1224,7 +1232,8 @@ EOT;
* Converts some movie details from child entries, such as language
* into a single row item, either as a list, or as a Y/N
*/
private function generateInnerMovieDetails($data){
private function generateInnerMovieDetails($data)
{
// Show list of languages and list of formats
$headers = ['EventLanguage', 'EventDimension'];
// if any of these has a Y for any of the screenings, mark it as YES
@@ -1270,7 +1279,8 @@ EOT;
return $html;
}
private function generateMovieHtml($eventGroup){
private function generateMovieHtml($eventGroup)
{
$data = $eventGroup['ChildEvents'][0];
$table = $this->generateEventDetailsTable($data, self::MOVIE_TABLE_HEADERS);
@@ -1290,17 +1300,18 @@ EOT;
More Details are available on the <a href="$url">BookMyShow website</a> and a trailer is available
<a href="${data['EventTrailerURL']}" title="Trailer URL">here</a>
EOT;
}
/**
* Generates a canonical movie URL
*/
private function generateMovieUrl($eventGroup){
private function generateMovieUrl($eventGroup)
{
return self::URI . '/movies/' . $eventGroup['EventURLTitle'] . '/' . $eventGroup['EventCode'];
}
private function generateMoviesData($eventGroup){
private function generateMoviesData($eventGroup)
{
// Additional data picked up from the first Child Event
$data = $eventGroup['ChildEvents'][0];
$date = new DateTime($data['EventDate']);
@@ -1323,7 +1334,8 @@ EOT;
];
}
private function generateEventData($event, $category){
private function generateEventData($event, $category)
{
if ($category == self::MOVIES) {
return $this->generateMoviesData($event);
}
@@ -1334,7 +1346,8 @@ EOT;
/**
* Takes an event data as array and returns data for RSS Post
*/
private function generateGenericEventData($event, $category){
private function generateGenericEventData($event, $category)
{
$datetime = $event['Event_dtmCreated'];
if (empty($datetime)) {
return null;
@@ -1362,7 +1375,8 @@ EOT;
* Check if this is an online event. We can't rely on
* EventIsWebView, since that is set to Y for everything
*/
private function isEventOnline($event){
private function isEventOnline($event)
{
if (isset($event['arrVenues']) && count($event['arrVenues']) === 1) {
if (preg_match('/(Online|Zoom)/i', $event['arrVenues'][0]['VenueName'])) {
return true;
@@ -1372,7 +1386,8 @@ EOT;
return false;
}
private function matchesLanguage(){
private function matchesLanguage()
{
if ($this->getInput('language') !== 'all') {
$language = $this->getInput('language');
return in_array($language, $this->languages);
@@ -1380,7 +1395,8 @@ EOT;
return true;
}
private function matchesOnline($event){
private function matchesOnline($event)
{
if ($this->getInput('include_online')) {
return true;
}
@@ -1390,14 +1406,16 @@ EOT;
/**
* Currently only checks if the language filter matches
*/
private function matchesFilters($category, $event){
private function matchesFilters($category, $event)
{
return $this->matchesLanguage() and $this->matchesOnline($event);
}
/**
* Generates the RSS Feed title
*/
public function getName(){
public function getName()
{
$city = $this->getInput('city');
$category = $this->getInput('category');
if (!is_null($city) and !is_null($category)) {
@@ -1420,7 +1438,8 @@ EOT;
* @param string $city City Code
* @return array list of headers
*/
private function makeHeaders($city){
private function makeHeaders($city)
{
$uniqid = uniqid();
$rgn = urlencode("|Code=$city|");
return [
@@ -1432,7 +1451,8 @@ EOT;
* Generates various URLs as per https://tools.ietf.org/html/rfc5870
* and other standards
*/
private function generateDirectionsHtml($lat, $long, $address = ''){
private function generateDirectionsHtml($lat, $long, $address = '')
{
$address = urlencode($address);
$links = [

View File

@@ -1,59 +1,64 @@
<?php
class BooruprojectBridge extends DanbooruBridge {
class BooruprojectBridge extends DanbooruBridge
{
const MAINTAINER = 'mitsukarenai';
const NAME = 'Booruproject';
const URI = 'https://booru.org/';
const DESCRIPTION = 'Returns images from given page of booruproject';
const PARAMETERS = array(
'global' => array(
'p' => array(
const PARAMETERS = [
'global' => [
'p' => [
'name' => 'page',
'defaultValue' => 0,
'type' => 'number'
),
't' => array(
],
't' => [
'name' => 'tags',
'required' => true,
'exampleValue' => 'tagme',
'title' => 'Use "all" to get all posts'
)
),
'Booru subdomain (subdomain.booru.org)' => array(
'i' => array(
]
],
'Booru subdomain (subdomain.booru.org)' => [
'i' => [
'name' => 'Subdomain',
'required' => true,
'exampleValue' => 'rm'
)
)
);
]
]
];
const PATHTODATA = '.thumb';
const IDATTRIBUTE = 'id';
const TAGATTRIBUTE = 'title';
const PIDBYPAGE = 20;
protected function getFullURI(){
protected function getFullURI()
{
return $this->getURI()
. 'index.php?page=post&s=list&pid='
. ($this->getInput('p') ? ($this->getInput('p') - 1) * static::PIDBYPAGE : '')
. '&tags=' . urlencode($this->getInput('t'));
}
protected function getTags($element){
protected function getTags($element)
{
$tags = parent::getTags($element);
$tags = explode(' ', $tags);
// Remove statistics from the tags list (identified by colon)
foreach ($tags as $key => $tag) {
if(strpos($tag, ':') !== false) unset($tags[$key]);
if (strpos($tag, ':') !== false) {
unset($tags[$key]);
}
}
return implode(' ', $tags);
}
public function getURI(){
public function getURI()
{
if (!is_null($this->getInput('i'))) {
return 'https://' . $this->getInput('i') . '.booru.org/';
}
@@ -61,7 +66,8 @@ class BooruprojectBridge extends DanbooruBridge {
return parent::getURI();
}
public function getName(){
public function getName()
{
if (!is_null($this->getInput('i'))) {
return static::NAME . ' ' . $this->getInput('i');
}

View File

@@ -1,14 +1,16 @@
<?php
class BrutBridge extends BridgeAbstract {
class BrutBridge extends BridgeAbstract
{
const NAME = 'Brut Bridge';
const URI = 'https://www.brut.media';
const DESCRIPTION = 'Returns 10 newest videos by category and edition';
const MAINTAINER = 'VerifiedJoseph';
const PARAMETERS = array(array(
'category' => array(
const PARAMETERS = [[
'category' => [
'name' => 'Category',
'type' => 'list',
'values' => array(
'values' => [
'News' => 'news',
'International' => 'international',
'Economy' => 'economy',
@@ -17,37 +19,37 @@ class BrutBridge extends BridgeAbstract {
'Sports' => 'sport',
'Nature' => 'nature',
'Health' => 'health',
),
],
'defaultValue' => 'news',
),
'edition' => array(
],
'edition' => [
'name' => ' Edition',
'type' => 'list',
'values' => array(
'values' => [
'United States' => 'us',
'United Kingdom' => 'uk',
'France' => 'fr',
'Spain' => 'es',
'India' => 'in',
'Mexico' => 'mx',
),
],
'defaultValue' => 'us',
)
)
);
]
]
];
const CACHE_TIMEOUT = 1800; // 30 mins
private $jsonRegex = '/window\.__PRELOADED_STATE__ = ((?:.*)});/';
public function collectData() {
public function collectData()
{
$html = getSimpleHTMLDOM($this->getURI());
$results = $html->find('div.results', 0);
foreach ($results->find('li.col-6.col-sm-4.col-md-3.col-lg-2.px-2.pb-4') as $li) {
$item = array();
$item = [];
$videoPath = self::URI . $li->children(0)->href;
$videoPageHtml = getSimpleHTMLDOMCached($videoPath, 3600);
@@ -83,8 +85,8 @@ EOD;
}
}
public function getURI() {
public function getURI()
{
if (!is_null($this->getInput('edition')) && !is_null($this->getInput('category'))) {
return self::URI . '/' . $this->getInput('edition') . '/' . $this->getInput('category');
}
@@ -92,16 +94,11 @@ EOD;
return parent::getURI();
}
public function getName() {
public function getName()
{
if (!is_null($this->getInput('edition')) && !is_null($this->getInput('category'))) {
$parameters = $this->getParameters();
$editionValues = array_flip($parameters[0]['edition']['values']);
$categoryValues = array_flip($parameters[0]['category']['values']);
return $categoryValues[$this->getInput('category')] . ' - ' .
$editionValues[$this->getInput('edition')] . ' - Brut.';
return $this->getKey('category') . ' - ' .
$this->getKey('edition') . ' - Brut.';
}
return parent::getName();
@@ -110,8 +107,8 @@ EOD;
/**
* Extract JSON from page
*/
private function extractJson($html) {
private function extractJson($html)
{
if (!preg_match($this->jsonRegex, $html, $parts)) {
returnServerError('Failed to extract data from page');
}

198
bridges/BugzillaBridge.php Normal file
View File

@@ -0,0 +1,198 @@
<?php
class BugzillaBridge extends BridgeAbstract
{
const NAME = 'Bugzilla Bridge';
const URI = 'https://www.bugzilla.org/';
const DESCRIPTION = 'Bridge for any Bugzilla instance';
const MAINTAINER = 'Yaman Qalieh';
const PARAMETERS = [
'global' => [
'instance' => [
'name' => 'Instance URL',
'required' => true,
'exampleValue' => 'https://bugzilla.mozilla.org'
]
],
'Bug comments' => [
'id' => [
'name' => 'Bug tracking ID',
'type' => 'number',
'required' => true,
'title' => 'Insert bug tracking ID',
'exampleValue' => 121241
],
'limit' => [
'name' => 'Number of comments to return',
'type' => 'number',
'required' => false,
'title' => 'Specify number of comments to return',
'defaultValue' => -1
],
'skiptags' => [
'name' => 'Skip offtopic comments',
'type' => 'checkbox',
'title' => 'Excludes comments tagged as advocacy, metoo, or offtopic from the feed'
]
]
];
const SKIPPED_ACTIVITY = [
'cc' => true,
'comment_tag' => true
];
const SKIPPED_TAGS = ['advocacy', 'metoo', 'offtopic'];
private $instance;
private $bugid;
private $buguri;
private $title;
public function getName()
{
if (!is_null($this->title)) {
return $this->title;
}
return parent::getName();
}
public function getURI()
{
return $this->buguri ?? parent::getURI();
}
public function collectData()
{
$this->instance = rtrim($this->getInput('instance'), '/');
$this->bugid = $this->getInput('id');
$this->buguri = $this->instance . '/show_bug.cgi?id=' . $this->bugid;
$url = $this->instance . '/rest/bug/' . $this->bugid;
$this->getTitle($url);
$this->collectComments($url . '/comment');
$this->collectUpdates($url . '/history');
usort($this->items, function ($a, $b) {
return $b['timestamp'] <=> $a['timestamp'];
});
if ($this->getInput('limit') > 0) {
$this->items = array_slice($this->items, 0, $this->getInput('limit'));
}
}
protected function getTitle($url)
{
// Only request the summary for a faster request
$json = self::getJSON($url . '?include_fields=summary');
$this->title = 'Bug ' . $this->bugid . ' - ' .
$json['bugs'][0]['summary'] . ' - ' .
// Remove https://
substr($this->instance, 8);
}
protected function collectComments($url)
{
$json = self::getJSON($url);
// Array of comments is here
if (!isset($json['bugs'][$this->bugid]['comments'])) {
returnClientError('Cannot find REST endpoint');
}
foreach ($json['bugs'][$this->bugid]['comments'] as $comment) {
$item = [];
if (
$this->getInput('skiptags') and
array_intersect(self::SKIPPED_TAGS, $comment['tags'])
) {
continue;
}
$item['categories'] = $comment['tags'];
$item['uri'] = $this->buguri . '#c' . $comment['count'];
$item['title'] = 'Comment ' . $comment['count'];
$item['timestamp'] = $comment['creation_time'];
$item['author'] = $this->getUser($comment['creator']);
$item['content'] = $comment['text'];
if (isset($comment['is_markdown']) and $comment['is_markdown']) {
$item['content'] = markdownToHtml($item['content']);
}
if (!is_null($comment['attachment_id'])) {
$item['enclosures'] = [$this->instance . '/attachment.cgi?id=' . $comment['attachment_id']];
}
$this->items[] = $item;
}
}
protected function collectUpdates($url)
{
$json = self::getJSON($url);
// Array of changesets which contain an array of changes
if (!isset($json['bugs']['0']['history'])) {
returnClientError('Cannot find REST endpoint');
}
foreach ($json['bugs']['0']['history'] as $changeset) {
$author = $this->getUser($changeset['who']);
$timestamp = $changeset['when'];
foreach ($changeset['changes'] as $change) {
// Skip updates to the cc list and comment tagging
if (isset(self::SKIPPED_ACTIVITY[$change['field_name']])) {
continue;
}
$item = [];
$item['uri'] = $this->buguri;
$item['title'] = 'Updated';
$item['timestamp'] = $timestamp;
$item['author'] = $author;
$item['content'] = ucfirst($change['field_name']) . ': ' .
($change['removed'] === '' ? '[nothing]' : $change['removed']) . ' -> ' .
($change['added'] === '' ? '[nothing]' : $change['added']);
$this->items[] = $item;
}
}
}
protected function getUser($user)
{
// Check if the user endpoint is available
if ($this->loadCacheValue($this->instance . 'userEndpointClosed', 86400)) {
return $user;
}
$cache = $this->loadCacheValue($this->instance . $user);
if (!is_null($cache)) {
return $cache;
}
$url = $this->instance . '/rest/user/' . $user . '?include_fields=real_name';
try {
$json = self::getJSON($url);
if (isset($json['error']) and $json['error']) {
throw new Exception();
}
} catch (Exception $e) {
$this->saveCacheValue($this->instance . 'userEndpointClosed', true);
return $user;
}
$username = $json['users']['0']['real_name'];
if (empty($username)) {
$username = $user;
}
$this->saveCacheValue($this->instance . $user, $username);
return $username;
}
protected static function getJSON($url)
{
$headers = [
'Accept: application/json',
];
return json_decode(getContents($url, $headers), true);
}
}

View File

@@ -6,13 +6,13 @@ class BukowskisBridge extends BridgeAbstract
const URI = 'https://www.bukowskis.com';
const DESCRIPTION = 'Fetches info about auction objects from Bukowskis auction house';
const MAINTAINER = 'Qluxzz';
const PARAMETERS = array(array(
'category' => array(
const PARAMETERS = [[
'category' => [
'name' => 'Category',
'type' => 'list',
'values' => array(
'values' => [
'All categories' => '',
'Art' => array(
'Art' => [
'All' => 'art',
'Classic Art' => 'art.classic-art',
'Classic Finnish Art' => 'art.classic-finnish-art',
@@ -27,31 +27,31 @@ class BukowskisBridge extends BridgeAbstract
'Prints' => 'art.prints',
'Sculpture' => 'art.sculpture',
'Swedish Old Masters' => 'art.swedish-old-masters',
),
'Asian Ceramics & Works of Art' => array(
],
'Asian Ceramics & Works of Art' => [
'All' => 'asian-ceramics-works-of-art',
'Other' => 'asian-ceramics-works-of-art.other',
'Porcelain' => 'asian-ceramics-works-of-art.porcelain',
),
'Books & Manuscripts' => array(
],
'Books & Manuscripts' => [
'All' => 'books-manuscripts',
'Books' => 'books-manuscripts.books',
),
'Carpets, rugs & textiles' => array(
],
'Carpets, rugs & textiles' => [
'All' => 'carpets-rugs-textiles',
'European' => 'carpets-rugs-textiles.european',
'Oriental' => 'carpets-rugs-textiles.oriental',
'Rest of the world' => 'carpets-rugs-textiles.rest-of-the-world',
'Scandinavian' => 'carpets-rugs-textiles.scandinavian',
),
'Ceramics & porcelain' => array(
],
'Ceramics & porcelain' => [
'All' => 'ceramics-porcelain',
'Ceramic ware' => 'ceramics-porcelain.ceramic-ware',
'European' => 'ceramics-porcelain.european',
'Rest of the world' => 'ceramics-porcelain.rest-of-the-world',
'Scandinavian' => 'ceramics-porcelain.scandinavian',
),
'Collectibles' => array(
],
'Collectibles' => [
'All' => 'collectibles',
'Advertising & Retail' => 'collectibles.advertising-retail',
'Memorabilia' => 'collectibles.memorabilia',
@@ -60,18 +60,18 @@ class BukowskisBridge extends BridgeAbstract
'Retro & Popular Culture' => 'collectibles.retro-popular-culture',
'Technica & Nautica' => 'collectibles.technica-nautica',
'Toys' => 'collectibles.toys',
),
'Design' => array(
],
'Design' => [
'All' => 'design',
'Art glass' => 'design.art-glass',
'Furniture' => 'design.furniture',
'Other' => 'design.other',
),
'Folk art' => array(
],
'Folk art' => [
'All' => 'folk-art',
'All categories' => 'lots',
),
'Furniture' => array(
],
'Furniture' => [
'All' => 'furniture',
'Armchairs & Sofas' => 'furniture.armchairs-sofas',
'Cabinets & Bureaus' => 'furniture.cabinets-bureaus',
@@ -81,13 +81,13 @@ class BukowskisBridge extends BridgeAbstract
'Other' => 'furniture.other',
'Shelves & Book cases' => 'furniture.shelves-book-cases',
'Tables' => 'furniture.tables',
),
'Glassware' => array(
],
'Glassware' => [
'All' => 'glassware',
'Glassware' => 'glassware.glassware',
'Other' => 'glassware.other',
),
'Jewellery' => array(
],
'Jewellery' => [
'All' => 'jewellery',
'Bracelets' => 'jewellery.bracelets',
'Brooches' => 'jewellery.brooches',
@@ -95,8 +95,8 @@ class BukowskisBridge extends BridgeAbstract
'Necklaces & Pendants' => 'jewellery.necklaces-pendants',
'Other' => 'jewellery.other',
'Rings' => 'jewellery.rings',
),
'Lighting' => array(
],
'Lighting' => [
'All' => 'lighting',
'Candle sticks & Candelabras' => 'lighting.candle-sticks-candelabras',
'Ceiling lights' => 'lighting.ceiling-lights',
@@ -105,46 +105,46 @@ class BukowskisBridge extends BridgeAbstract
'Other' => 'lighting.other',
'Table lights' => 'lighting.table-lights',
'Wall lights' => 'lighting.wall-lights',
),
'Militaria' => array(
],
'Militaria' => [
'All' => 'militaria',
'Honors & Medals' => 'militaria.honors-medals',
'Other militaria' => 'militaria.other-militaria',
'Weaponry' => 'militaria.weaponry',
),
'Miscellaneous' => array(
],
'Miscellaneous' => [
'All' => 'miscellaneous',
'Brass, Copper & Pewter' => 'miscellaneous.brass-copper-pewter',
'Nickel silver' => 'miscellaneous.nickel-silver',
'Oriental' => 'miscellaneous.oriental',
'Other' => 'miscellaneous.other',
),
'Silver' => array(
],
'Silver' => [
'All' => 'silver',
'Candle sticks' => 'silver.candle-sticks',
'Cups & Bowls' => 'silver.cups-bowls',
'Cutlery' => 'silver.cutlery',
'Other' => 'silver.other',
),
'Timepieces' => array(
],
'Timepieces' => [
'All' => 'timepieces',
'Other' => 'timepieces.other',
'Pocket watches' => 'timepieces.pocket-watches',
'Table clocks' => 'timepieces.table-clocks',
'Wrist watches' => 'timepieces.wrist-watches',
),
'Vintage & Fashion' => array(
],
'Vintage & Fashion' => [
'All' => 'vintage-fashion',
'Accessories' => 'vintage-fashion.accessories',
'Bags & Trunks' => 'vintage-fashion.bags-trunks',
'Clothes' => 'vintage-fashion.clothes',
),
)
),
'sort_order' => array(
],
]
],
'sort_order' => [
'name' => 'Sort order',
'type' => 'list',
'values' => array(
'values' => [
'Ending soon' => 'ending',
'Most recent' => 'recent',
'Most bids' => 'most',
@@ -154,18 +154,18 @@ class BukowskisBridge extends BridgeAbstract
'Lowest estimate' => 'low',
'Highest estimate' => 'high',
'Alphabetical' => 'alphabetical',
),
),
'language' => array(
],
],
'language' => [
'name' => 'Language',
'type' => 'list',
'values' => array(
'values' => [
'English' => 'en',
'Swedish' => 'sv',
'Finnish' => 'fi'
),
),
));
],
],
]];
const CACHE_TIMEOUT = 3600; // 1 hour
@@ -180,11 +180,13 @@ class BukowskisBridge extends BridgeAbstract
$url = $baseUrl . '/' . $language . '/lots';
if ($category)
if ($category) {
$url = $url . '/category/' . $category;
}
if ($sort_order)
if ($sort_order) {
$url = $url . '/sort/' . $sort_order;
}
$html = getSimpleHTMLDOM($url);
@@ -201,13 +203,13 @@ class BukowskisBridge extends BridgeAbstract
)
);
$this->items[] = array(
$this->items[] = [
'title' => $title,
'uri' => $baseUrl . $relative_url,
'uid' => $lot->getAttribute('data-lot-id'),
'content' => count($images) > 0 ? "<img src='$images[0]'/><br/>$title" : $title,
'enclosures' => array_slice($images, 1),
);
];
}
}

View File

@@ -1,6 +1,7 @@
<?php
class BundesbankBridge extends BridgeAbstract {
class BundesbankBridge extends BridgeAbstract
{
const PARAM_LANG = 'lang';
const LANG_EN = 'en';
@@ -12,41 +13,45 @@ class BundesbankBridge extends BridgeAbstract {
const MAINTAINER = 'logmanoriginal';
const CACHE_TIMEOUT = 86400; // 24 hours
const PARAMETERS = array(
array(
self::PARAM_LANG => array(
const PARAMETERS = [
[
self::PARAM_LANG => [
'name' => 'Language',
'type' => 'list',
'defaultValue' => self::LANG_DE,
'values' => array(
'values' => [
'English' => self::LANG_EN,
'Deutsch' => self::LANG_DE
)
)
)
);
]
]
]
];
public function getIcon() {
public function getIcon()
{
return self::URI . 'resource/crblob/1890/a7f48ee0ae35348748121770ba3ca009/mL/favicon-ico-data.ico';
}
public function getURI() {
public function getURI()
{
switch ($this->getInput(self::PARAM_LANG)) {
case self::LANG_EN: return self::URI . 'en/publications/reports/studies';
case self::LANG_DE: return self::URI . 'de/publikationen/berichte/studien';
case self::LANG_EN:
return self::URI . 'en/publications/reports/studies';
case self::LANG_DE:
return self::URI . 'de/publikationen/berichte/studien';
}
return parent::getURI();
}
public function collectData() {
public function collectData()
{
$html = getSimpleHTMLDOM($this->getURI());
$html = defaultLinkTo($html, $this->getURI());
foreach ($html->find('ul.resultlist li') as $study) {
$item = array();
$item = [];
$item['uri'] = $study->find('.teasable__link', 0)->href;
@@ -72,13 +77,12 @@ class BundesbankBridge extends BridgeAbstract {
// Downloads and older studies don't have images
if ($study->find('.teasable__image', 0)) {
$item['enclosures'] = array(
$item['enclosures'] = [
$study->find('.teasable__image img', 0)->src
);
];
}
$this->items[] = $item;
}
}
}

View File

@@ -1,5 +1,7 @@
<?php
class BundestagParteispendenBridge extends BridgeAbstract {
class BundestagParteispendenBridge extends BridgeAbstract
{
const MAINTAINER = 'mibe';
const NAME = 'Deutscher Bundestag - Parteispenden';
const URI = 'https://www.bundestag.de/parlament/praesidium/parteienfinanzierung/fundstellen50000';
@@ -52,10 +54,11 @@ URI;
private function generateItemFromRow(simple_html_dom_node $row)
{
// The row must have 5 columns. There are monthly header rows, which are ignored here.
if(count($row->children) != 5)
if (count($row->children) != 5) {
return null;
}
$item = array();
$item = [];
// | column | paragraph inside column
$party = $row->children[0]->children[0]->innertext;
@@ -69,20 +72,22 @@ URI;
$content = sprintf(self::CONTENT_TEMPLATE, $party, $amount, $donor, $date);
$item = array(
$item = [
'title' => $party . ': ' . $amount,
'content' => $content,
'uid' => sha1($content),
);
];
// Try to get the link to the official document
if ($dip != null)
$item['enclosures'] = array($dip->href);
if ($dip != null) {
$item['enclosures'] = [$dip->href];
}
// Try to parse the date
$dateTime = DateTime::createFromFormat('d.m.Y', $date);
if ($dateTime !== false)
if ($dateTime !== false) {
$item['timestamp'] = $dateTime->getTimestamp();
}
return $item;
}

View File

@@ -1,12 +1,14 @@
<?php
class CBCEditorsBlogBridge extends BridgeAbstract {
class CBCEditorsBlogBridge extends BridgeAbstract
{
const MAINTAINER = 'quickwick';
const NAME = 'CBC Editors Blog';
const URI = 'https://www.cbc.ca/news/editorsblog';
const DESCRIPTION = 'Recent CBC Editor\'s Blog posts';
public function collectData(){
public function collectData()
{
$html = getSimpleHTMLDOM(self::URI);
// Loop on each blog post entry
@@ -19,7 +21,7 @@ class CBCEditorsBlogBridge extends BridgeAbstract {
$thumbnailUri = rtrim(explode(',', $thumbnailUris)[0], ' 300w');
// Fill item
$item = array();
$item = [];
$item['uri'] = $articleUri;
$item['id'] = $item['uri'];
$item['timestamp'] = $timestamp;

View File

@@ -1,17 +1,18 @@
<?php
class CNETBridge extends BridgeAbstract {
class CNETBridge extends BridgeAbstract
{
const MAINTAINER = 'ORelio';
const NAME = 'CNET News';
const URI = 'https://www.cnet.com/';
const CACHE_TIMEOUT = 3600; // 1h
const DESCRIPTION = 'Returns the newest articles.';
const PARAMETERS = array(
array(
'topic' => array(
const PARAMETERS = [
[
'topic' => [
'name' => 'Topic',
'type' => 'list',
'values' => array(
'values' => [
'All articles' => '',
'Apple' => 'apple',
'Google' => 'google',
@@ -22,12 +23,13 @@ class CNETBridge extends BridgeAbstract {
'Security' => 'topics-security',
'Internet' => 'topics-internet',
'Tech Industry' => 'topics-tech-industry'
)
)
)
);
]
]
]
];
private function cleanArticle($article_html) {
private function cleanArticle($article_html)
{
$offset_p = strpos($article_html, '<p>');
$offset_figure = strpos($article_html, '<figure');
$offset = ($offset_figure < $offset_p ? $offset_figure : $offset_p);
@@ -44,12 +46,13 @@ class CNETBridge extends BridgeAbstract {
return $article_html;
}
public function collectData() {
public function collectData()
{
// Retrieve and check user input
$topic = str_replace('-', '/', $this->getInput('topic'));
if (!empty($topic) && (substr_count($topic, '/') > 1 || !ctype_alpha(str_replace('/', '', $topic))))
if (!empty($topic) && (substr_count($topic, '/') > 1 || !ctype_alpha(str_replace('/', '', $topic)))) {
returnClientError('Invalid topic: ' . $topic);
}
// Retrieve webpage
$pageUrl = self::URI . (empty($topic) ? 'news/' : $topic . '/');
@@ -57,7 +60,6 @@ class CNETBridge extends BridgeAbstract {
// Process articles
foreach ($html->find('div.assetBody, div.riverPost') as $element) {
if (count($this->items) >= 10) {
break;
}
@@ -69,37 +71,41 @@ class CNETBridge extends BridgeAbstract {
$article_author = trim($element->find('a[rel=author], a.name', 0)->plaintext);
$article_content = '<p><b>' . trim($element->find('p.dek', 0)->plaintext) . '</b></p>';
if (is_null($article_thumbnail))
if (is_null($article_thumbnail)) {
$article_thumbnail = extractFromDelimiters($element->innertext, '<img src="', '"');
}
if (!empty($article_title) && !empty($article_uri) && strpos($article_uri, self::URI . 'news/') !== false) {
$article_html = getSimpleHTMLDOMCached($article_uri) or $article_html = null;
if (!is_null($article_html)) {
if (empty($article_thumbnail))
if (empty($article_thumbnail)) {
$article_thumbnail = $article_html->find('div.originalImage', 0);
if (empty($article_thumbnail))
}
if (empty($article_thumbnail)) {
$article_thumbnail = $article_html->find('span.imageContainer', 0);
if (is_object($article_thumbnail))
}
if (is_object($article_thumbnail)) {
$article_thumbnail = $article_thumbnail->find('img', 0)->src;
}
$article_content .= trim(
$this->cleanArticle(
extractFromDelimiters(
$article_html, '<article', '<footer'
$article_html,
'<article',
'<footer'
)
)
);
}
$item = array();
$item = [];
$item['uri'] = $article_uri;
$item['title'] = $article_title;
$item['author'] = $article_author;
$item['timestamp'] = $article_timestamp;
$item['enclosures'] = array($article_thumbnail);
$item['enclosures'] = [$article_thumbnail];
$item['content'] = $article_content;
$this->items[] = $item;
}

View File

@@ -1,4 +1,5 @@
<?php
class CNETFranceBridge extends FeedExpander
{
const MAINTAINER = 'leomaradan';
@@ -6,25 +7,25 @@ class CNETFranceBridge extends FeedExpander
const URI = 'https://www.cnetfrance.fr/';
const CACHE_TIMEOUT = 3600; // 1h
const DESCRIPTION = 'CNET France RSS with filters';
const PARAMETERS = array(
'filters' => array(
'title' => array(
const PARAMETERS = [
'filters' => [
'title' => [
'name' => 'Exclude by title',
'required' => false,
'title' => 'Title term, separated by semicolon (;)',
'exampleValue' => 'bon plan;bons plans;au meilleur prix;des meilleures offres;Amazon Prime Day;RED by SFR ou B&You'
),
'url' => array(
],
'url' => [
'name' => 'Exclude by url',
'required' => false,
'title' => 'URL term, separated by semicolon (;)',
'exampleValue' => 'bon-plan;bons-plans'
)
)
);
]
]
];
private $bannedTitle = array();
private $bannedURL = array();
private $bannedTitle = [];
private $bannedURL = [];
public function collectData()
{

View File

@@ -7,29 +7,30 @@
// it is not reliable and contain no useful information. This bridge create a
// sane feed with additional information like tags and a link to the CWE
// a description of the vulnerability.
class CVEDetailsBridge extends BridgeAbstract {
class CVEDetailsBridge extends BridgeAbstract
{
const MAINTAINER = 'Aaron Fischer';
const NAME = 'CVE Details';
const CACHE_TIMEOUT = 60 * 60 * 6; // 6 hours
const DESCRIPTION = 'Report new CVE vulnerabilities for a given vendor (and product)';
const URI = 'https://www.cvedetails.com';
const PARAMETERS = array(array(
const PARAMETERS = [[
// The Vendor ID can be taken from the URL
'vendor_id' => array(
'vendor_id' => [
'name' => 'Vendor ID',
'type' => 'number',
'required' => true,
'exampleValue' => 74, // PHP
),
],
// The optional Product ID can be taken from the URL as well
'product_id' => array(
'product_id' => [
'name' => 'Product ID',
'type' => 'number',
'required' => false,
'exampleValue' => 128, // PHP
),
));
],
]];
private $html = null;
private $vendor = '';
@@ -39,7 +40,8 @@ class CVEDetailsBridge extends BridgeAbstract {
// Because of the optional product ID, we need to attach it if it is
// set. The search result page has the exact same structure (with and
// without the product ID).
private function _buildURL() {
private function buildUrl()
{
$url = self::URI . '/vulnerability-list/vendor_id-' . $this->getInput('vendor_id');
if ($this->getInput('product_id') !== '') {
$url .= '/product_id-' . $this->getInput('product_id');
@@ -54,8 +56,9 @@ class CVEDetailsBridge extends BridgeAbstract {
// Make the actual request to cvedetails.com and stores the response
// (HTML) for later use and extract vendor and product from it.
private function _fetchContent() {
$html = getSimpleHTMLDOM($this->_buildURL());
private function fetchContent()
{
$html = getSimpleHTMLDOM($this->buildUrl());
$this->html = defaultLinkTo($html, self::URI);
$vendor = $html->find('#contentdiv > h1 > a', 0);
@@ -74,13 +77,14 @@ class CVEDetailsBridge extends BridgeAbstract {
}
// Build the name of the feed.
public function getName() {
public function getName()
{
if ($this->getInput('vendor_id') == '') {
return self::NAME;
}
if ($this->html == null) {
$this->_fetchContent();
$this->fetchContent();
}
$name = 'CVE Vulnerabilities for ' . $this->vendor;
@@ -92,17 +96,18 @@ class CVEDetailsBridge extends BridgeAbstract {
}
// Pull the data from the HTML response and fill the items..
public function collectData() {
public function collectData()
{
if ($this->html == null) {
$this->_fetchContent();
$this->fetchContent();
}
foreach ($this->html->find('#vulnslisttable .srrowns') as $i => $tr) {
// There are some optional vulnerability types, which will be
// added to the categories as well as the CWE number -- which is
// always given.
$categories = array($this->vendor);
$enclosures = array();
$categories = [$this->vendor];
$enclosures = [];
$cwe = $tr->find('td', 2)->find('a', 0);
if ($cwe != null) {
@@ -121,7 +126,7 @@ class CVEDetailsBridge extends BridgeAbstract {
// The CVE number itself
$title = $tr->find('td', 1)->find('a', 0)->innertext;
$this->items[] = array(
$this->items[] = [
'uri' => $tr->find('td', 1)->find('a', 0)->href,
'title' => $title,
'timestamp' => $tr->find('td', 5)->innertext,
@@ -129,7 +134,7 @@ class CVEDetailsBridge extends BridgeAbstract {
'categories' => $categories,
'enclosures' => $enclosures,
'uid' => $tr->find('td', 1)->find('a', 0)->innertext,
);
];
// We only want to fetch the latest 10 CVEs
if (count($this->items) >= 10) {

View File

@@ -1,30 +1,32 @@
<?php
class CachetBridge extends BridgeAbstract {
class CachetBridge extends BridgeAbstract
{
const NAME = 'Cachet Bridge';
const URI = 'https://cachethq.io/';
const DESCRIPTION = 'Returns status updates from any Cachet installation';
const MAINTAINER = 'klimplant';
const PARAMETERS = array(
array(
'host' => array(
const PARAMETERS = [
[
'host' => [
'name' => 'Cachet installation',
'type' => 'text',
'required' => true,
'title' => 'The URL of the Cachet installation',
'exampleValue' => 'https://demo.cachethq.io/',
), 'additional_info' => array(
], 'additional_info' => [
'name' => 'Additional Timestamps',
'type' => 'checkbox',
'title' => 'Whether to include the given timestamps'
)
)
);
]
]
];
const CACHE_TIMEOUT = 300;
private $componentCache = array();
private $componentCache = [];
public function getURI() {
public function getURI()
{
return $this->getInput('host') === null ? 'https://cachethq.io/' : $this->getInput('host');
}
@@ -34,7 +36,8 @@ class CachetBridge extends BridgeAbstract {
* @param string $ping
* @return boolean
*/
private function validatePing($ping) {
private function validatePing($ping)
{
$ping = json_decode($ping);
if ($ping === null) {
return false;
@@ -48,7 +51,8 @@ class CachetBridge extends BridgeAbstract {
* @param integer $id
* @return string
*/
private function getComponentName($id) {
private function getComponentName($id)
{
if ($id === 0) {
return '';
}
@@ -64,7 +68,8 @@ class CachetBridge extends BridgeAbstract {
return $component->data->name;
}
public function collectData() {
public function collectData()
{
$ping = getContents(urljoin($this->getURI(), '/api/v1/ping'));
if (!$this->validatePing($ping)) {
returnClientError('Provided URI is invalid!');
@@ -84,7 +89,6 @@ class CachetBridge extends BridgeAbstract {
});
foreach ($incidents->data as $incident) {
if (isset($incident->permalink)) {
$permalink = $incident->permalink;
} else {
@@ -114,13 +118,13 @@ class CachetBridge extends BridgeAbstract {
$uidOrig = $permalink . $incident->created_at;
$uid = hash('sha512', $uidOrig);
$timestamp = strtotime($incident->created_at);
$categories = array();
$categories = [];
$categories[] = $incident->human_status;
if ($componentName !== '') {
$categories[] = $componentName;
}
$item = array();
$item = [];
$item['uri'] = $permalink;
$item['title'] = $title;
$item['timestamp'] = $timestamp;

View File

@@ -1,15 +1,19 @@
<?php
class CarThrottleBridge extends FeedExpander {
class CarThrottleBridge extends FeedExpander
{
const NAME = 'Car Throttle ';
const URI = 'https://www.carthrottle.com';
const DESCRIPTION = 'Get the latest car-related news from Car Throttle.';
const MAINTAINER = 't0stiman';
public function collectData() {
public function collectData()
{
$this->collectExpandableDatas('https://www.carthrottle.com/rss', 10);
}
protected function parseItem($feedItem) {
protected function parseItem($feedItem)
{
$item = parent::parseItem($feedItem);
//fetch page
@@ -23,7 +27,6 @@ class CarThrottleBridge extends FeedExpander {
//convert <iframe>s to <a>s. meant for embedded videos.
foreach ($item['content']->find('iframe') as $found) {
$iframeUrl = $found->getAttribute('src');
if ($iframeUrl) {

77
bridges/CaschyBridge.php Normal file
View File

@@ -0,0 +1,77 @@
<?php
class CaschyBridge extends FeedExpander
{
const MAINTAINER = 'Tone866';
const NAME = 'Caschys Blog Bridge';
const URI = 'https://stadt-bremerhaven.de/';
const CACHE_TIMEOUT = 1800; // 30min
const DESCRIPTION = 'Returns the full articles instead of only the intro';
const PARAMETERS = [[
'category' => [
'name' => 'Category',
'type' => 'list',
'values' => [
'Alle News'
=> 'https://stadt-bremerhaven.de/feed/'
]
],
'limit' => [
'name' => 'Limit',
'type' => 'number',
'required' => false,
'title' => 'Specify number of full articles to return',
'defaultValue' => 5
]
]];
const LIMIT = 5;
public function collectData()
{
$this->collectExpandableDatas(
$this->getInput('category'),
$this->getInput('limit') ?: static::LIMIT
);
}
protected function parseItem($feedItem)
{
$item = parent::parseItem($feedItem);
if (strpos($item['uri'], 'https://stadt-bremerhaven.de/') !== 0) {
return $item;
}
$article = getSimpleHTMLDOMCached($item['uri']);
if ($article) {
$article = defaultLinkTo($article, $item['uri']);
$item = $this->addArticleToItem($item, $article);
}
return $item;
}
private function addArticleToItem($item, $article)
{
// remove unwanted stuff
foreach (
$article->find('div.video-container, div.aawp, p.aawp-disclaimer, iframe.wp-embedded-content,
div.wp-embed, p.wp-caption-text, script') as $element
) {
$element->remove();
}
// reload html, as remove() is buggy
$article = str_get_html($article->outertext);
$categories = $article->find('div.post-category a');
foreach ($categories as $category) {
$item['categories'][] = $category->plaintext;
}
$content = $article->find('div.entry-inner', 0);
$item['content'] = $content;
return $item;
}
}

View File

@@ -1,61 +1,69 @@
<?php
class CastorusBridge extends BridgeAbstract {
class CastorusBridge extends BridgeAbstract
{
const MAINTAINER = 'logmanoriginal';
const NAME = 'Castorus Bridge';
const URI = 'https://www.castorus.com';
const CACHE_TIMEOUT = 600; // 10min
const DESCRIPTION = 'Returns the latest changes';
const PARAMETERS = array(
'Get latest changes' => array(),
'Get latest changes via ZIP code' => array(
'zip' => array(
const PARAMETERS = [
'Get latest changes' => [],
'Get latest changes via ZIP code' => [
'zip' => [
'name' => 'ZIP code',
'type' => 'text',
'required' => true,
'exampleValue' => '7',
'title' => 'Insert ZIP code (complete or partial). e.g: 78125 OR 781 OR 7'
)
),
'Get latest changes via city name' => array(
'city' => array(
]
],
'Get latest changes via city name' => [
'city' => [
'name' => 'City name',
'type' => 'text',
'required' => true,
'exampleValue' => 'Paris',
'title' => 'Insert city name (complete or partial). e.g: Paris OR Par OR P'
)
)
);
]
]
];
// Extracts the title from an actitiy
private function extractActivityTitle($activity){
private function extractActivityTitle($activity)
{
$title = $activity->find('a', 0);
if(!$title)
if (!$title) {
returnServerError('Cannot find title!');
}
return trim($title->plaintext);
}
// Extracts the url from an actitiy
private function extractActivityUrl($activity){
private function extractActivityUrl($activity)
{
$url = $activity->find('a', 0);
if(!$url)
if (!$url) {
returnServerError('Cannot find url!');
}
return self::URI . $url->href;
}
// Extracts the time from an activity
private function extractActivityTime($activity){
private function extractActivityTime($activity)
{
// Unfortunately the time is part of the parent node,
// so we have to clear all child nodes first
$nodes = $activity->find('*');
if(!$nodes)
if (!$nodes) {
returnServerError('Cannot find nodes!');
}
foreach ($nodes as $node) {
$node->outertext = '';
@@ -65,31 +73,36 @@ class CastorusBridge extends BridgeAbstract {
}
// Extracts the price change
private function extractActivityPrice($activity){
private function extractActivityPrice($activity)
{
$price = $activity->find('span', 1);
if(!$price)
if (!$price) {
returnServerError('Cannot find price!');
}
return $price->innertext;
}
public function collectData(){
public function collectData()
{
$zip_filter = trim($this->getInput('zip'));
$city_filter = trim($this->getInput('city'));
$html = getSimpleHTMLDOM(self::URI);
if(!$html)
if (!$html) {
returnServerError('Could not load data from ' . self::URI . '!');
}
$activities = $html->find('div#activite > li');
if(!$activities)
if (!$activities) {
returnServerError('Failed to find activities!');
}
foreach ($activities as $activity) {
$item = array();
$item = [];
$item['title'] = $this->extractActivityTitle($activity);
$item['uri'] = $this->extractActivityUrl($activity);
@@ -102,13 +115,17 @@ class CastorusBridge extends BridgeAbstract {
. $this->extractActivityPrice($activity)
. '</p>';
if(isset($zip_filter)
&& !(substr($item['title'], 0, strlen($zip_filter)) === $zip_filter)) {
if (
isset($zip_filter)
&& !(substr($item['title'], 0, strlen($zip_filter)) === $zip_filter)
) {
continue; // Skip this item
}
if(isset($city_filter)
&& !(substr($item['title'], strpos($item['title'], ' ') + 1, strlen($city_filter)) === $city_filter)) {
if (
isset($city_filter)
&& !(substr($item['title'], strpos($item['title'], ' ') + 1, strlen($city_filter)) === $city_filter)
) {
continue; // Skip this item
}

View File

@@ -1,40 +1,42 @@
<?php
class CdactionBridge extends BridgeAbstract {
class CdactionBridge extends BridgeAbstract
{
const NAME = 'CD-ACTION bridge';
const URI = 'https://cdaction.pl';
const DESCRIPTION = 'Fetches the latest posts from given category.';
const MAINTAINER = 'tomaszkane';
const PARAMETERS = array( array(
'category' => array(
const PARAMETERS = [ [
'category' => [
'name' => 'Kategoria',
'type' => 'list',
'values' => array(
'values' => [
'Najnowsze (wszystkie)' => 'najnowsze',
'Newsy' => 'newsy',
'Recenzje' => 'recenzje',
'Teksty' => array(
'Teksty' => [
'Publicystyka' => 'publicystyka',
'Zapowiedzi' => 'zapowiedzi',
'Już graliśmy' => 'juz-gralismy',
'Poradniki' => 'poradniki',
),
],
'Kultura' => 'kultura',
'Wideo' => 'wideo',
'Czasopismo' => 'czasopismo',
'Technologie' => array(
'Technologie' => [
'Artykuły' => 'artykuly',
'Testy' => 'testy',
),
'Na luzie' => array(
],
'Na luzie' => [
'Konkursy' => 'konkursy',
'Nadgodziny' => 'nadgodziny',
)
)
))
);
]
]
]]
];
public function collectData() {
public function collectData()
{
$html = getSimpleHTMLDOM($this->getURI() . '/' . $this->getInput('category'));
$newsJson = $html->find('script#__NEXT_DATA__', 0)->innertext;
@@ -44,7 +46,7 @@ class CdactionBridge extends BridgeAbstract {
$queriesIndex = $this->getInput('category') === 'najnowsze' ? 0 : 1;
foreach ($newsJson->props->pageProps->dehydratedState->queries[$queriesIndex]->state->data->results as $news) {
$item = array();
$item = [];
$item['uri'] = $this->getURI() . '/' . $news->category->slug . '/' . $news->slug;
$item['title'] = $news->title;
$item['timestamp'] = $news->publishedAt;

View File

@@ -1,28 +1,30 @@
<?php
class CeskaTelevizeBridge extends BridgeAbstract {
class CeskaTelevizeBridge extends BridgeAbstract
{
const NAME = 'Česká televize Bridge';
const URI = 'https://www.ceskatelevize.cz';
const CACHE_TIMEOUT = 3600;
const DESCRIPTION = 'Return newest videos';
const MAINTAINER = 'kolarcz';
const PARAMETERS = array(
array(
'url' => array(
const PARAMETERS = [
[
'url' => [
'name' => 'url to the show',
'required' => true,
'exampleValue' => 'https://www.ceskatelevize.cz/porady/1097181328-udalosti/'
)
)
);
]
]
];
private function fixChars($text) {
private function fixChars($text)
{
return html_entity_decode($text, ENT_QUOTES, 'UTF-8');
}
private function getUploadTimeFromString($string) {
private function getUploadTimeFromString($string)
{
if (strpos($string, 'dnes') !== false) {
return strtotime('today');
} elseif (strpos($string, 'včera') !== false) {
@@ -31,11 +33,12 @@ class CeskaTelevizeBridge extends BridgeAbstract {
returnServerError('Could not get date from Česká televize string');
}
$date = sprintf('%04d-%02d-%02d', isset($match[3]) ? $match[3] : date('Y'), $match[2], $match[1]);
$date = sprintf('%04d-%02d-%02d', $match[3] ?? date('Y'), $match[2], $match[1]);
return strtotime($date);
}
public function collectData() {
public function collectData()
{
$url = $this->getInput('url');
$validUrl = '/^(https:\/\/www\.ceskatelevize\.cz\/porady\/\d+-[a-z0-9-]+\/)(bonus\/)?$/';
@@ -43,7 +46,7 @@ class CeskaTelevizeBridge extends BridgeAbstract {
returnServerError('Invalid url');
}
$category = isset($match[4]) ? $match[4] : 'nove';
$category = $match[4] ?? 'nove';
$fixedUrl = "{$match[1]}dily/{$category}/";
$html = getSimpleHTMLDOM($fixedUrl);
@@ -61,23 +64,25 @@ class CeskaTelevizeBridge extends BridgeAbstract {
$itemThumbnail = $element->find('img', 0);
$itemUri = self::URI . $element->getAttribute('href');
$item = array(
$item = [
'title' => $this->fixChars($itemTitle->plaintext),
'uri' => $itemUri,
'content' => '<img src="' . $itemThumbnail->getAttribute('src') . '" /><br />'
. $this->fixChars($itemContent->plaintext),
'timestamp' => $this->getUploadTimeFromString($itemDate->plaintext)
);
];
$this->items[] = $item;
}
}
public function getURI() {
return isset($this->feedUri) ? $this->feedUri : parent::getURI();
public function getURI()
{
return $this->feedUri ?? parent::getURI();
}
public function getName() {
return isset($this->feedName) ? $this->feedName : parent::getName();
public function getName()
{
return $this->feedName ?? parent::getName();
}
}

View File

@@ -1,69 +1,72 @@
<?php
class CodebergBridge extends BridgeAbstract {
class CodebergBridge extends BridgeAbstract
{
const NAME = 'Codeberg Bridge';
const URI = 'https://codeberg.org/';
const DESCRIPTION = 'Returns commits, issues, pull requests or releases for a repository.';
const MAINTAINER = 'VerifiedJoseph';
const PARAMETERS = array(
'Commits' => array(
'branch' => array(
const PARAMETERS = [
'Commits' => [
'branch' => [
'name' => 'branch',
'type' => 'text',
'exampleValue' => 'main',
'required' => false,
'title' => 'Optional, main branch is used by default.',
),
),
'Issues' => array(),
'Issue Comments' => array(
'issueId' => array(
],
],
'Issues' => [],
'Issue Comments' => [
'issueId' => [
'name' => 'Issue ID',
'type' => 'text',
'required' => true,
'exampleValue' => '513',
)
),
'Pull Requests' => array(),
'Releases' => array(),
'global' => array(
'username' => array(
]
],
'Pull Requests' => [],
'Releases' => [],
'Tags' => [],
'global' => [
'username' => [
'name' => 'Username',
'type' => 'text',
'exampleValue' => 'Codeberg',
'title' => 'Username of account that the repository belongs to.',
'required' => true,
),
'repo' => array(
],
'repo' => [
'name' => 'Repository',
'type' => 'text',
'exampleValue' => 'Community',
'required' => true,
)
)
);
]
]
];
const CACHE_TIMEOUT = 1800;
const TEST_DETECT_PARAMETERS = array(
'https://codeberg.org/Codeberg/Community/issues/507' => array(
const TEST_DETECT_PARAMETERS = [
'https://codeberg.org/Codeberg/Community/issues/507' => [
'context' => 'Issue Comments', 'username' => 'Codeberg', 'repo' => 'Community', 'issueId' => '507'
),
'https://codeberg.org/Codeberg/Community/issues' => array(
],
'https://codeberg.org/Codeberg/Community/issues' => [
'context' => 'Issues', 'username' => 'Codeberg', 'repo' => 'Community'
),
'https://codeberg.org/Codeberg/Community/pulls' => array(
],
'https://codeberg.org/Codeberg/Community/pulls' => [
'context' => 'Pull Requests', 'username' => 'Codeberg', 'repo' => 'Community'
),
'https://codeberg.org/Codeberg/Community/releases' => array(
],
'https://codeberg.org/Codeberg/Community/releases' => [
'context' => 'Releases', 'username' => 'Codeberg', 'repo' => 'Community'
),
'https://codeberg.org/Codeberg/Community/commits/branch/master' => array(
],
'https://codeberg.org/Codeberg/Community/commits/branch/master' => [
'context' => 'Commits', 'username' => 'Codeberg', 'repo' => 'Community', 'branch' => 'master'
),
'https://codeberg.org/Codeberg/Community/commits' => array(
],
'https://codeberg.org/Codeberg/Community/commits' => [
'context' => 'Commits', 'username' => 'Codeberg', 'repo' => 'Community'
)
);
]
];
private $defaultBranch = 'main';
private $issueTitle = '';
@@ -74,8 +77,319 @@ class CodebergBridge extends BridgeAbstract {
private $releasesUrlRegex = '/codeberg\.org\/([\w]+)\/([\w]+)\/releases/';
private $issueCommentsUrlRegex = '/codeberg\.org\/([\w]+)\/([\w]+)\/issues\/([0-9]+)/';
public function detectParameters($url) {
$params = array();
public function collectData()
{
$html = getSimpleHTMLDOM($this->getURI());
$html = defaultLinkTo($html, $this->getURI());
switch ($this->queriedContext) {
case 'Commits':
$this->extractCommits($html);
break;
case 'Issues':
$this->extractIssues($html);
break;
case 'Issue Comments':
$this->extractIssueComments($html);
break;
case 'Pull Requests':
$this->extractPulls($html);
break;
case 'Releases':
$this->extractReleases($html);
break;
case 'Tags':
$this->extractTags($html);
break;
default:
throw new \Exception('Invalid context: ' . $this->queriedContext);
}
}
public function getName()
{
switch ($this->queriedContext) {
case 'Commits':
if ($this->getBranch() === $this->defaultBranch) {
return $this->getRepo() . ' Commits';
}
return $this->getRepo() . ' Commits (' . $this->getBranch() . ' branch) - ' . self::NAME;
case 'Issues':
return $this->getRepo() . ' Issues - ' . self::NAME;
case 'Issue Comments':
return $this->issueTitle . ' - Issue Comments - ' . self::NAME;
case 'Pull Requests':
return $this->getRepo() . ' Pull Requests - ' . self::NAME;
case 'Releases':
return $this->getRepo() . ' Releases - ' . self::NAME;
case 'Tags':
return $this->getRepo() . ' Tags - ' . self::NAME;
default:
return parent::getName();
}
}
public function getURI()
{
switch ($this->queriedContext) {
case 'Commits':
return self::URI . $this->getRepo() . '/commits/branch/' . $this->getBranch();
case 'Issues':
return self::URI . $this->getRepo() . '/issues/';
case 'Issue Comments':
return self::URI . $this->getRepo() . '/issues/' . $this->getInput('issueId');
case 'Pull Requests':
return self::URI . $this->getRepo() . '/pulls';
case 'Releases':
return self::URI . $this->getRepo() . '/releases';
case 'Tags':
return self::URI . $this->getRepo() . '/tags';
default:
return parent::getURI();
}
}
private function getBranch()
{
if ($this->getInput('branch')) {
return $this->getInput('branch');
}
return $this->defaultBranch;
}
private function getRepo()
{
return $this->getInput('username') . '/' . $this->getInput('repo');
}
/**
* Extract commits
*/
private function extractCommits($html)
{
$table = $html->find('table#commits-table', 0);
$tbody = $table->find('tbody.commit-list', 0);
foreach ($tbody->find('tr') as $tr) {
$item = [];
$message = $tr->find('td.message', 0);
$item['title'] = $message->find('span.message-wrapper', 0)->plaintext;
$item['uri'] = $tr->find('td.sha', 0)->find('a', 0)->href;
$item['author'] = $tr->find('td.author', 0)->plaintext;
$item['timestamp'] = $tr->find('td', 3)->find('span', 0)->title;
if ($message->find('pre.commit-body', 0)) {
$message->find('pre.commit-body', 0)->style = '';
$item['content'] = $message->find('pre.commit-body', 0);
} else {
$item['content'] = '<blockquote>' . $item['title'] . '</blockquote>';
}
$this->items[] = $item;
}
}
/**
* Extract issues
*/
private function extractIssues($html)
{
$div = $html->find('div.issue.list', 0);
foreach ($div->find('li.item') as $li) {
$item = [];
$number = trim($li->find('a.index,ml-0.mr-2', 0)->plaintext);
$item['title'] = $li->find('a.title', 0)->plaintext . ' (' . $number . ')';
$item['uri'] = $li->find('a.title', 0)->href;
$item['timestamp'] = $li->find('span.time-since', 0)->title;
$item['author'] = $li->find('div.desc', 0)->find('a', 1)->plaintext;
// Fetch issue page
$issuePage = getSimpleHTMLDOMCached($item['uri'], 3600);
$issuePage = defaultLinkTo($issuePage, self::URI);
$item['content'] = $issuePage->find('div.timeline-item.comment.first', 0)->find('div.render-content.markup', 0);
foreach ($li->find('a.ui.label') as $label) {
$item['categories'][] = $label->plaintext;
}
$this->items[] = $item;
}
}
/**
* Extract issue comments
*/
private function extractIssueComments($html)
{
$this->issueTitle = $html->find('span#issue-title', 0)->plaintext
. ' (' . $html->find('span.index', 0)->plaintext . ')';
foreach ($html->find('div.timeline-item.comment') as $div) {
$item = [];
if ($div->class === 'timeline-item comment merge box') {
continue;
}
$item['title'] = $this->ellipsisTitle($div->find('div.render-content.markup', 0)->plaintext);
$item['uri'] = $div->find('span.text.grey', 0)->find('a', 1)->href;
$item['content'] = $div->find('div.render-content.markup', 0);
if ($div->find('div.dropzone-attachments', 0)) {
$item['content'] .= $div->find('div.dropzone-attachments', 0);
}
$item['author'] = $div->find('a.author', 0)->innertext;
$item['timestamp'] = $div->find('span.time-since', 0)->title;
$this->items[] = $item;
}
}
/**
* Extract pulls
*/
private function extractPulls($html)
{
$div = $html->find('div.issue.list', 0);
foreach ($div->find('li.item') as $li) {
$item = [];
$number = trim($li->find('a.index,ml-0.mr-2', 0)->plaintext);
$item['title'] = $li->find('a.title', 0)->plaintext . ' (' . $number . ')';
$item['uri'] = $li->find('a.title', 0)->href;
$item['timestamp'] = $li->find('span.time-since', 0)->title;
$item['author'] = $li->find('div.desc', 0)->find('a', 1)->plaintext;
// Fetch pull request page
$pullRequestPage = getSimpleHTMLDOMCached($item['uri'], 3600);
$pullRequestPage = defaultLinkTo($pullRequestPage, self::URI);
$item['content'] = $pullRequestPage->find('ui.timeline', 0)->find('div.render-content.markup', 0);
foreach ($li->find('a.ui.label') as $label) {
$item['categories'][] = $label->plaintext;
}
$this->items[] = $item;
}
}
/**
* Extract releases
*/
private function extractReleases($html)
{
$ul = $html->find('ul#release-list', 0);
$lis = $ul->find('li.ui.grid');
if ($lis === []) {
throw new \Exception('Found zero releases');
}
foreach ($lis as $li) {
$item = [];
$item['title'] = $li->find('h4', 0)->plaintext;
$item['uri'] = $li->find('h4', 0)->find('a', 0)->href;
$tag = $this->stripSvg($li->find('span.tag', 0));
$commit = $this->stripSvg($li->find('span.commit', 0));
$downloads = $this->extractDownloads($li->find('details.download', 0));
$item['content'] = $li->find('div.markup.desc', 0);
$item['content'] .= <<<HTML
<strong>Tag</strong>
<p>{$tag}</p>
<strong>Commit</strong>
<p>{$commit}</p>
{$downloads}
HTML;
$item['timestamp'] = $li->find('span.time', 0)->find('span', 0)->title;
$item['author'] = $li->find('span.author', 0)->find('a', 0)->plaintext;
$this->items[] = $item;
}
}
private function extractTags($html)
{
$tags = $html->find('td.tag');
if ($tags === []) {
throw new \Exception('Found zero tags');
}
foreach ($tags as $tag) {
$this->items[] = [
'title' => $tag->find('a', 0)->plaintext,
'uri' => $tag->find('a', 0)->href,
'content' => $tag->innertext,
];
}
}
/**
* Extract downloads for a releases
*/
private function extractDownloads($html, $skipFirst = false)
{
$downloads = '';
foreach ($html->find('a') as $index => $a) {
if ($skipFirst === true && $index === 0) {
continue;
}
$downloads .= <<<HTML
<a href="{$a->herf}">{$a->plaintext}</a><br>
HTML;
}
return <<<EOD
<strong>Downloads</strong>
<p>{$downloads}</p>
EOD;
}
/**
* Ellipsis title to first 100 characters
*/
private function ellipsisTitle($text)
{
$length = 100;
if (strlen($text) > $length) {
$text = explode('<br>', wordwrap($text, $length, '<br>'));
return $text[0] . '...';
}
return $text;
}
/**
* Strip SVG tag
*/
private function stripSvg($html)
{
if ($html->find('svg', 0)) {
$html->find('svg', 0)->outertext = '';
}
return $html;
}
public function detectParameters($url)
{
$params = [];
// Issue Comments
if (preg_match($this->issueCommentsUrlRegex, $url, $matches)) {
@@ -129,275 +443,4 @@ class CodebergBridge extends BridgeAbstract {
return null;
}
public function collectData() {
$html = getSimpleHTMLDOM($this->getURI());
$html = defaultLinkTo($html, $this->getURI());
switch($this->queriedContext) {
case 'Commits':
$this->extractCommits($html);
break;
case 'Issues':
$this->extractIssues($html);
break;
case 'Issue Comments':
$this->extractIssueComments($html);
break;
case 'Pull Requests':
$this->extractPulls($html);
break;
case 'Releases':
$this->extractReleases($html);
break;
default:
returnClientError('Invalid context: ' . $this->queriedContext);
}
}
public function getName() {
switch($this->queriedContext) {
case 'Commits':
if ($this->getBranch() === $this->defaultBranch) {
return $this->getRepo() . ' Commits';
}
return $this->getRepo() . ' Commits (' . $this->getBranch() . ' branch) - ' . self::NAME;
case 'Issues':
return $this->getRepo() . ' Issues - ' . self::NAME;
case 'Issue Comments':
return $this->issueTitle . ' - Issue Comments - ' . self::NAME;
case 'Pull Requests':
return $this->getRepo() . ' Pull Requests - ' . self::NAME;
case 'Releases':
return $this->getRepo() . ' Releases - ' . self::NAME;
default:
return parent::getName();
}
}
public function getURI() {
switch($this->queriedContext) {
case 'Commits':
return self::URI . $this->getRepo() . '/commits/branch/' . $this->getBranch();
case 'Issues':
return self::URI . $this->getRepo() . '/issues/';
case 'Issue Comments':
return self::URI . $this->getRepo() . '/issues/' . $this->getInput('issueId');
case 'Pull Requests':
return self::URI . $this->getRepo() . '/pulls';
case 'Releases':
return self::URI . $this->getRepo() . '/releases';
default:
return parent::getURI();
}
}
private function getBranch() {
if ($this->getInput('branch')) {
return $this->getInput('branch');
}
return $this->defaultBranch;
}
private function getRepo() {
return $this->getInput('username') . '/' . $this->getInput('repo');
}
/**
* Extract commits
*/
private function extractCommits($html) {
$table = $html->find('table#commits-table', 0);
$tbody = $table->find('tbody.commit-list', 0);
foreach ($tbody->find('tr') as $tr) {
$item = array();
$message = $tr->find('td.message', 0);
$item['title'] = $message->find('span.message-wrapper', 0)->plaintext;
$item['uri'] = $tr->find('td.sha', 0)->find('a', 0)->href;
$item['author'] = $tr->find('td.author', 0)->plaintext;
$item['timestamp'] = $tr->find('td', 3)->find('span', 0)->title;
if ($message->find('pre.commit-body', 0)) {
$message->find('pre.commit-body', 0)->style = '';
$item['content'] = $message->find('pre.commit-body', 0);
} else {
$item['content'] = '<blockquote>' . $item['title'] . '</blockquote>';
}
$this->items[] = $item;
}
}
/**
* Extract issues
*/
private function extractIssues($html) {
$div = $html->find('div.issue.list', 0);
foreach ($div->find('li.item') as $li) {
$item = array();
$number = trim($li->find('a.index,ml-0.mr-2', 0)->plaintext);
$item['title'] = $li->find('a.title', 0)->plaintext . ' (' . $number . ')';
$item['uri'] = $li->find('a.title', 0)->href;
$item['timestamp'] = $li->find('span.time-since', 0)->title;
$item['author'] = $li->find('div.desc', 0)->find('a', 1)->plaintext;
// Fetch issue page
$issuePage = getSimpleHTMLDOMCached($item['uri'], 3600);
$issuePage = defaultLinkTo($issuePage, self::URI);
$item['content'] = $issuePage->find('div.timeline-item.comment.first', 0)->find('div.render-content.markup', 0);
foreach ($li->find('a.ui.label') as $label) {
$item['categories'][] = $label->plaintext;
}
$this->items[] = $item;
}
}
/**
* Extract issue comments
*/
private function extractIssueComments($html) {
$this->issueTitle = $html->find('span#issue-title', 0)->plaintext
. ' (' . $html->find('span.index', 0)->plaintext . ')';
foreach ($html->find('div.timeline-item.comment') as $div) {
$item = array();
if ($div->class === 'timeline-item comment merge box') {
continue;
}
$item['title'] = $this->ellipsisTitle($div->find('div.render-content.markup', 0)->plaintext);
$item['uri'] = $div->find('span.text.grey', 0)->find('a', 1)->href;
$item['content'] = $div->find('div.render-content.markup', 0);
if ($div->find('div.dropzone-attachments', 0)) {
$item['content'] .= $div->find('div.dropzone-attachments', 0);
}
$item['author'] = $div->find('a.author', 0)->innertext;
$item['timestamp'] = $div->find('span.time-since', 0)->title;
$this->items[] = $item;
}
}
/**
* Extract pulls
*/
private function extractPulls($html) {
$div = $html->find('div.issue.list', 0);
foreach ($div->find('li.item') as $li) {
$item = array();
$number = trim($li->find('a.index,ml-0.mr-2', 0)->plaintext);
$item['title'] = $li->find('a.title', 0)->plaintext . ' (' . $number . ')';
$item['uri'] = $li->find('a.title', 0)->href;
$item['timestamp'] = $li->find('span.time-since', 0)->title;
$item['author'] = $li->find('div.desc', 0)->find('a', 1)->plaintext;
// Fetch pull request page
$pullRequestPage = getSimpleHTMLDOMCached($item['uri'], 3600);
$pullRequestPage = defaultLinkTo($pullRequestPage, self::URI);
$item['content'] = $pullRequestPage->find('ui.timeline', 0)->find('div.render-content.markup', 0);
foreach ($li->find('a.ui.label') as $label) {
$item['categories'][] = $label->plaintext;
}
$this->items[] = $item;
}
}
/**
* Extract releases
*/
private function extractReleases($html) {
$ul = $html->find('ul#release-list', 0);
foreach ($ul->find('li.ui.grid') as $li) {
$item = array();
$item['title'] = $li->find('h4', 0)->plaintext;
$item['uri'] = $li->find('h4', 0)->find('a', 0)->href;
$tag = $this->stripSvg($li->find('span.tag', 0));
$commit = $this->stripSvg($li->find('span.commit', 0));
$downloads = $this->extractDownloads($li->find('details.download', 0));
$item['content'] = $li->find('div.markup.desc', 0);
$item['content'] .= <<<HTML
<strong>Tag</strong>
<p>{$tag}</p>
<strong>Commit</strong>
<p>{$commit}</p>
{$downloads}
HTML;
$item['timestamp'] = $li->find('span.time', 0)->find('span', 0)->title;
$item['author'] = $li->find('span.author', 0)->find('a', 0)->plaintext;
$this->items[] = $item;
}
}
/**
* Extract downloads for a releases
*/
private function extractDownloads($html, $skipFirst = false) {
$downloads = '';
foreach ($html->find('a') as $index => $a) {
if ($skipFirst === true && $index === 0) {
continue;
}
$downloads .= <<<HTML
<a href="{$a->herf}">{$a->plaintext}</a><br>
HTML;
}
return <<<EOD
<strong>Downloads</strong>
<p>{$downloads}</p>
EOD;
}
/**
* Ellipsis title to first 100 characters
*/
private function ellipsisTitle($text) {
$length = 100;
if (strlen($text) > $length) {
$text = explode('<br>', wordwrap($text, $length, '<br>'));
return $text[0] . '...';
}
return $text;
}
/**
* Strip SVG tag
*/
private function stripSvg($html) {
if ($html->find('svg', 0)) {
$html->find('svg', 0)->outertext = '';
}
return $html;
}
}

View File

@@ -1,14 +1,16 @@
<?php
class CollegeDeFranceBridge extends BridgeAbstract {
class CollegeDeFranceBridge extends BridgeAbstract
{
const MAINTAINER = 'pit-fgfjiudghdf';
const NAME = 'CollegeDeFrance';
const URI = 'https://www.college-de-france.fr/';
const CACHE_TIMEOUT = 10800; // 3h
const DESCRIPTION = 'Returns the latest audio and video from CollegeDeFrance';
public function collectData(){
$months = array(
public function collectData()
{
$months = [
'01' => 'janv.',
'02' => 'févr.',
'03' => 'mars',
@@ -21,7 +23,7 @@ class CollegeDeFranceBridge extends BridgeAbstract {
'10' => 'oct.',
'11' => 'nov.',
'12' => 'déc.'
);
];
// The "API" used by the site returns a list of partial HTML in this form
/* <li>
@@ -37,7 +39,7 @@ class CollegeDeFranceBridge extends BridgeAbstract {
. 'components/search-audiovideo.jsp?fulltext=&siteid=1156951719600&lang=FR&type=all');
foreach ($html->find('a[data-target]') as $element) {
$item = array();
$item = [];
$item['title'] = $element->find('.title', 0)->plaintext;
// Most relative URLs contains an hour in addition to the date, so let's use it

View File

@@ -1,20 +1,23 @@
<?php
class ComboiosDePortugalBridge extends BridgeAbstract {
class ComboiosDePortugalBridge extends BridgeAbstract
{
const NAME = 'CP | Avisos';
const BASE_URI = 'https://www.cp.pt';
const URI = self::BASE_URI . '/passageiros/pt';
const DESCRIPTION = 'Comboios de Portugal | Avisos';
const MAINTAINER = 'somini';
public function collectData() {
public function collectData()
{
# Do not verify SSL certificate (the server doesn't send the intermediate)
# https://github.com/RSS-Bridge/rss-bridge/issues/2397
$html = getSimpleHTMLDOM($this->getURI() . '/consultar-horarios/avisos', array(), array(
$html = getSimpleHTMLDOM($this->getURI() . '/consultar-horarios/avisos', [], [
CURLOPT_SSL_VERIFYPEER => 0,
));
]);
foreach ($html->find('.warnings-table a') as $element) {
$item = array();
$item = [];
$item['title'] = $element->innertext;
$item['uri'] = self::BASE_URI . implode('/', array_map('urlencode', explode('/', $element->href)));

View File

@@ -1,31 +1,34 @@
<?php
class ComicsKingdomBridge extends BridgeAbstract {
class ComicsKingdomBridge extends BridgeAbstract
{
const MAINTAINER = 'stjohnjohnson';
const NAME = 'Comics Kingdom Unofficial RSS';
const URI = 'https://comicskingdom.com/';
const CACHE_TIMEOUT = 21600; // 6h
const DESCRIPTION = 'Comics Kingdom Unofficial RSS';
const PARAMETERS = array( array(
'comicname' => array(
const PARAMETERS = [ [
'comicname' => [
'name' => 'comicname',
'type' => 'text',
'exampleValue' => 'mutts',
'title' => 'The name of the comic in the URL after https://comicskingdom.com/',
'required' => true
)
));
]
]];
public function collectData(){
$html = getSimpleHTMLDOM($this->getURI(), array(), array(), true, false);
public function collectData()
{
$html = getSimpleHTMLDOM($this->getURI(), [], [], true, false);
// Get author from first page
$author = $html->find('div.author p', 0);;
$author = $html->find('div.author p', 0);
;
// Get current date/link
$link = $html->find('meta[property=og:url]', -1)->content;
for ($i = 0; $i < 3; $i++) {
$item = array();
$item = [];
$page = getSimpleHTMLDOM($link);
@@ -42,11 +45,14 @@ class ComicsKingdomBridge extends BridgeAbstract {
$this->items[] = $item;
$link = $page->find('div.comic-viewer-inline a', 0)->href;
if (empty($link)) break; // allow bridge to continue if there's less than 3 comics
if (empty($link)) {
break; // allow bridge to continue if there's less than 3 comics
}
}
}
public function getURI(){
public function getURI()
{
if (!is_null($this->getInput('comicname'))) {
return self::URI . urlencode($this->getInput('comicname'));
}
@@ -54,7 +60,8 @@ class ComicsKingdomBridge extends BridgeAbstract {
return parent::getURI();
}
public function getName(){
public function getName()
{
if (!is_null($this->getInput('comicname'))) {
return $this->getInput('comicname') . ' - Comics Kingdom';
}

View File

@@ -1,26 +1,31 @@
<?php
class CommonDreamsBridge extends FeedExpander {
class CommonDreamsBridge extends FeedExpander
{
const MAINTAINER = 'nyutag';
const NAME = 'CommonDreams Bridge';
const URI = 'https://www.commondreams.org/';
const DESCRIPTION = 'Returns the newest articles.';
public function collectData(){
public function collectData()
{
$this->collectExpandableDatas('http://www.commondreams.org/rss.xml', 10);
}
protected function parseItem($newsItem){
protected function parseItem($newsItem)
{
$item = parent::parseItem($newsItem);
$item['content'] = $this->extractContent($item['uri']);
return $item;
}
private function extractContent($url){
$html3 = getSimpleHTMLDOMCached($url);
$text = $html3->find('div[class=field--type-text-with-summary]', 0)->innertext;
$html3->clear();
unset ($html3);
private function extractContent($url)
{
$dom = getSimpleHTMLDOMCached($url);
$summary = $dom->find('div.node__body', 0);
$text = $summary->innertext;
$dom->clear();
unset($dom);
return $text;
}
}

View File

@@ -1,13 +1,15 @@
<?php
class CopieDoubleBridge extends BridgeAbstract {
class CopieDoubleBridge extends BridgeAbstract
{
const MAINTAINER = 'superbaillot.net';
const NAME = 'CopieDouble';
const URI = 'http://www.copie-double.com/';
const CACHE_TIMEOUT = 14400; // 4h
const DESCRIPTION = 'CopieDouble';
public function collectData(){
public function collectData()
{
$html = getSimpleHTMLDOM(self::URI);
$table = $html->find('table table', 2);
@@ -16,7 +18,7 @@ class CopieDoubleBridge extends BridgeAbstract {
$td = $element->find('td', 0);
if ($td->class === 'couleur_1') {
$item = array();
$item = [];
$title = $td->innertext;
$pos = strpos($title, '<a');
$title = substr($title, 0, $pos);

View File

@@ -0,0 +1,75 @@
<?php
class CorreioDaFeiraBridge extends BridgeAbstract
{
const NAME = 'Correio da Feira';
const URI = 'https://www.correiodafeira.pt/';
const DESCRIPTION = 'Returns news from the Portuguese local newspaper Correio da Feira';
const MAINTAINER = 'rmscoelho';
const CACHE_TIMEOUT = 86400;
const PARAMETERS = [
[
'feed' => [
'name' => 'News Feed',
'type' => 'list',
'title' => 'Feeds from the Portuguese sports newspaper A BOLA.PT',
'values' => [
'Cultura' => 'cultura',
'Desporto' => 'desporto',
'Economia' => 'economia',
'Entrevista' => 'entrevista',
'Freguesias' => 'freguesias',
'Justiça' => 'justica',
'Opinião' => 'opiniao',
'Política' => 'politica',
'Reportagem' => 'reportagem',
'Sociedade' => 'sociedade',
'Tecnologia' => 'tecnologia',
]
]
]
];
public function getIcon()
{
return 'https://www.correiodafeira.pt/wp-content/uploads/base_reporter-200x200.jpg';
}
public function getName()
{
return !is_null($this->getKey('feed')) ? self::NAME . ' | ' . $this->getKey('feed') : self::NAME;
}
public function getURI()
{
return self::URI . $this->getInput('feed');
}
public function collectData()
{
$url = sprintf('https://www.correiodafeira.pt/categoria/%s', $this->getInput('feed'));
$dom = getSimpleHTMLDOM($url);
$dom = $dom->find('main', 0);
if (!$dom) {
throw new \Exception(sprintf('Unable to find css selector on `%s`', $url));
}
$dom = defaultLinkTo($dom, $this->getURI());
foreach ($dom->find('div.post') as $article) {
$a = $article->find('div.blog-box', 0);
//Get date and time of publishing
$time = $a->find('.post-date > :nth-child(2)', 0)->plaintext;
$datetime = explode('/', $time);
$year = $datetime[2];
$month = $datetime[1];
$day = $datetime[0];
$timestamp = mktime(0, 0, 0, $month, $day, $year);
$this->items[] = [
'title' => $a->find('h2.entry-title > a', 0)->plaintext,
'uri' => $a->find('h2.entry-title > a', 0)->href,
'author' => $a->find('li.post-author > a', 0)->plaintext,
'content' => $a->find('.entry-content > p', 0)->plaintext,
'timestamp' => $timestamp,
];
}
}
}

View File

@@ -1,17 +1,20 @@
<?php
class CourrierInternationalBridge extends FeedExpander {
class CourrierInternationalBridge extends FeedExpander
{
const MAINTAINER = 'teromene';
const NAME = 'Courrier International Bridge';
const URI = 'https://www.courrierinternational.com/';
const CACHE_TIMEOUT = 300; // 5 min
const DESCRIPTION = 'Returns the newest articles';
public function collectData(){
public function collectData()
{
$this->collectExpandableDatas(static::URI . 'feed/all/rss.xml', 20);
}
protected function parseItem($feedItem){
protected function parseItem($feedItem)
{
$item = parent::parseItem($feedItem);
$articlePage = getSimpleHTMLDOMCached($feedItem->link);

View File

@@ -1,52 +1,55 @@
<?php
class CraigslistBridge extends BridgeAbstract {
const MAINTAINER = 'Yaman Qalieh';
class CraigslistBridge extends BridgeAbstract
{
const NAME = 'Craigslist Bridge';
const URI = 'https://craigslist.org/';
const DESCRIPTION = 'Returns craigslist search results';
const PARAMETERS = array( array(
'region' => array(
const PARAMETERS = [ [
'region' => [
'name' => 'Region',
'title' => 'The subdomain before craigslist.org in the URL',
'exampleValue' => 'sfbay',
'required' => true
),
'search' => array(
],
'search' => [
'name' => 'Search Query',
'title' => 'Everything in the URL after /search/',
'exampleValue' => 'sya?query=laptop',
'required' => true
),
'limit' => array(
],
'limit' => [
'name' => 'Number of Posts',
'type' => 'number',
'title' => 'The maximum number of posts is 120. Use 0 for unlimited posts.',
'defaultValue' => '25'
)
));
]
]];
const TEST_DETECT_PARAMETERS = array(
'https://sfbay.craigslist.org/search/sya?query=laptop' => array(
const TEST_DETECT_PARAMETERS = [
'https://sfbay.craigslist.org/search/sya?query=laptop' => [
'region' => 'sfbay', 'search' => 'sya?query=laptop'
),
'https://newyork.craigslist.org/search/sss?query=32gb+flash+drive&bundleDuplicates=1&max_price=20' => array(
],
'https://newyork.craigslist.org/search/sss?query=32gb+flash+drive&bundleDuplicates=1&max_price=20' => [
'region' => 'newyork', 'search' => 'sss?query=32gb+flash+drive&bundleDuplicates=1&max_price=20'
),
);
],
];
const URL_REGEX = '/^https:\/\/(?<region>\w+).craigslist.org\/search\/(?<search>.+)/';
public function detectParameters($url) {
public function detectParameters($url)
{
if (preg_match(self::URL_REGEX, $url, $matches)) {
$params = array();
$params = [];
$params['region'] = $matches['region'];
$params['search'] = $matches['search'];
return $params;
}
}
public function getURI() {
public function getURI()
{
if (!is_null($this->getInput('region'))) {
$domain = 'https://' . $this->getInput('region') . '.craigslist.org/search/';
return urljoin($domain, $this->getInput('search'));
@@ -54,12 +57,13 @@ class CraigslistBridge extends BridgeAbstract {
return parent::getURI();
}
public function collectData() {
public function collectData()
{
$uri = $this->getURI();
$html = getSimpleHTMLDOM($uri);
// Check if no results page is shown (nearby results)
if ($html->find('.displaycountShow', 0)->plaintext == '0') {
if (($html->find('.displaycountShow', 0)->plaintext ?? '') == '0') {
return;
}
@@ -72,23 +76,24 @@ class CraigslistBridge extends BridgeAbstract {
}
foreach ($results as $post) {
// Skip "nearby results" banner and results
// This only appears when searchNearby is not specified
if ($post->tag == 'h4') {
break;
}
$item = array();
$item = [];
$heading = $post->find('.result-heading a', 0);
$item['uri'] = $heading->href;
$item['title'] = $heading->plaintext;
$item['timestamp'] = $post->find('.result-date', 0)->datetime;
$item['uid'] = $heading->id;
$item['content'] = $post->find('.result-price', 0)->plaintext . ' '
$price = $post->find('.result-price', 0)->plaintext ?? '';
// Find the location (local and nearby results if searchNearby=1)
. $post->find('.result-hood, span.nearby', 0)->plaintext;
$nearby = $post->find('.result-hood, span.nearby', 0)->plaintext ?? '';
$item['content'] = sprintf('%s %s', $price, $nearby);
$images = $post->find('.result-image[data-ids]', 0);
if (!is_null($images)) {

View File

@@ -1,39 +1,41 @@
<?php
class CrewbayBridge extends BridgeAbstract {
class CrewbayBridge extends BridgeAbstract
{
const MAINTAINER = 'couraudt';
const NAME = 'Crewbay Bridge';
const URI = 'https://www.crewbay.com';
const DESCRIPTION = 'Returns the newest sailing offers.';
const PARAMETERS = array(
array(
'keyword' => array(
const PARAMETERS = [
[
'keyword' => [
'name' => 'Filter by keyword',
'title' => 'Enter the keyword to filter here'
),
'type' => array(
],
'type' => [
'name' => 'Type of search',
'title' => 'Choose between finding a boat or a crew',
'type' => 'list',
'values' => array(
'values' => [
'Find a boat' => 'boats',
'Find a crew' => 'crew'
)
),
'status' => array(
]
],
'status' => [
'name' => 'Status on the boat',
'title' => 'Choose between recreational or professional classified ads',
'type' => 'list',
'values' => array(
'values' => [
'Recreational' => 'recreational',
'Professional' => 'professional'
)
),
'recreational_position' => array(
]
],
'recreational_position' => [
'name' => 'Recreational position wanted',
'title' => 'Filter by recreational position you wanted aboard',
'required' => false,
'type' => 'list',
'values' => array(
'values' => [
'' => '',
'Amateur Crew' => 'Amateur Crew',
'Friendship' => 'Friendship',
@@ -41,14 +43,14 @@ class CrewbayBridge extends BridgeAbstract {
'Racing' => 'Racing',
'Voluntary work' => 'Voluntary work',
'Mile building' => 'Mile building'
)
),
'professional_position' => array(
]
],
'professional_position' => [
'name' => 'Professional position wanted',
'title' => 'Filter by professional position you wanted aboard',
'required' => false,
'type' => 'list',
'values' => array(
'values' => [
'' => '',
'1st Engineer' => '1st Engineer',
'1st Mate' => '1st Mate',
@@ -99,12 +101,13 @@ class CrewbayBridge extends BridgeAbstract {
'Stew/Masseuse' => 'Stew/Masseuse',
'Manager' => 'Manager',
'Sailing instructor' => 'Sailing instructor'
)
)
)
);
]
]
]
];
public function collectData() {
public function collectData()
{
$url = $this->getURI();
$html = getSimpleHTMLDOM($url) or returnClientError('No results for this query.');
@@ -118,9 +121,9 @@ class CrewbayBridge extends BridgeAbstract {
if (!empty($this->getInput('recreational_position')) || !empty($this->getInput('professional_position'))) {
if ($this->getInput('type') == 'boats') {
if ($this->getInput('status') == 'professional') {
$positions = array($annonce->find('.title .position', 0)->plaintext);
$positions = [$annonce->find('.title .position', 0)->plaintext];
} else {
$positions = array(str_replace('Wanted:', '', $annonce->find('.content li', 0)->plaintext));
$positions = [str_replace('Wanted:', '', $annonce->find('.content li', 0)->plaintext)];
}
} else {
$list = $htmlDetail->find('.viewer-details .viewer-list');
@@ -141,7 +144,7 @@ class CrewbayBridge extends BridgeAbstract {
}
}
$item = array();
$item = [];
if ($this->getInput('type') == 'boats') {
$titleSelector = '.title h2';
@@ -158,7 +161,7 @@ class CrewbayBridge extends BridgeAbstract {
$item['uri'] = $detail->href;
$images = $annonce->find('.avatar img');
$item['enclosures'] = array(end($images)->getAttribute('src'));
$item['enclosures'] = [end($images)->getAttribute('src')];
$content = $htmlDetail->find('.viewer-intro--info', 0)->innertext;
@@ -166,7 +169,7 @@ class CrewbayBridge extends BridgeAbstract {
foreach ($sections as $section) {
if ($section->find('.viewer-section-title', 0)) {
$class = str_replace('viewer-', '', explode(' ', $section->getAttribute('class'))[0]);
if (!in_array($class, array('apply', 'photos', 'reviews', 'contact', 'experience', 'qa'))) {
if (!in_array($class, ['apply', 'photos', 'reviews', 'contact', 'experience', 'qa'])) {
// Basic sections
$content .= $section->find('.viewer-section-title h3', 0)->outertext;
$content .= $section->find('.viewer-section-content', 0)->innertext;
@@ -192,7 +195,7 @@ class CrewbayBridge extends BridgeAbstract {
$tags = $htmlDetail->find('li.viewer-tags--tag');
foreach ($tags as $tag) {
if (!isset($item['categories'])) {
$item['categories'] = array();
$item['categories'] = [];
}
$text = trim($tag->plaintext);
if (!in_array($text, $item['categories'])) {
@@ -203,11 +206,14 @@ class CrewbayBridge extends BridgeAbstract {
$this->items[] = $item;
$limit += 1;
if ($limit == 10) break;
if ($limit == 10) {
break;
}
}
}
public function getURI() {
public function getURI()
{
$uri = parent::getURI();
if ($this->getInput('type') == 'boats') {

View File

@@ -1,25 +1,28 @@
<?php
class CryptomeBridge extends BridgeAbstract {
class CryptomeBridge extends BridgeAbstract
{
const MAINTAINER = 'BoboTiG';
const NAME = 'Cryptome';
const URI = 'https://cryptome.org/';
const CACHE_TIMEOUT = 21600; // 6h
const DESCRIPTION = 'Returns the N most recent documents.';
const PARAMETERS = array( array(
'n' => array(
const PARAMETERS = [ [
'n' => [
'name' => 'number of elements',
'type' => 'number',
'required' => true,
'exampleValue' => 10
)
));
]
]];
public function getIcon() {
public function getIcon()
{
return self::URI . '/favicon.ico';
}
public function collectData(){
public function collectData()
{
$html = getSimpleHTMLDOM(self::URI);
$number = $this->getInput('n');
@@ -29,7 +32,7 @@ class CryptomeBridge extends BridgeAbstract {
$i = 0;
foreach ($html->find('pre', 1)->find('b') as $element) {
foreach ($element->find('a') as $element1) {
$item = array();
$item = [];
$item['uri'] = $element1->href;
$item['title'] = $element->plaintext;
$this->items[] = $item;

View File

@@ -1,36 +1,39 @@
<?php
class CubariBridge extends BridgeAbstract
{
const NAME = 'Cubari';
const URI = 'https://cubari.moe';
const DESCRIPTION = 'Parses given cubari-formatted JSON file for updates.';
const MAINTAINER = 'KamaleiZestri';
const PARAMETERS = array(array(
'gist' => array(
const PARAMETERS = [[
'gist' => [
'name' => 'Gist/Raw Url',
'type' => 'text',
'required' => true,
'exampleValue' => 'https://raw.githubusercontent.com/kurisumx/baka/main/ikedan'
)
));
]
]];
private $mangaTitle = '';
public function getName()
{
if (!empty($this->mangaTitle))
if (!empty($this->mangaTitle)) {
return $this->mangaTitle . ' - ' . self::NAME;
else
} else {
return self::NAME;
}
}
public function getURI()
{
if ($this->getInput('gist') != '')
if ($this->getInput('gist') != '') {
return self::URI . '/read/gist/' . $this->getEncodedGist();
else
} else {
return self::URI;
}
}
/**
* The Cubari bridge.
@@ -78,12 +81,13 @@ class CubariBridge extends BridgeAbstract
protected function getItemFromChapter($chapnum, $chapter)
{
$item = array();
$item = [];
$item['uri'] = $this->getURI() . '/' . $chapnum;
$item['title'] = 'Chapter ' . $chapnum . ' - ' . $chapter['title'] . ' - ' . $this->mangaTitle;
foreach ($chapter['groups'] as $key => $value)
foreach ($chapter['groups'] as $key => $value) {
$item['author'] = $key;
}
$item['timestamp'] = $chapter['last_updated'];
$item['content'] = '<p>Manga: <a href=' . $this->getURI() . '>' . $this->mangaTitle . '</a> </p>

View File

@@ -1,30 +1,35 @@
<?php
class CuriousCatBridge extends BridgeAbstract {
class CuriousCatBridge extends BridgeAbstract
{
const NAME = 'Curious Cat Bridge';
const URI = 'https://curiouscat.me';
const DESCRIPTION = 'Returns list of newest questions and answers for a user profile';
const MAINTAINER = 'VerifiedJoseph';
const PARAMETERS = array(array(
'username' => array(
const PARAMETERS = [[
'username' => [
'name' => 'Username',
'type' => 'text',
'required' => true,
'exampleValue' => 'koethekoethe',
)
));
]
]];
const CACHE_TIMEOUT = 3600;
public function collectData() {
public function collectData()
{
$url = self::URI . '/api/v2/profile?username=' . urlencode($this->getInput('username'));
$apiJson = getContents($url);
$apiData = json_decode($apiJson, true);
$apiData = Json::decode($apiJson);
if (isset($apiData['error'])) {
throw new \Exception($apiData['error_code']);
}
foreach ($apiData['posts'] as $post) {
$item = array();
$item = [];
$item['author'] = 'Anonymous';
@@ -42,8 +47,8 @@ class CuriousCatBridge extends BridgeAbstract {
}
}
public function getURI() {
public function getURI()
{
if (!is_null($this->getInput('username'))) {
return self::URI . '/' . $this->getInput('username');
}
@@ -51,8 +56,8 @@ class CuriousCatBridge extends BridgeAbstract {
return parent::getURI();
}
public function getName() {
public function getName()
{
if (!is_null($this->getInput('username'))) {
return $this->getInput('username') . ' - Curious Cat';
}
@@ -60,8 +65,8 @@ class CuriousCatBridge extends BridgeAbstract {
return parent::getName();
}
private function processContent($post) {
private function processContent($post)
{
$author = 'Anonymous';
if ($post['senderData']['id'] !== false) {
@@ -85,7 +90,8 @@ EOD;
return $content;
}
private function ellipsisTitle($text) {
private function ellipsisTitle($text)
{
$length = 150;
if (strlen($text) > $length) {
@@ -96,13 +102,12 @@ EOD;
return $text;
}
private function formatUrls($content) {
private function formatUrls($content)
{
return preg_replace(
'/(http[s]{0,1}\:\/\/[a-zA-Z0-9.\/\?\&=\-_]{4,})/ims',
'<a target="_blank" href="$1" target="_blank">$1</a> ',
$content
);
}
}

View File

@@ -1,37 +0,0 @@
<?php
class CyanideAndHappinessBridge extends BridgeAbstract {
const NAME = 'Cyanide & Happiness';
const URI = 'https://explosm.net/';
const DESCRIPTION = 'The Webcomic from Explosm.';
const MAINTAINER = 'sal0max';
const CACHE_TIMEOUT = 60 * 60 * 2; // 2 hours
public function getIcon() {
return self::URI . 'favicon-32x32.png';
}
public function getURI(){
return self::URI . 'comics/latest#comic';
}
public function collectData() {
$html = getSimpleHTMLDOM($this->getUri());
foreach ($html->find('[class*=ComicImage]') as $element) {
$date = $element->find('[class^=Author__Right] p', 0)->plaintext;
$author = str_replace('by ', '', $element->find('[class^=Author__Right] p', 1)->plaintext);
$image = $element->find('img', 0)->src;
$link = $html->find('[rel=canonical]', 0)->href;
$item = array(
'uid' => $link,
'author' => $author,
'title' => $date,
'uri' => $link . '#comic',
'timestamp' => str_replace('.', '-', $date) . 'T00:00:00Z',
'content' => "<img src=\"$image\" />"
);
$this->items[] = $item;
}
}
}

View File

@@ -1,54 +1,55 @@
<?php
class DailymotionBridge extends BridgeAbstract {
class DailymotionBridge extends BridgeAbstract
{
const MAINTAINER = 'mitsukarenai';
const NAME = 'Dailymotion Bridge';
const URI = 'https://www.dailymotion.com/';
const CACHE_TIMEOUT = 3600; // 1h
const DESCRIPTION = 'Returns the 5 newest videos by username/playlist or search';
const PARAMETERS = array (
'By username' => array(
'u' => array(
const PARAMETERS = [
'By username' => [
'u' => [
'name' => 'username',
'required' => true,
'exampleValue' => 'moviepilot',
)
),
'By playlist id' => array(
'p' => array(
]
],
'By playlist id' => [
'p' => [
'name' => 'playlist id',
'required' => true,
'exampleValue' => 'x6xyc6',
)
),
'From search results' => array(
's' => array(
]
],
'From search results' => [
's' => [
'name' => 'Search keyword',
'required' => true,
'exampleValue' => 'matrix',
),
'pa' => array(
],
'pa' => [
'name' => 'Page',
'type' => 'number',
'defaultValue' => 1,
)
)
);
]
]
];
private $feedName = '';
private $apiUrl = 'https://api.dailymotion.com';
private $apiFields = 'created_time,description,id,owner.screenname,tags,thumbnail_url,title,url';
public function getIcon() {
public function getIcon()
{
return 'https://static1-ssl.dmcdn.net/images/neon/favicons/android-icon-36x36.png.vf806ca4ed0deed812';
}
public function collectData() {
public function collectData()
{
if ($this->queriedContext === 'By username' || $this->queriedContext === 'By playlist id') {
$apiJson = getContents($this->getApiUrl());
$apiData = json_decode($apiJson, true);
@@ -56,7 +57,7 @@ class DailymotionBridge extends BridgeAbstract {
$this->feedName = $this->getPlaylistTitle($this->getInput('p'));
foreach ($apiData['list'] as $apiItem) {
$item = array();
$item = [];
$item['uri'] = $apiItem['url'];
$item['uid'] = $apiItem['id'];
@@ -73,11 +74,10 @@ class DailymotionBridge extends BridgeAbstract {
}
if ($this->queriedContext === 'From search results') {
$html = getSimpleHTMLDOM($this->getURI());
foreach ($html->find('div.media a.preview_link') as $element) {
$item = array();
$item = [];
$item['id'] = str_replace('/video/', '', strtok($element->href, '_'));
$metadata = $this->getMetadata($item['id']);
@@ -109,7 +109,8 @@ class DailymotionBridge extends BridgeAbstract {
}
}
public function getName() {
public function getName()
{
switch ($this->queriedContext) {
case 'By username':
$specific = $this->getInput('u');
@@ -125,13 +126,15 @@ class DailymotionBridge extends BridgeAbstract {
case 'From search results':
$specific = $this->getInput('s');
break;
default: return parent::getName();
default:
return parent::getName();
}
return $specific . ' : Dailymotion';
}
public function getURI(){
public function getURI()
{
$uri = self::URI;
switch ($this->queriedContext) {
case 'By username':
@@ -153,13 +156,15 @@ class DailymotionBridge extends BridgeAbstract {
$uri .= '/' . $pa;
}
break;
default: return parent::getURI();
default:
return parent::getURI();
}
return $uri;
}
private function getMetadata($id) {
$metadata = array();
private function getMetadata($id)
{
$metadata = [];
$html = getSimpleHTMLDOM(self::URI . 'video/' . $id);
@@ -176,7 +181,8 @@ class DailymotionBridge extends BridgeAbstract {
return $metadata;
}
private function getPlaylistTitle($id) {
private function getPlaylistTitle($id)
{
$title = '';
$url = self::URI . 'playlist/' . $id;
@@ -187,8 +193,8 @@ class DailymotionBridge extends BridgeAbstract {
return $title;
}
private function getApiUrl() {
private function getApiUrl()
{
switch ($this->queriedContext) {
case 'By username':
return $this->apiUrl . '/user/' . $this->getInput('u')

View File

@@ -1,47 +1,51 @@
<?php
class DanbooruBridge extends BridgeAbstract {
class DanbooruBridge extends BridgeAbstract
{
const MAINTAINER = 'mitsukarenai, logmanoriginal';
const NAME = 'Danbooru';
const URI = 'http://donmai.us/';
const CACHE_TIMEOUT = 1800; // 30min
const DESCRIPTION = 'Returns images from given page';
const PARAMETERS = array(
'global' => array(
'p' => array(
const PARAMETERS = [
'global' => [
'p' => [
'name' => 'page',
'defaultValue' => 1,
'type' => 'number'
),
't' => array(
],
't' => [
'type' => 'text',
'name' => 'tags',
'exampleValue' => 'cosplay',
)
),
0 => array()
);
]
],
0 => []
];
const PATHTODATA = 'article';
const IDATTRIBUTE = 'data-id';
const TAGATTRIBUTE = 'alt';
protected function getFullURI(){
protected function getFullURI()
{
return $this->getURI()
. 'posts?&page=' . $this->getInput('p')
. '&tags=' . urlencode($this->getInput('t'));
}
protected function getTags($element){
protected function getTags($element)
{
return $element->find('img', 0)->getAttribute(static::TAGATTRIBUTE);
}
protected function getItemFromElement($element){
protected function getItemFromElement($element)
{
// Fix links
defaultLinkTo($element, $this->getURI());
$item = array();
$item = [];
$item['uri'] = html_entity_decode($element->find('a', 0)->href);
$item['postid'] = (int)preg_replace('/[^0-9]/', '', $element->getAttribute(static::IDATTRIBUTE));
$item['timestamp'] = time();
@@ -58,7 +62,8 @@ class DanbooruBridge extends BridgeAbstract {
return $item;
}
public function collectData(){
public function collectData()
{
$html = getSimpleHTMLDOMCached($this->getFullURI());
foreach ($html->find(static::PATHTODATA) as $element) {

View File

@@ -1,18 +1,19 @@
<?php
class DansTonChatBridge extends BridgeAbstract {
class DansTonChatBridge extends BridgeAbstract
{
const MAINTAINER = 'Astalaseven';
const NAME = 'DansTonChat Bridge';
const URI = 'https://danstonchat.com/';
const CACHE_TIMEOUT = 21600; //6h
const DESCRIPTION = 'Returns latest quotes from DansTonChat.';
public function collectData(){
public function collectData()
{
$html = getSimpleHTMLDOM(self::URI . 'latest.html');
foreach ($html->find('div.item') as $element) {
$item = array();
$item = [];
$item['uri'] = $element->find('a', 0)->href;
$titleContent = $element->find('h3 a', 0);
if ($titleContent) {

View File

@@ -1,15 +1,17 @@
<?php
class DarkReadingBridge extends FeedExpander {
class DarkReadingBridge extends FeedExpander
{
const MAINTAINER = 'ORelio';
const NAME = 'Dark Reading Bridge';
const URI = 'https://www.darkreading.com/';
const DESCRIPTION = 'Returns the newest articles from Dark Reading';
const PARAMETERS = array( array(
'feed' => array(
const PARAMETERS = [ [
'feed' => [
'name' => 'Feed',
'type' => 'list',
'values' => array(
'values' => [
'All Dark Reading Stories' => '000_AllArticles',
'Attacks/Breaches' => '644_Attacks/Breaches',
'Application Security' => '645_Application%20Security',
@@ -32,12 +34,13 @@ class DarkReadingBridge extends FeedExpander {
'Advanced Threats' => '662_Advanced%20Threats',
'Insider Threats' => '663_Insider%20Threats',
'Vulnerability Management' => '664_Vulnerability%20Management',
)
),
]
],
'limit' => self::LIMIT,
));
]];
public function collectData(){
public function collectData()
{
$feed = $this->getInput('feed');
$feed_splitted = explode('_', $feed);
$feed_id = $feed_splitted[0];
@@ -53,31 +56,35 @@ class DarkReadingBridge extends FeedExpander {
$this->collectExpandableDatas($feed_url, $limit);
}
protected function parseItem($newsItem){
protected function parseItem($newsItem)
{
$item = parent::parseItem($newsItem);
$article = getSimpleHTMLDOMCached($item['uri']);
$item['content'] = $this->extractArticleContent($article);
$item['enclosures'] = array(); //remove author profile picture
$item['enclosures'] = []; //remove author profile picture
$image = $article->find('meta[property="og:image"]', 0);
if (is_object($image)) {
$image = $image->content;
$item['enclosures'] = array($image);
$item['enclosures'] = [$image];
}
return $item;
}
private function extractArticleContent($article){
private function extractArticleContent($article)
{
$content = $article->find('div.article-content', 0)->innertext;
foreach (array(
foreach (
[
'<div class="divsplitter',
'<div style="float: left; margin-right: 2px;',
'<div class="more-insights',
'<div id="more-insights',
) as $div_start) {
] as $div_start
) {
$content = stripRecursiveHTMLSection($content, 'div', $div_start);
}
return $content;
return convertLazyLoading($content);
}
}

View File

@@ -1,17 +1,18 @@
<?php
class DauphineLibereBridge extends FeedExpander {
class DauphineLibereBridge extends FeedExpander
{
const MAINTAINER = 'qwertygc';
const NAME = 'Dauphine Bridge';
const URI = 'https://www.ledauphine.com/';
const CACHE_TIMEOUT = 7200; // 2h
const DESCRIPTION = 'Returns the newest articles.';
const PARAMETERS = array( array(
'u' => array(
const PARAMETERS = [ [
'u' => [
'name' => 'Catégorie de l\'article',
'type' => 'list',
'values' => array(
'values' => [
'À la une' => '',
'France Monde' => 'france-monde',
'Faits Divers' => 'faits-divers',
@@ -27,11 +28,12 @@ class DauphineLibereBridge extends FeedExpander {
'Savoie' => 'savoie',
'Haute-Savoie' => 'haute-savoie',
'Vaucluse' => 'vaucluse'
)
)
));
]
]
]];
public function collectData(){
public function collectData()
{
$url = self::URI . 'rss';
if (empty($this->getInput('u'))) {
@@ -41,13 +43,15 @@ class DauphineLibereBridge extends FeedExpander {
$this->collectExpandableDatas($url, 10);
}
protected function parseItem($newsItem){
protected function parseItem($newsItem)
{
$item = parent::parseItem($newsItem);
$item['content'] = $this->extractContent($item['uri']);
return $item;
}
private function extractContent($url){
private function extractContent($url)
{
$html2 = getSimpleHTMLDOMCached($url);
foreach ($html2->find('.noprint, link, script, iframe, .shareTool, .contentInfo') as $remove) {
$remove->outertext = '';

View File

@@ -1,11 +1,14 @@
<?php
class DavesTrailerPageBridge extends BridgeAbstract {
class DavesTrailerPageBridge extends BridgeAbstract
{
const MAINTAINER = 'johnnygroovy';
const NAME = 'Daves Trailer Page Bridge';
const URI = 'https://www.davestrailerpage.co.uk/';
const DESCRIPTION = 'Last trailers in HD thanks to Dave.';
public function collectData(){
public function collectData()
{
$html = getSimpleHTMLDOM(static::URI)
or returnClientError('No results for this query.');
@@ -17,7 +20,7 @@ class DavesTrailerPageBridge extends BridgeAbstract {
continue;
}
$item = array();
$item = [];
// title
$item['title'] = $tr->find('td', 0)->find('b', 0)->plaintext;

View File

@@ -1,47 +1,48 @@
<?php
class DealabsBridge extends PepperBridgeAbstract {
class DealabsBridge extends PepperBridgeAbstract
{
const NAME = 'Dealabs Bridge';
const URI = 'https://www.dealabs.com/';
const DESCRIPTION = 'Affiche les Deals de Dealabs';
const MAINTAINER = 'sysadminstory';
const PARAMETERS = array(
'Recherche par Mot(s) clé(s)' => array (
'q' => array(
const PARAMETERS = [
'Recherche par Mot(s) clé(s)' => [
'q' => [
'name' => 'Mot(s) clé(s)',
'type' => 'text',
'exampleValue' => 'lampe',
'required' => true
),
'hide_expired' => array(
],
'hide_expired' => [
'name' => 'Masquer les éléments expirés',
'type' => 'checkbox',
),
'hide_local' => array(
],
'hide_local' => [
'name' => 'Masquer les deals locaux',
'type' => 'checkbox',
'title' => 'Masquer les deals en magasins physiques',
),
'priceFrom' => array(
],
'priceFrom' => [
'name' => 'Prix minimum',
'type' => 'text',
'title' => 'Prix mnimum en euros',
'required' => false
),
'priceTo' => array(
],
'priceTo' => [
'name' => 'Prix maximum',
'type' => 'text',
'title' => 'Prix maximum en euros',
'required' => false
),
),
],
],
'Deals par groupe' => array(
'group' => array(
'Deals par groupe' => [
'group' => [
'name' => 'Groupe',
'type' => 'list',
'title' => 'Groupe dont il faut afficher les deals',
'values' => array(
'values' => [
'Abattants WC' => 'abattants-wc',
'Abonnement PlayStation Plus' => 'playstation-plus',
'Abonnements cinéma' => 'abonnements-cinema',
@@ -1868,42 +1869,42 @@ class DealabsBridge extends PepperBridgeAbstract {
'Yeelight' => 'xiaomi-yeelight',
'Yoshi&#039;s Crafted World' => 'yoshi-crafted-world',
'Zoos' => 'zoos',
)
),
'order' => array(
]
],
'order' => [
'name' => 'Trier par',
'type' => 'list',
'title' => 'Ordre de tri des deals',
'values' => array(
'values' => [
'Du deal le plus Hot au moins Hot' => '-hot',
'Du deal le plus récent au plus ancien' => '-nouveaux',
)
)
),
'Surveillance Discussion' => array(
'url' => array(
]
]
],
'Surveillance Discussion' => [
'url' => [
'name' => 'URL de la discussion',
'type' => 'text',
'required' => true,
'title' => 'URL discussion à surveiller: https://www.dealabs.com/discussions/titre-1234',
'exampleValue' => 'https://www.dealabs.com/discussions/jeux-steam-gratuits-gleam-woobox-etc-1071415',
),
],
'only_with_url' => array(
'only_with_url' => [
'name' => 'Exclure les commentaires sans URL',
'type' => 'checkbox',
'title' => 'Exclure les commentaires ne contenant pas d\'URL dans le flux',
'defaultValue' => false,
)
]
)
]
);
];
public $lang = array(
'bridge-uri' => SELF::URI,
'bridge-name' => SELF::NAME,
public $lang = [
'bridge-uri' => self::URI,
'bridge-name' => self::NAME,
'context-keyword' => 'Recherche par Mot(s) clé(s)',
'context-group' => 'Deals par groupe',
'context-talk' => 'Surveillance Discussion',
@@ -1911,9 +1912,9 @@ class DealabsBridge extends PepperBridgeAbstract {
'request-error' => 'Impossible de joindre Dealabs',
'thread-error' => 'Impossible de déterminer l\'ID de la discussion. Vérifiez l\'URL que vous avez entré',
'no-results' => 'Il n&#039;y a rien à afficher pour le moment :(',
'relative-date-indicator' => array(
'relative-date-indicator' => [
'il y a',
),
],
'price' => 'Prix',
'shipping' => 'Livraison',
'origin' => 'Origine',
@@ -1921,7 +1922,7 @@ class DealabsBridge extends PepperBridgeAbstract {
'title-keyword' => 'Recherche',
'title-group' => 'Groupe',
'title-talk' => 'Surveillance Discussion',
'local-months' => array(
'local-months' => [
'janvier',
'février',
'mars',
@@ -1934,8 +1935,8 @@ class DealabsBridge extends PepperBridgeAbstract {
'octobre',
'novembre',
'décembre'
),
'local-time-relative' => array(
],
'local-time-relative' => [
'il y a ',
'min',
'h',
@@ -1944,22 +1945,19 @@ class DealabsBridge extends PepperBridgeAbstract {
'mois',
'ans',
'et '
),
'date-prefixes' => array(
],
'date-prefixes' => [
'Actualisé ',
),
'relative-date-alt-prefixes' => array(
],
'relative-date-alt-prefixes' => [
'Actualisé ',
),
'relative-date-ignore-suffix' => array(
),
],
'relative-date-ignore-suffix' => [
],
'localdeal' => array(
'localdeal' => [
'Local',
'Pays d\'expédition'
),
);
],
];
}

Some files were not shown because too many files have changed in this diff Show More