mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-17 22:02:09 +02:00
Compare commits
246 Commits
2018-11-10
...
2019-06-08
Author | SHA1 | Date | |
---|---|---|---|
|
c17b864242 | ||
|
5ff3d0121c | ||
|
f00a054e0f | ||
|
5a9519967b | ||
|
17f587fcbe | ||
|
f28cbecc02 | ||
|
84450371b5 | ||
|
69dd33ac82 | ||
|
95388cdf44 | ||
|
b74dda7af9 | ||
|
ca1a5feba5 | ||
|
69a0498732 | ||
|
3d231a417f | ||
|
35bd706391 | ||
|
0e30468e0f | ||
|
ccf375e917 | ||
|
946a99d334 | ||
|
e2e0ced055 | ||
|
d4e867f240 | ||
|
b0a780acda | ||
|
1814116d67 | ||
|
d89326fe2d | ||
|
62198ecfa2 | ||
|
94e4ef8f27 | ||
|
6c4098d655 | ||
|
468d8be72d | ||
|
ed539bacf9 | ||
|
82a9bb5b1c | ||
|
15c374e317 | ||
|
052844f5e1 | ||
|
014b698f67 | ||
|
5656792cee | ||
|
66c5b732cf | ||
|
b889e867fd | ||
|
b519d350bf | ||
|
2a254855d8 | ||
|
72bcc173eb | ||
|
4a60f05fd6 | ||
|
84d48d5614 | ||
|
7cf898b5af | ||
|
16bd2aec7a | ||
|
3d87ecbf8c | ||
|
2cd310c025 | ||
|
b764204c3a | ||
|
a9e2574016 | ||
|
e3f6e1c6db | ||
|
8150a73922 | ||
|
a2f3866383 | ||
|
a3446ae77b | ||
|
75359bc11b | ||
|
fe103974f5 | ||
|
33c16f8be5 | ||
|
21d3bf3b60 | ||
|
3b8f3da09d | ||
|
f9c4a84c25 | ||
|
7b8dd93a8e | ||
|
8f5151b222 | ||
|
98c2530984 | ||
|
90bf90d167 | ||
|
6feda2220e | ||
|
92775abe11 | ||
|
24cdeabed8 | ||
|
380fdf2e40 | ||
|
50c90eb5df | ||
|
d9ee9e272e | ||
|
4ba0d8bebe | ||
|
c9b0cd1315 | ||
|
2dc0c36e9b | ||
|
0aa8858551 | ||
|
966d450d27 | ||
|
291e8c2a23 | ||
|
b6943de0ca | ||
|
b9bbc9bdda | ||
|
835e3b1163 | ||
|
3212156925 | ||
|
281eaacaeb | ||
|
18d5ef192c | ||
|
6293c3d33d | ||
|
835af1faf1 | ||
|
88aae6fd95 | ||
|
684558e276 | ||
|
d7094b7feb | ||
|
ae2c35c18a | ||
|
5b80bcaa04 | ||
|
5ea985164e | ||
|
696afa96d3 | ||
|
326a707739 | ||
|
1ac66b3fdc | ||
|
f450b2e118 | ||
|
688c950916 | ||
|
9d85b951f7 | ||
|
dac685b887 | ||
|
d37f0c14a0 | ||
|
b96c25a3af | ||
|
dc1b1b13cc | ||
|
e3588f62bd | ||
|
958ba815c7 | ||
|
3d24596a52 | ||
|
f9ed934c8c | ||
|
777c204838 | ||
|
ae40f7b388 | ||
|
473a62ed44 | ||
|
4c58768d4d | ||
|
ca9c2abb60 | ||
|
556a417dd6 | ||
|
51ee541d5a | ||
|
69cb65c1af | ||
|
29b187fc12 | ||
|
80f6a8b3d4 | ||
|
32d4da8b76 | ||
|
0063d2c376 | ||
|
11a39af35c | ||
|
f65a4076ba | ||
|
25593d9c18 | ||
|
394149b114 | ||
|
a29512deee | ||
|
e0db349a57 | ||
|
d532d0e0c4 | ||
|
434c12672f | ||
|
ab2e566ee1 | ||
|
493e76e4b9 | ||
|
37d882a8d5 | ||
|
bcd7bccc46 | ||
|
2def7a04a3 | ||
|
3c5b23daa6 | ||
|
ef6709c402 | ||
|
fc96e97d51 | ||
|
600f2290b6 | ||
|
245af35a60 | ||
|
ef4923ae5c | ||
|
18229b5c70 | ||
|
3160e62293 | ||
|
f81d1b0846 | ||
|
8801ac9e64 | ||
|
288d4de218 | ||
|
f3f33cabed | ||
|
3e45643418 | ||
|
719320e1a4 | ||
|
81ee15a161 | ||
|
988635dcf3 | ||
|
4095cad9b4 | ||
|
e7d3a006c8 | ||
|
ce65f51d91 | ||
|
4b22862295 | ||
|
185a773e74 | ||
|
10659dd453 | ||
|
6b2a45c1e8 | ||
|
6e4b6fa1cc | ||
|
0cad5f24e6 | ||
|
cb6ad7c077 | ||
|
4438807b26 | ||
|
6c1d861529 | ||
|
dc83962483 | ||
|
bb2329fa3a | ||
|
758f37b452 | ||
|
fb8a064e3a | ||
|
b00971b2c3 | ||
|
a07ead42a7 | ||
|
a11ade3442 | ||
|
3932e7b8ef | ||
|
5305c405f6 | ||
|
1c58c04271 | ||
|
89218f1da6 | ||
|
30e2b79c38 | ||
|
2184f523cd | ||
|
242b6953ed | ||
|
bdcb7a9829 | ||
|
f4b46e497e | ||
|
d5085a4116 | ||
|
d7cabfca54 | ||
|
de575982a1 | ||
|
3d301fc4ee | ||
|
263e8872ea | ||
|
6e9c188a72 | ||
|
49da67cb33 | ||
|
b4dbd191d0 | ||
|
e09f452426 | ||
|
7b261d1cc2 | ||
|
96a518c9e7 | ||
|
0d2ea9a677 | ||
|
66e82e46db | ||
|
54800fcc8d | ||
|
67004556e6 | ||
|
c6a7b9ac64 | ||
|
dbffbd4d4e | ||
|
1c17ffb5c4 | ||
|
326cfb21cf | ||
|
8ab1fb86a9 | ||
|
a9ec3d0d1f | ||
|
ac5bcb62ec | ||
|
f24ab8b51b | ||
|
4348119adf | ||
|
fd4124cda2 | ||
|
91f7405297 | ||
|
85685b7758 | ||
|
41d02554f3 | ||
|
c4550be812 | ||
|
b29ba5b973 | ||
|
254fe9212a | ||
|
3806895059 | ||
|
599d438a0d | ||
|
e5a6baab96 | ||
|
b47a30ecc1 | ||
|
860b36c1e3 | ||
|
3d475572c6 | ||
|
59f2d755fe | ||
|
d7c374bd8c | ||
|
6b6ab6486a | ||
|
6c4e239f64 | ||
|
88b0656954 | ||
|
66b11b8c41 | ||
|
1b34d9860e | ||
|
6e70d461e1 | ||
|
0a92b5d29b | ||
|
e3849f45ab | ||
|
3d9c4a3718 | ||
|
5f146a257e | ||
|
936688e08c | ||
|
4b5372638c | ||
|
6f4a8f4d03 | ||
|
39652bb050 | ||
|
fcac5b8b92 | ||
|
6f7b56cba8 | ||
|
86ac0a4866 | ||
|
4a99c6e630 | ||
|
e8442a3bf8 | ||
|
427688fd67 | ||
|
4a6b3654eb | ||
|
5f867c00b4 | ||
|
c15b25a07d | ||
|
c296e73c18 | ||
|
007ee4d858 | ||
|
dd95ec6200 | ||
|
d951000c23 | ||
|
51634a72e0 | ||
|
78c69b08f0 | ||
|
3bb3353897 | ||
|
e26d61ec0a | ||
|
a0490e3673 | ||
|
c63af2e7ad | ||
|
9379854f7a | ||
|
ecdac1b089 | ||
|
2104fc4d58 | ||
|
697d63bb96 | ||
|
2bb13169b4 | ||
|
4713fb6190 |
@@ -1,7 +1,14 @@
|
||||
.git
|
||||
.gitattributes
|
||||
.github/*
|
||||
.travis.yml
|
||||
cache/*
|
||||
CONTRIBUTING.md
|
||||
DEBUG
|
||||
Dockerfile
|
||||
whitelist.txt
|
||||
phpcompatibility.xml
|
||||
phpcs.xml
|
||||
CONTRIBUTING.md
|
||||
phpcs.xml
|
||||
scalingo.json
|
||||
tests/*
|
||||
whitelist.txt
|
47
.gitattributes
vendored
47
.gitattributes
vendored
@@ -10,13 +10,40 @@
|
||||
*.dbproj merge=union
|
||||
|
||||
# Standard to msysgit
|
||||
*.doc diff=astextplain
|
||||
*.DOC diff=astextplain
|
||||
*.docx diff=astextplain
|
||||
*.DOCX diff=astextplain
|
||||
*.dot diff=astextplain
|
||||
*.DOT diff=astextplain
|
||||
*.pdf diff=astextplain
|
||||
*.PDF diff=astextplain
|
||||
*.rtf diff=astextplain
|
||||
*.RTF diff=astextplain
|
||||
*.doc diff=astextplain
|
||||
*.DOC diff=astextplain
|
||||
*.docx diff=astextplain
|
||||
*.DOCX diff=astextplain
|
||||
*.dot diff=astextplain
|
||||
*.DOT diff=astextplain
|
||||
*.pdf diff=astextplain
|
||||
*.PDF diff=astextplain
|
||||
*.rtf diff=astextplain
|
||||
*.RTF diff=astextplain
|
||||
|
||||
# Ignore files in git archive (i.e. GitHub release builds)
|
||||
## Docker
|
||||
Dockerfile export-ignore
|
||||
.dockerignore export-ignore
|
||||
## Travis
|
||||
.travis.yml export-ignore
|
||||
## GitHub
|
||||
.github/ export-ignore
|
||||
## Git
|
||||
.gitattributes export-ignore
|
||||
.gitignore export-ignore
|
||||
## Scalingo
|
||||
scalingo.json export-ignore
|
||||
## RSS-Bridge
|
||||
phpunit.xml export-ignore
|
||||
phpcs.xml export-ignore
|
||||
phpcompatibility.xml export-ignore
|
||||
tests/ export-ignore
|
||||
cache/.gitkeep export-ignore
|
||||
bridges/DemoBridge.php export-ignore
|
||||
bridges/FeedExpanderExampleBridge.php export-ignore
|
||||
## Composer
|
||||
composer.json export-ignore
|
||||
composer.lock export-ignore
|
||||
## Heroku
|
||||
app.json export-ignore
|
||||
|
2
.github/CONTRIBUTING.md
vendored
2
.github/CONTRIBUTING.md
vendored
@@ -43,5 +43,7 @@ Note that all pull-requests must pass all tests before they can be merged.
|
||||
* [Use PascalCase for class names](https://github.com/RSS-Bridge/rss-bridge/wiki/Classes#use-pascalcase-for-class-names)
|
||||
* [Do not use final statements inside final classes](https://github.com/RSS-Bridge/rss-bridge/wiki/Classes#do-not-use-final-statements-inside-final-classes)
|
||||
* [Do not override methods to call their parent](https://github.com/RSS-Bridge/rss-bridge/wiki/Classes#do-not-override-methods-to-call-their-parent)
|
||||
* [abstract and final declarations MUST precede the visibility declaration](https://github.com/RSS-Bridge/rss-bridge/wiki/Classes#abstract-and-final-declarations-must-precede-the-visibility-declaration)
|
||||
* [static declaration MUST come after the visibility declaration](https://github.com/RSS-Bridge/rss-bridge/wiki/Classes#static-declaration-must-come-after-the-visibility-declaration)
|
||||
* [Casting](https://github.com/RSS-Bridge/rss-bridge/wiki/Casting)
|
||||
* [Do not add spaces when casting](https://github.com/RSS-Bridge/rss-bridge/wiki/Casting#do-not-add-spaces-when-casting)
|
||||
|
@@ -1,6 +1,9 @@
|
||||
---
|
||||
name: Bridge request template
|
||||
name: Bridge request
|
||||
about: Use this template for requesting a new bridge
|
||||
title: Bridge request for ...
|
||||
labels: Bridge-Request
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
38
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
38
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: Bug-Report
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Desktop (please complete the following information):**
|
||||
- OS: [e.g. iOS]
|
||||
- Browser [e.g. chrome, safari]
|
||||
- Version [e.g. 22]
|
||||
|
||||
**Smartphone (please complete the following information):**
|
||||
- Device: [e.g. iPhone6]
|
||||
- OS: [e.g. iOS8.1]
|
||||
- Browser [e.g. stock browser, safari]
|
||||
- Version [e.g. 22]
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: Feature-Request
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
7
.gitignore
vendored
7
.gitignore
vendored
@@ -236,3 +236,10 @@ config.ini.php
|
||||
|
||||
#Builder
|
||||
.buildconfig
|
||||
|
||||
#Auth
|
||||
.htaccess
|
||||
.htpasswd
|
||||
|
||||
#Crawler
|
||||
robots.txt
|
||||
|
47
.travis.yml
47
.travis.yml
@@ -1,45 +1,46 @@
|
||||
dist: trusty
|
||||
sudo: false
|
||||
language: php
|
||||
|
||||
install:
|
||||
- composer global require dealerdirect/phpcodesniffer-composer-installer;
|
||||
- composer global require phpcompatibility/php-compatibility;
|
||||
# Use PHPUnit 6 for unit tests (stable), requires PHP 7
|
||||
- if [[ $TRAVIS_PHP_VERSION == "7.0" ]]; then
|
||||
composer global require phpunit/phpunit ^6;
|
||||
fi
|
||||
# Use latest PHPUnit on nightly to detect breaking changes
|
||||
- if [[ $TRAVIS_PHP_VERSION == "nightly" ]]; then
|
||||
composer global require phpunit/phpunit;
|
||||
- if [[ "$PHPUNIT" ]]; then
|
||||
composer global require phpunit/phpunit ^$PHPUNIT;
|
||||
fi
|
||||
|
||||
script:
|
||||
- phpenv rehash
|
||||
# Run PHP_CodeSniffer on all versions
|
||||
- ~/.composer/vendor/bin/phpcs . --standard=phpcs.xml --warning-severity=0 --extensions=php -p;
|
||||
# Check PHP compatibility for the lowest supported version
|
||||
- if [[ $TRAVIS_PHP_VERSION == "5.6" ]]; then
|
||||
~/.composer/vendor/bin/phpcs . --standard=phpcompatibility.xml --warning-severity=0 --extensions=php -p;
|
||||
- ~/.config/composer/vendor/bin/phpcs . --standard=phpcs.xml --warning-severity=0 --extensions=php -p;
|
||||
# Check PHP compatibility for the lowest and highest supported version
|
||||
- if [[ $TRAVIS_PHP_VERSION == "5.6" || $TRAVIS_PHP_VERSION == "7.3" ]]; then
|
||||
~/.config/composer/vendor/bin/phpcs . --standard=phpcompatibility.xml --extensions=php -p;
|
||||
fi
|
||||
# Run unit tests (stable)
|
||||
- if [[ $TRAVIS_PHP_VERSION == "7.0" ]]; then
|
||||
phpunit --configuration=phpunit.xml --include-path=lib/;
|
||||
fi
|
||||
# Run unit tests (latest/nightly)
|
||||
# Check PHP compatibility for all versions, starting at the lowest supported version in order to detect breaking changes
|
||||
- if [[ $TRAVIS_PHP_VERSION == "nightly" ]]; then
|
||||
phpunit --configuration=phpunit.xml --include-path=lib/;
|
||||
~/.composer/vendor/bin/phpcs . --standard=PHPCompatibility --warning-severity=0 --extensions=php -p --runtime-set testVersion 5.6-;
|
||||
# Run unit tests on highest major version
|
||||
- if [[ ${TRAVIS_PHP_VERSION:0:1} == "7" ]]; then
|
||||
~/.config/composer/vendor/bin/phpunit --configuration=phpunit.xml --include-path=lib/;
|
||||
fi
|
||||
|
||||
php:
|
||||
- 7.3
|
||||
|
||||
env:
|
||||
- PHPUNIT=6
|
||||
- PHPUNIT=7
|
||||
- PHPUNIT=8
|
||||
|
||||
matrix:
|
||||
fast_finish: true
|
||||
|
||||
include:
|
||||
- php: 5.6
|
||||
env: PHPUNIT=
|
||||
- php: 7.0
|
||||
- php: nightly
|
||||
- php: 7.1
|
||||
- php: 7.2
|
||||
|
||||
allow_failures:
|
||||
- php: nightly
|
||||
- php: 7.3
|
||||
env: PHPUNIT=7
|
||||
- php: 7.3
|
||||
env: PHPUNIT=8
|
||||
|
12
Dockerfile
12
Dockerfile
@@ -1,5 +1,11 @@
|
||||
FROM ulsmith/alpine-apache-php7
|
||||
FROM php:7-apache
|
||||
|
||||
COPY ./ /app/public/
|
||||
ENV APACHE_DOCUMENT_ROOT=/app
|
||||
|
||||
RUN chown -R apache:root /app/public
|
||||
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" \
|
||||
&& apt-get --yes update && apt-get --yes install libxml2-dev \
|
||||
&& docker-php-ext-install -j$(nproc) simplexml \
|
||||
&& sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf \
|
||||
&& sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
|
||||
|
||||
COPY --chown=www-data:www-data ./ /app/
|
189
README.md
189
README.md
@@ -66,6 +66,7 @@ RSS-Bridge requires PHP 5.6 or higher with following extensions enabled:
|
||||
- [`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)
|
||||
- [`sqlite3`](http://php.net/manual/en/book.sqlite3.php) (only when using SQLiteCache)
|
||||
|
||||
Find more information on our [Wiki](https://github.com/rss-bridge/rss-bridge/wiki)
|
||||
|
||||
@@ -84,7 +85,7 @@ Deploy
|
||||
Thanks to the community, hosting your own instance of RSS-Bridge is as easy as clicking a button!
|
||||
|
||||
[](https://my.scalingo.com/deploy?source=https://github.com/sebsauvage/rss-bridge)
|
||||
[](https://cloud.docker.com/stack/deploy/?repo=https://github.com/rss-bridge/rss-bridge)
|
||||
[](https://heroku.com/deploy)
|
||||
|
||||
Getting involved
|
||||
===
|
||||
@@ -110,88 +111,110 @@ Use this script to generate the list automatically (using the GitHub API):
|
||||
https://gist.github.com/LogMANOriginal/da00cd1e5f0ca31cef8e193509b17fd8
|
||||
-->
|
||||
|
||||
* [16mhz](https://api.github.com/users/16mhz)
|
||||
* [Ahiles3005](https://api.github.com/users/Ahiles3005)
|
||||
* [Albirew](https://api.github.com/users/Albirew)
|
||||
* [AmauryCarrade](https://api.github.com/users/AmauryCarrade)
|
||||
* [ArthurHoaro](https://api.github.com/users/ArthurHoaro)
|
||||
* [Astalaseven](https://api.github.com/users/Astalaseven)
|
||||
* [Astyan-42](https://api.github.com/users/Astyan-42)
|
||||
* [Daiyousei](https://api.github.com/users/Daiyousei)
|
||||
* [Djuuu](https://api.github.com/users/Djuuu)
|
||||
* [Draeli](https://api.github.com/users/Draeli)
|
||||
* [EtienneM](https://api.github.com/users/EtienneM)
|
||||
* [Frenzie](https://api.github.com/users/Frenzie)
|
||||
* [Ginko-Aloe](https://api.github.com/users/Ginko-Aloe)
|
||||
* [Glandos](https://api.github.com/users/Glandos)
|
||||
* [GregThib](https://api.github.com/users/GregThib)
|
||||
* [Grummfy](https://api.github.com/users/Grummfy)
|
||||
* [JackNUMBER](https://api.github.com/users/JackNUMBER)
|
||||
* [JeremyRand](https://api.github.com/users/JeremyRand)
|
||||
* [Jocker666z](https://api.github.com/users/Jocker666z)
|
||||
* [LogMANOriginal](https://api.github.com/users/LogMANOriginal)
|
||||
* [MonsieurPoutounours](https://api.github.com/users/MonsieurPoutounours)
|
||||
* [ORelio](https://api.github.com/users/ORelio)
|
||||
* [PaulVayssiere](https://api.github.com/users/PaulVayssiere)
|
||||
* [Piranhaplant](https://api.github.com/users/Piranhaplant)
|
||||
* [Riduidel](https://api.github.com/users/Riduidel)
|
||||
* [Strubbl](https://api.github.com/users/Strubbl)
|
||||
* [TheRadialActive](https://api.github.com/users/TheRadialActive)
|
||||
* [TwizzyDizzy](https://api.github.com/users/TwizzyDizzy)
|
||||
* [WalterBarrett](https://api.github.com/users/WalterBarrett)
|
||||
* [ZeNairolf](https://api.github.com/users/ZeNairolf)
|
||||
* [adamchainz](https://api.github.com/users/adamchainz)
|
||||
* [aledeg](https://api.github.com/users/aledeg)
|
||||
* [alexAubin](https://api.github.com/users/alexAubin)
|
||||
* [az5he6ch](https://api.github.com/users/az5he6ch)
|
||||
* [b1nj](https://api.github.com/users/b1nj)
|
||||
* [benasse](https://api.github.com/users/benasse)
|
||||
* [captn3m0](https://api.github.com/users/captn3m0)
|
||||
* [chemel](https://api.github.com/users/chemel)
|
||||
* [ckiw](https://api.github.com/users/ckiw)
|
||||
* [cnlpete](https://api.github.com/users/cnlpete)
|
||||
* [corenting](https://api.github.com/users/corenting)
|
||||
* [da2x](https://api.github.com/users/da2x)
|
||||
* [eMerzh](https://api.github.com/users/eMerzh)
|
||||
* [em92](https://api.github.com/users/em92)
|
||||
* [griffaurel](https://api.github.com/users/griffaurel)
|
||||
* [hunhejj](https://api.github.com/users/hunhejj)
|
||||
* [j0k3r](https://api.github.com/users/j0k3r)
|
||||
* [jdigilio](https://api.github.com/users/jdigilio)
|
||||
* [kranack](https://api.github.com/users/kranack)
|
||||
* [kraoc](https://api.github.com/users/kraoc)
|
||||
* [laBecasse](https://api.github.com/users/laBecasse)
|
||||
* [lagaisse](https://api.github.com/users/lagaisse)
|
||||
* [lalannev](https://api.github.com/users/lalannev)
|
||||
* [ldidry](https://api.github.com/users/ldidry)
|
||||
* [m0zes](https://api.github.com/users/m0zes)
|
||||
* [matthewseal](https://api.github.com/users/matthewseal)
|
||||
* [mcbyte-it](https://api.github.com/users/mcbyte-it)
|
||||
* [mdemoss](https://api.github.com/users/mdemoss)
|
||||
* [melangue](https://api.github.com/users/melangue)
|
||||
* [metaMMA](https://api.github.com/users/metaMMA)
|
||||
* [mickael-bertrand](https://api.github.com/users/mickael-bertrand)
|
||||
* [mitsukarenai](https://api.github.com/users/mitsukarenai)
|
||||
* [mro](https://api.github.com/users/mro)
|
||||
* [mxmehl](https://api.github.com/users/mxmehl)
|
||||
* [nel50n](https://api.github.com/users/nel50n)
|
||||
* [niawag](https://api.github.com/users/niawag)
|
||||
* [pellaeon](https://api.github.com/users/pellaeon)
|
||||
* [pit-fgfjiudghdf](https://api.github.com/users/pit-fgfjiudghdf)
|
||||
* [pitchoule](https://api.github.com/users/pitchoule)
|
||||
* [pmaziere](https://api.github.com/users/pmaziere)
|
||||
* [prysme01](https://api.github.com/users/prysme01)
|
||||
* [quentinus95](https://api.github.com/users/quentinus95)
|
||||
* [qwertygc](https://api.github.com/users/qwertygc)
|
||||
* [regisenguehard](https://api.github.com/users/regisenguehard)
|
||||
* [rogerdc](https://api.github.com/users/rogerdc)
|
||||
* [sebsauvage](https://api.github.com/users/sebsauvage)
|
||||
* [sublimz](https://api.github.com/users/sublimz)
|
||||
* [sysadminstory](https://api.github.com/users/sysadminstory)
|
||||
* [tameroski](https://api.github.com/users/tameroski)
|
||||
* [teromene](https://api.github.com/users/teromene)
|
||||
* [triatic](https://api.github.com/users/triatic)
|
||||
* [wtuuju](https://api.github.com/users/wtuuju)
|
||||
* [16mhz](https://github.com/16mhz)
|
||||
* [adamchainz](https://github.com/adamchainz)
|
||||
* [Ahiles3005](https://github.com/Ahiles3005)
|
||||
* [Albirew](https://github.com/Albirew)
|
||||
* [aledeg](https://github.com/aledeg)
|
||||
* [alex73](https://github.com/alex73)
|
||||
* [alexAubin](https://github.com/alexAubin)
|
||||
* [AmauryCarrade](https://github.com/AmauryCarrade)
|
||||
* [ArthurHoaro](https://github.com/ArthurHoaro)
|
||||
* [Astalaseven](https://github.com/Astalaseven)
|
||||
* [Astyan-42](https://github.com/Astyan-42)
|
||||
* [az5he6ch](https://github.com/az5he6ch)
|
||||
* [azdkj532](https://github.com/azdkj532)
|
||||
* [b1nj](https://github.com/b1nj)
|
||||
* [benasse](https://github.com/benasse)
|
||||
* [captn3m0](https://github.com/captn3m0)
|
||||
* [chemel](https://github.com/chemel)
|
||||
* [ckiw](https://github.com/ckiw)
|
||||
* [cnlpete](https://github.com/cnlpete)
|
||||
* [corenting](https://github.com/corenting)
|
||||
* [couraudt](https://github.com/couraudt)
|
||||
* [da2x](https://github.com/da2x)
|
||||
* [Daiyousei](https://github.com/Daiyousei)
|
||||
* [disk0x](https://github.com/disk0x)
|
||||
* [DJCrashdummy](https://github.com/DJCrashdummy)
|
||||
* [Djuuu](https://github.com/Djuuu)
|
||||
* [DnAp](https://github.com/DnAp)
|
||||
* [Draeli](https://github.com/Draeli)
|
||||
* [Dreckiger-Dan](https://github.com/Dreckiger-Dan)
|
||||
* [em92](https://github.com/em92)
|
||||
* [eMerzh](https://github.com/eMerzh)
|
||||
* [EtienneM](https://github.com/EtienneM)
|
||||
* [fluffy-critter](https://github.com/fluffy-critter)
|
||||
* [Frenzie](https://github.com/Frenzie)
|
||||
* [fulmeek](https://github.com/fulmeek)
|
||||
* [Ginko-Aloe](https://github.com/Ginko-Aloe)
|
||||
* [Glandos](https://github.com/Glandos)
|
||||
* [GregThib](https://github.com/GregThib)
|
||||
* [griffaurel](https://github.com/griffaurel)
|
||||
* [Grummfy](https://github.com/Grummfy)
|
||||
* [hunhejj](https://github.com/hunhejj)
|
||||
* [j0k3r](https://github.com/j0k3r)
|
||||
* [JackNUMBER](https://github.com/JackNUMBER)
|
||||
* [jdigilio](https://github.com/jdigilio)
|
||||
* [JeremyRand](https://github.com/JeremyRand)
|
||||
* [Jocker666z](https://github.com/Jocker666z)
|
||||
* [killruana](https://github.com/killruana)
|
||||
* [klimplant](https://github.com/klimplant)
|
||||
* [kranack](https://github.com/kranack)
|
||||
* [kraoc](https://github.com/kraoc)
|
||||
* [l1n](https://github.com/l1n)
|
||||
* [laBecasse](https://github.com/laBecasse)
|
||||
* [lagaisse](https://github.com/lagaisse)
|
||||
* [lalannev](https://github.com/lalannev)
|
||||
* [ldidry](https://github.com/ldidry)
|
||||
* [Limero](https://github.com/Limero)
|
||||
* [LogMANOriginal](https://github.com/LogMANOriginal)
|
||||
* [lorenzos](https://github.com/lorenzos)
|
||||
* [m0zes](https://github.com/m0zes)
|
||||
* [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)
|
||||
* [mitsukarenai](https://github.com/mitsukarenai)
|
||||
* [MonsieurPoutounours](https://github.com/MonsieurPoutounours)
|
||||
* [mr-flibble](https://github.com/mr-flibble)
|
||||
* [mro](https://github.com/mro)
|
||||
* [mxmehl](https://github.com/mxmehl)
|
||||
* [nel50n](https://github.com/nel50n)
|
||||
* [niawag](https://github.com/niawag)
|
||||
* [Nono-m0le](https://github.com/Nono-m0le)
|
||||
* [ObsidianWitch](https://github.com/ObsidianWitch)
|
||||
* [ORelio](https://github.com/ORelio)
|
||||
* [PaulVayssiere](https://github.com/PaulVayssiere)
|
||||
* [pellaeon](https://github.com/pellaeon)
|
||||
* [Piranhaplant](https://github.com/Piranhaplant)
|
||||
* [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)
|
||||
* [quentinus95](https://github.com/quentinus95)
|
||||
* [regisenguehard](https://github.com/regisenguehard)
|
||||
* [Riduidel](https://github.com/Riduidel)
|
||||
* [rogerdc](https://github.com/rogerdc)
|
||||
* [Roliga](https://github.com/Roliga)
|
||||
* [sebsauvage](https://github.com/sebsauvage)
|
||||
* [somini](https://github.com/somini)
|
||||
* [squeek502](https://github.com/squeek502)
|
||||
* [Strubbl](https://github.com/Strubbl)
|
||||
* [sublimz](https://github.com/sublimz)
|
||||
* [sysadminstory](https://github.com/sysadminstory)
|
||||
* [tameroski](https://github.com/tameroski)
|
||||
* [teromene](https://github.com/teromene)
|
||||
* [thefranke](https://github.com/thefranke)
|
||||
* [TheRadialActive](https://github.com/TheRadialActive)
|
||||
* [triatic](https://github.com/triatic)
|
||||
* [VerifiedJoseph](https://github.com/VerifiedJoseph)
|
||||
* [WalterBarrett](https://github.com/WalterBarrett)
|
||||
* [wtuuju](https://github.com/wtuuju)
|
||||
* [xurxof](https://github.com/xurxof)
|
||||
* [yardenac](https://github.com/yardenac)
|
||||
* [ZeNairolf](https://github.com/ZeNairolf)
|
||||
|
||||
Licenses
|
||||
===
|
||||
|
50
actions/DetectAction.php
Normal file
50
actions/DetectAction.php
Normal 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 DetectAction extends ActionAbstract {
|
||||
public function execute() {
|
||||
$targetURL = $this->userData['url']
|
||||
or returnClientError('You must specify a url!');
|
||||
|
||||
$format = $this->userData['format']
|
||||
or returnClientError('You must specify a format!');
|
||||
|
||||
foreach(Bridge::getBridgeNames() as $bridgeName) {
|
||||
|
||||
if(!Bridge::isWhitelisted($bridgeName)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$bridge = Bridge::create($bridgeName);
|
||||
|
||||
if($bridge === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$bridgeParams = $bridge->detectParameters($targetURL);
|
||||
|
||||
if(is_null($bridgeParams)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$bridgeParams['bridge'] = $bridgeName;
|
||||
$bridgeParams['format'] = $format;
|
||||
|
||||
header('Location: ?action=display&' . http_build_query($bridgeParams), true, 301);
|
||||
die();
|
||||
|
||||
}
|
||||
|
||||
returnClientError('No bridge found for given URL: ' . $targetURL);
|
||||
}
|
||||
}
|
234
actions/DisplayAction.php
Normal file
234
actions/DisplayAction.php
Normal file
@@ -0,0 +1,234 @@
|
||||
<?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 DisplayAction extends ActionAbstract {
|
||||
public function execute() {
|
||||
$bridge = array_key_exists('bridge', $this->userData) ? $this->userData['bridge'] : null;
|
||||
|
||||
$format = $this->userData['format']
|
||||
or returnClientError('You must specify a format!');
|
||||
|
||||
// DEPRECATED: 'nameFormat' scheme is replaced by 'name' in format parameter values
|
||||
// this is to keep compatibility until futher complete removal
|
||||
if(($pos = strpos($format, 'Format')) === (strlen($format) - strlen('Format'))) {
|
||||
$format = substr($format, 0, $pos);
|
||||
}
|
||||
|
||||
// whitelist control
|
||||
if(!Bridge::isWhitelisted($bridge)) {
|
||||
throw new \Exception('This bridge is not whitelisted', 401);
|
||||
die;
|
||||
}
|
||||
|
||||
// Data retrieval
|
||||
$bridge = Bridge::create($bridge);
|
||||
|
||||
$noproxy = array_key_exists('_noproxy', $this->userData)
|
||||
&& filter_var($this->userData['_noproxy'], FILTER_VALIDATE_BOOLEAN);
|
||||
|
||||
if(defined('PROXY_URL') && PROXY_BYBRIDGE && $noproxy) {
|
||||
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);
|
||||
|
||||
} else {
|
||||
$cache_timeout = $bridge->getCacheTimeout();
|
||||
}
|
||||
|
||||
// Remove parameters that don't concern bridges
|
||||
$bridge_params = array_diff_key(
|
||||
$this->userData,
|
||||
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,
|
||||
array_fill_keys(
|
||||
array(
|
||||
'action',
|
||||
'format',
|
||||
'_noproxy',
|
||||
'_cache_timeout',
|
||||
'_error_time'
|
||||
), '')
|
||||
);
|
||||
|
||||
// Initialize cache
|
||||
$cache = Cache::create(Configuration::getConfig('cache', 'type'));
|
||||
$cache->setScope('');
|
||||
$cache->purgeCache(86400); // 24 hours
|
||||
$cache->setKey($cache_params);
|
||||
|
||||
$items = array();
|
||||
$infos = array();
|
||||
$mtime = $cache->getTime();
|
||||
|
||||
if($mtime !== false
|
||||
&& (time() - $cache_timeout < $mtime)
|
||||
&& !Debug::isEnabled()) { // Load cached data
|
||||
|
||||
// Send "Not Modified" response if client supports it
|
||||
// Implementation based on https://stackoverflow.com/a/10847262
|
||||
if(isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
|
||||
$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();
|
||||
}
|
||||
}
|
||||
|
||||
$cached = $cache->loadData();
|
||||
|
||||
if(isset($cached['items']) && isset($cached['extraInfos'])) {
|
||||
foreach($cached['items'] as $item) {
|
||||
$items[] = new \FeedItem($item);
|
||||
}
|
||||
|
||||
$infos = $cached['extraInfos'];
|
||||
}
|
||||
|
||||
} else { // Collect new data
|
||||
|
||||
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();
|
||||
|
||||
foreach($items as $item) {
|
||||
$feedItems[] = new \FeedItem($item);
|
||||
}
|
||||
|
||||
$items = $feedItems;
|
||||
}
|
||||
|
||||
$infos = array(
|
||||
'name' => $bridge->getName(),
|
||||
'uri' => $bridge->getURI(),
|
||||
'icon' => $bridge->getIcon()
|
||||
);
|
||||
} catch(Error $e) {
|
||||
error_log($e);
|
||||
|
||||
$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']
|
||||
. ')'
|
||||
);
|
||||
} else {
|
||||
$item->setTitle(
|
||||
'Bridge returned error '
|
||||
. $e->getCode()
|
||||
. '! ('
|
||||
. $this->userData['_error_time']
|
||||
. ')'
|
||||
);
|
||||
}
|
||||
|
||||
$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;
|
||||
} catch(Exception $e) {
|
||||
error_log($e);
|
||||
|
||||
$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;
|
||||
}
|
||||
|
||||
// Store data in cache
|
||||
$cache->saveData(array(
|
||||
'items' => array_map(function($i){ return $i->toArray(); }, $items),
|
||||
'extraInfos' => $infos
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
// Data transformation
|
||||
try {
|
||||
$format = Format::create($format);
|
||||
$format->setItems($items);
|
||||
$format->setExtraInfos($infos);
|
||||
$format->setLastModified($cache->getTime());
|
||||
$format->display();
|
||||
} 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));
|
||||
}
|
||||
}
|
||||
}
|
53
actions/ListAction.php
Normal file
53
actions/ListAction.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?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 ListAction extends ActionAbstract {
|
||||
public function execute() {
|
||||
$list = new StdClass();
|
||||
$list->bridges = array();
|
||||
$list->total = 0;
|
||||
|
||||
foreach(Bridge::getBridgeNames() as $bridgeName) {
|
||||
|
||||
$bridge = Bridge::create($bridgeName);
|
||||
|
||||
if($bridge === false) { // Broken bridge, show as inactive
|
||||
|
||||
$list->bridges[$bridgeName] = array(
|
||||
'status' => 'inactive'
|
||||
);
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
$status = Bridge::isWhitelisted($bridgeName) ? 'active' : 'inactive';
|
||||
|
||||
$list->bridges[$bridgeName] = array(
|
||||
'status' => $status,
|
||||
'uri' => $bridge->getURI(),
|
||||
'name' => $bridge->getName(),
|
||||
'icon' => $bridge->getIcon(),
|
||||
'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);
|
||||
}
|
||||
}
|
8
app.json
Normal file
8
app.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"service": "Heroku",
|
||||
"name": "RSS-Bridge",
|
||||
"description": "RSS-Bridge is a PHP project capable of generating RSS and Atom feeds for websites which don't have one.",
|
||||
"repository": "https://github.com/RSS-Bridge/rss-bridge",
|
||||
"keywords": ["php", "rss-bridge", "rss"]
|
||||
}
|
||||
|
121
bridges/AO3Bridge.php
Normal file
121
bridges/AO3Bridge.php
Normal file
@@ -0,0 +1,121 @@
|
||||
<?php
|
||||
|
||||
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(
|
||||
'name' => 'url',
|
||||
'required' => true,
|
||||
// Example: F/F tag, complete works only
|
||||
'exampleValue' => self::URI
|
||||
. 'works?work_search[complete]=T&tag_id=F*s*F',
|
||||
),
|
||||
),
|
||||
'Bookmarks' => array(
|
||||
'user' => array(
|
||||
'name' => 'user',
|
||||
'required' => true,
|
||||
// Example: Nyaaru's bookmarks
|
||||
'exampleValue' => 'Nyaaru',
|
||||
),
|
||||
),
|
||||
'Work' => array(
|
||||
'id' => array(
|
||||
'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) {
|
||||
$html = getSimpleHTMLDOM($url)
|
||||
or returnServerError('could not request AO3');
|
||||
$html = defaultLinkTo($html, self::URI);
|
||||
|
||||
foreach($html->find('.index.group > li') as $element) {
|
||||
$item = array();
|
||||
|
||||
$title = $element->find('div h4 a', 0);
|
||||
if (!isset($title)) continue; // discard deleted works
|
||||
$item['title'] = $title->plaintext;
|
||||
$item['content'] = $element;
|
||||
$item['uri'] = $title->href;
|
||||
|
||||
$strdate = $element->find('div p.datetime', 0)->plaintext;
|
||||
$item['timestamp'] = strtotime($strdate);
|
||||
|
||||
$chapters = $element->find('dl dd.chapters', 0);
|
||||
// bookmarked series and external works do not have a chapters count
|
||||
$chapters = (isset($chapters) ? $chapters->plaintext : 0);
|
||||
$item['uid'] = $item['uri'] . "/$strdate/$chapters";
|
||||
|
||||
$this->items[] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
// Feed for recent chapters of a specific work.
|
||||
private function collectWork($id) {
|
||||
$url = self::URI . "/works/$id/navigate";
|
||||
$html = getSimpleHTMLDOM($url)
|
||||
or returnServerError('could not request AO3');
|
||||
$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['title'] = $element->find('a', 0)->plaintext;
|
||||
$item['content'] = $element;
|
||||
$item['uri'] = $element->find('a', 0)->href;
|
||||
|
||||
$strdate = $element->find('span.datetime', 0)->plaintext;
|
||||
$strdate = str_replace('(', '', $strdate);
|
||||
$strdate = str_replace(')', '', $strdate);
|
||||
$item['timestamp'] = strtotime($strdate);
|
||||
|
||||
$item['uid'] = $item['uri'] . "/$strdate";
|
||||
|
||||
$this->items[] = $item;
|
||||
}
|
||||
|
||||
$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() {
|
||||
$name = parent::getName() . " $this->queriedContext";
|
||||
if (isset($this->title)) $name .= " - $this->title";
|
||||
return $name;
|
||||
}
|
||||
|
||||
public function getIcon() {
|
||||
return self::URI . '/favicon.ico';
|
||||
}
|
||||
}
|
@@ -21,5 +21,4 @@ class AcrimedBridge extends FeedExpander {
|
||||
|
||||
return $item;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -10,7 +10,6 @@ class AllocineFRBridge extends BridgeAbstract {
|
||||
'category' => array(
|
||||
'name' => 'category',
|
||||
'type' => 'list',
|
||||
'required' => true,
|
||||
'exampleValue' => 'Faux Raccord',
|
||||
'title' => 'Select your category',
|
||||
'values' => array(
|
||||
@@ -83,5 +82,4 @@ class AllocineFRBridge extends BridgeAbstract {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -16,7 +16,6 @@ class AmazonBridge extends BridgeAbstract {
|
||||
'sort' => array(
|
||||
'name' => 'Sort by',
|
||||
'type' => 'list',
|
||||
'required' => false,
|
||||
'values' => array(
|
||||
'Relevance' => 'relevanceblender',
|
||||
'Price: Low to High' => 'price-asc-rank',
|
||||
@@ -29,7 +28,6 @@ class AmazonBridge extends BridgeAbstract {
|
||||
'tld' => array(
|
||||
'name' => 'Country',
|
||||
'type' => 'list',
|
||||
'required' => true,
|
||||
'values' => array(
|
||||
'Australia' => 'com.au',
|
||||
'Brazil' => 'com.br',
|
||||
@@ -72,6 +70,9 @@ class AmazonBridge extends BridgeAbstract {
|
||||
|
||||
// Title
|
||||
$title = $element->find('h2', 0);
|
||||
if (is_null($title)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$item['title'] = html_entity_decode($title->innertext, ENT_QUOTES);
|
||||
|
||||
|
@@ -19,7 +19,6 @@ class AmazonPriceTrackerBridge extends BridgeAbstract {
|
||||
'tld' => array(
|
||||
'name' => 'Country',
|
||||
'type' => 'list',
|
||||
'required' => true,
|
||||
'values' => array(
|
||||
'Australia' => 'com.au',
|
||||
'Brazil' => 'com.br',
|
||||
|
@@ -137,5 +137,4 @@ class AnimeUltimeBridge extends BridgeAbstract {
|
||||
|
||||
return parent::getName();
|
||||
}
|
||||
|
||||
}
|
||||
|
62
bridges/AppleMusicBridge.php
Normal file
62
bridges/AppleMusicBridge.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
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 = 'Limero';
|
||||
const PARAMETERS = [[
|
||||
'url' => [
|
||||
'name' => 'Artist URL',
|
||||
'exampleValue' => 'https://itunes.apple.com/us/artist/dunderpatrullen/329796274',
|
||||
'required' => true,
|
||||
],
|
||||
'imgSize' => [
|
||||
'name' => 'Image size for thumbnails (in px)',
|
||||
'type' => 'number',
|
||||
'defaultValue' => 512,
|
||||
'required' => true,
|
||||
]
|
||||
]];
|
||||
const CACHE_TIMEOUT = 21600; // 6 hours
|
||||
|
||||
public function collectData() {
|
||||
$url = $this->getInput('url');
|
||||
$html = getSimpleHTMLDOM($url)
|
||||
or returnServerError('Could not request: ' . $url);
|
||||
|
||||
$imgSize = $this->getInput('imgSize');
|
||||
|
||||
// Grab the json data from the page
|
||||
$html = $html->find('script[id=shoebox-ember-data-store]', 0);
|
||||
$html = strstr($html, '{');
|
||||
$html = substr($html, 0, -9);
|
||||
$json = json_decode($html);
|
||||
|
||||
// Loop through each object
|
||||
foreach ($json->included as $obj) {
|
||||
if ($obj->type === 'lockup/album') {
|
||||
$this->items[] = [
|
||||
'title' => $obj->attributes->artistName . ' - ' . $obj->attributes->name,
|
||||
'uri' => $obj->attributes->url,
|
||||
'timestamp' => $obj->attributes->releaseDate,
|
||||
'enclosures' => $obj->relationships->artwork->data->id,
|
||||
];
|
||||
} elseif ($obj->type === 'image') {
|
||||
$images[$obj->id] = $obj->attributes->url;
|
||||
}
|
||||
}
|
||||
|
||||
// Add the images to each item
|
||||
foreach ($this->items as &$item) {
|
||||
$item['enclosures'] = [
|
||||
str_replace('{w}x{h}bb.{f}', $imgSize . 'x0w.jpg', $images[$item['enclosures']]),
|
||||
];
|
||||
}
|
||||
|
||||
// Sort the order to put the latest albums first
|
||||
usort($this->items, function($a, $b){
|
||||
return $a['timestamp'] < $b['timestamp'];
|
||||
});
|
||||
}
|
||||
}
|
93
bridges/ArtStationBridge.php
Normal file
93
bridges/ArtStationBridge.php
Normal file
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
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(
|
||||
'name' => 'Search term',
|
||||
'required' => true
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
public function getIcon() {
|
||||
return 'https://www.artstation.com/assets/favicon-58653022bc38c1905ac7aa1b10bffa6b.ico';
|
||||
}
|
||||
|
||||
public function getName() {
|
||||
return self::NAME . ': ' . $this->getInput('q');
|
||||
}
|
||||
|
||||
private function fetchSearch($searchQuery) {
|
||||
$data = '{"query":"' . $searchQuery . '","page":1,"per_page":50,"sorting":"date",';
|
||||
$data .= '"pro_first":"1","filters":[],"additional_fields":[]}';
|
||||
|
||||
$header = array(
|
||||
'Content-Type: application/json',
|
||||
'Accept: application/json'
|
||||
);
|
||||
|
||||
$opts = array(
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_POSTFIELDS => $data,
|
||||
CURLOPT_RETURNTRANSFER => true
|
||||
);
|
||||
|
||||
$jsonSearchURL = self::URI . '/api/v2/search/projects.json';
|
||||
$jsonSearchStr = getContents($jsonSearchURL, $header, $opts)
|
||||
or returnServerError('Could not fetch JSON for search query.');
|
||||
return json_decode($jsonSearchStr);
|
||||
}
|
||||
|
||||
private function fetchProject($hashID) {
|
||||
$jsonProjectURL = self::URI . '/projects/' . $hashID . '.json';
|
||||
$jsonProjectStr = getContents($jsonProjectURL)
|
||||
or returnServerError('Could not fetch JSON for project.');
|
||||
return json_decode($jsonProjectStr);
|
||||
}
|
||||
|
||||
public function collectData() {
|
||||
$searchTerm = $this->getInput('q');
|
||||
$jsonQuery = $this->fetchSearch($searchTerm);
|
||||
|
||||
foreach($jsonQuery->data as $media) {
|
||||
// get detailed info about media item
|
||||
$jsonProject = $this->fetchProject($media->hash_id);
|
||||
|
||||
// create item
|
||||
$item = array();
|
||||
$item['title'] = $media->title;
|
||||
$item['uri'] = $media->url;
|
||||
$item['timestamp'] = strtotime($jsonProject->published_at);
|
||||
$item['author'] = $media->user->full_name;
|
||||
$item['categories'] = implode(',', $jsonProject->tags);
|
||||
|
||||
$item['content'] = '<a href="'
|
||||
. $media->url
|
||||
. '"><img style="max-width: 100%" src="'
|
||||
. $jsonProject->cover_url
|
||||
. '"></a><p>'
|
||||
. $jsonProject->description
|
||||
. '</p>';
|
||||
|
||||
$numAssets = count($jsonProject->assets);
|
||||
|
||||
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)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
@@ -91,7 +91,8 @@ class Arte7Bridge extends BridgeAbstract {
|
||||
'Authorization: Bearer ' . self::API_TOKEN
|
||||
);
|
||||
|
||||
$input = getContents($url, $header) or die('Could not request ARTE.');
|
||||
$input = getContents($url, $header)
|
||||
or returnServerError('Could not request ARTE.');
|
||||
$input_json = json_decode($input, true);
|
||||
|
||||
foreach($input_json['videos'] as $element) {
|
||||
@@ -119,5 +120,4 @@ class Arte7Bridge extends BridgeAbstract {
|
||||
$this->items[] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
72
bridges/AsahiShimbunAJWBridge.php
Normal file
72
bridges/AsahiShimbunAJWBridge.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
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(
|
||||
'type' => 'list',
|
||||
'name' => 'Section',
|
||||
'values' => array(
|
||||
'Japan » Social Affairs' => 'japan/social',
|
||||
'Japan » People' => 'japan/people',
|
||||
'Japan » 3/11 Disaster' => 'japan/0311disaster',
|
||||
'Japan » Sci & Tech' => 'japan/sci_tech',
|
||||
'Politics' => 'politics',
|
||||
'Business' => 'business',
|
||||
'Culture » Style' => 'culture/style',
|
||||
'Culture » Movies' => 'culture/movies',
|
||||
'Culture » Manga & Anime' => 'culture/manga_anime',
|
||||
'Asia » China' => 'asia/china',
|
||||
'Asia » Korean Peninsula' => 'asia/korean_peninsula',
|
||||
'Asia » Around Asia' => 'asia/around_asia',
|
||||
'Opinion » Editorial' => 'opinion/editorial',
|
||||
'Opinion » Vox Populi' => 'opinion/vox',
|
||||
),
|
||||
'defaultValue' => 'Politics',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
private function getSectionURI($section) {
|
||||
return self::getURI() . $section . '/';
|
||||
}
|
||||
|
||||
public function collectData() {
|
||||
$html = getSimpleHTMLDOM($this->getSectionURI($this->getInput('section')))
|
||||
or returnServerError('Could not load content');
|
||||
|
||||
foreach($html->find('#MainInner li a') as $element) {
|
||||
if ($element->parent()->class == 'HeadlineTopImage-S') {
|
||||
Debug::log('Skip Headline, it is repeated below');
|
||||
continue;
|
||||
}
|
||||
$item = array();
|
||||
|
||||
$item['uri'] = self::BASE_URI . $element->href;
|
||||
$e_lead = $element->find('span.Lead', 0);
|
||||
if ($e_lead) {
|
||||
$item['content'] = $e_lead->innertext;
|
||||
$e_lead->outertext = '';
|
||||
} else {
|
||||
$item['content'] = $element->innertext;
|
||||
}
|
||||
$e_date = $element->find('span.EnDate', 0);
|
||||
if ($e_date) {
|
||||
$item['timestamp'] = strtotime($e_date->innertext);
|
||||
$e_date->outertext = '';
|
||||
}
|
||||
$e_video = $element->find('span.EnVideo', 0);
|
||||
if ($e_video) {
|
||||
$e_video->outertext = '';
|
||||
$element->innertext = "VIDEO: $element->innertext";
|
||||
}
|
||||
$item['title'] = $element->innertext;
|
||||
|
||||
$this->items[] = $item;
|
||||
}
|
||||
}
|
||||
}
|
@@ -3,63 +3,195 @@
|
||||
class AutoJMBridge extends BridgeAbstract {
|
||||
|
||||
const NAME = 'AutoJM';
|
||||
const URI = 'http://www.autojm.fr/';
|
||||
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 en fonction des critères du site AutoJM' => array(
|
||||
'url' => array(
|
||||
'name' => 'URL de la recherche',
|
||||
'name' => 'URL du modèle',
|
||||
'type' => 'text',
|
||||
'required' => true,
|
||||
'title' => 'URL d\'une recherche avec filtre de véhicules sans le http://www.autojm.fr/',
|
||||
'exampleValue' => 'gammes/index/398?order_by=finition_asc&energie[]=3&transmission[]=2&dispo=all'
|
||||
'exampleValue' => 'achat-voitures-neuves-peugeot-nouvelle-308-5p'
|
||||
),
|
||||
'isDispo' => array(
|
||||
'name' => 'Disponibilité',
|
||||
'type' => 'list',
|
||||
'values' => array(
|
||||
'-' => '',
|
||||
'En stock' => 1,
|
||||
'Sur commande' => 0
|
||||
),
|
||||
'title' => 'Critère de disponibilité'
|
||||
),
|
||||
'energy' => array(
|
||||
'name' => 'Carburant',
|
||||
'type' => 'list',
|
||||
'values' => array(
|
||||
'-' => '',
|
||||
'Diesel' => 1,
|
||||
'Essence' => 3,
|
||||
'Hybride' => 5
|
||||
),
|
||||
'title' => 'Carburant'
|
||||
),
|
||||
'transmission' => array(
|
||||
'name' => 'Transmission',
|
||||
'type' => 'list',
|
||||
'values' => array(
|
||||
'-' => '',
|
||||
'Automatique' => 1,
|
||||
'Manuelle' => 2
|
||||
),
|
||||
'title' => 'Transmission'
|
||||
),
|
||||
'priceMin' => array(
|
||||
'name' => 'Prix minimum',
|
||||
'type' => 'number',
|
||||
'required' => false,
|
||||
'title' => 'Prix minimum du véhicule',
|
||||
'exampleValue' => '10000',
|
||||
'defaultValue' => '0'
|
||||
),
|
||||
'priceMax' => array(
|
||||
'name' => 'Prix maximum',
|
||||
'type' => 'number',
|
||||
'required' => false,
|
||||
'title' => 'Prix maximum du véhicule',
|
||||
'exampleValue' => '15000',
|
||||
'defaultValue' => '150000'
|
||||
)
|
||||
)
|
||||
);
|
||||
const CACHE_TIMEOUT = 3600;
|
||||
|
||||
public function getIcon() {
|
||||
return self::URI . 'assets/images/favicon.ico';
|
||||
return self::URI . 'favicon.ico';
|
||||
}
|
||||
|
||||
public function collectData() {
|
||||
$html = getSimpleHTMLDOM(self::URI . $this->getInput('url'))
|
||||
or returnServerError('Could not request AutoJM.');
|
||||
$list = $html->find('div[class*=ligne_modele]');
|
||||
foreach($list as $element) {
|
||||
$image = $element->find('img[class=width-100]', 0)->src;
|
||||
$serie = $element->find('div[class=serie]', 0)->find('span', 0)->plaintext;
|
||||
$url = $element->find('div[class=serie]', 0)->find('a[class=btn_ligne color-black]', 0)->href;
|
||||
if($element->find('div[class*=hasStock-info]', 0) != null) {
|
||||
$dispo = 'Disponible';
|
||||
} else {
|
||||
$dispo = 'Sur commande';
|
||||
}
|
||||
$carburant = str_replace('dispo |', '', $element->find('div[class=carburant]', 0)->plaintext);
|
||||
$transmission = $element->find('div[class*=bv]', 0)->plaintext;
|
||||
$places = $element->find('div[class*=places]', 0)->plaintext;
|
||||
$portes = $element->find('div[class*=nb_portes]', 0)->plaintext;
|
||||
$carosserie = $element->find('div[class*=coloris]', 0)->plaintext;
|
||||
$remise = $element->find('div[class*=remise]', 0)->plaintext;
|
||||
$prix = $element->find('div[class*=prixjm]', 0)->plaintext;
|
||||
|
||||
$item = array();
|
||||
$item['uri'] = $url;
|
||||
$item['title'] = $serie;
|
||||
$item['content'] = '<p><img style="vertical-align:middle ; padding: 10px" src="' . $image . '" />' . $serie . '</p>';
|
||||
$item['content'] .= '<ul><li>Disponibilité : ' . $dispo . '</li>';
|
||||
$item['content'] .= '<li>Carburant : ' . $carburant . '</li>';
|
||||
$item['content'] .= '<li>Transmission : ' . $transmission . '</li>';
|
||||
$item['content'] .= '<li>Nombre de places : ' . $places . '</li>';
|
||||
$item['content'] .= '<li>Nombre de portes : ' . $portes . '</li>';
|
||||
$item['content'] .= '<li>Série : ' . $serie . '</li>';
|
||||
$item['content'] .= '<li>Carosserie : ' . $carosserie . '</li>';
|
||||
$item['content'] .= '<li>Remise : ' . $remise . '</li>';
|
||||
$item['content'] .= '<li>Prix : ' . $prix . '</li></ul>';
|
||||
|
||||
$this->items[] = $item;
|
||||
public function getName() {
|
||||
switch($this->queriedContext) {
|
||||
case 'Afficher les offres de véhicules disponible en fonction des critères du site AutoJM':
|
||||
$html = getSimpleHTMLDOMCached(self::URI . $this->getInput('url'), 86400);
|
||||
$name = html_entity_decode($html->find('title', 0)->plaintext);
|
||||
return $name;
|
||||
break;
|
||||
default:
|
||||
return parent::getName();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function collectData() {
|
||||
|
||||
$model_url = self::URI . $this->getInput('url');
|
||||
|
||||
// Get the session cookies and the form token
|
||||
$this->getInitialParameters($model_url);
|
||||
|
||||
// Build the form
|
||||
$post_data = array(
|
||||
'form[isDispo]' => $this->getInput('isDispo'),
|
||||
'form[energy]' => $this->getInput('energy'),
|
||||
'form[transmission]' => $this->getInput('transmission'),
|
||||
'form[priceMin]' => $this->getInput('priceMin'),
|
||||
'form[priceMin]' => $this->getInput('priceMin'),
|
||||
'form[_token]' => $this->token
|
||||
);
|
||||
|
||||
// Set the Form request content type
|
||||
$header = array(
|
||||
'Content-Type: application/x-www-form-urlencoded; charset=UTF-8',
|
||||
);
|
||||
|
||||
// Set the curl options (POST query and content, and session cookies
|
||||
$curl_opts = array(
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_POSTFIELDS => http_build_query($post_data),
|
||||
CURLOPT_COOKIE => $this->cookies
|
||||
);
|
||||
|
||||
// Get the JSON content of the form
|
||||
$json = getContents($model_url, $header, $curl_opts)
|
||||
or returnServerError('Could not request AutoJM.');
|
||||
|
||||
// Extract the HTML content from the JSON result
|
||||
$data = json_decode($json);
|
||||
$html = str_get_html($data->content);
|
||||
|
||||
// Go through every finisha of the model
|
||||
$list = $html->find('h2');
|
||||
foreach ($list as $finish) {
|
||||
$finish_name = $finish->plaintext;
|
||||
$motorizations = $finish->next_sibling()->find('li');
|
||||
foreach ($motorizations as $element) {
|
||||
$image = $element->find('div[class=block-product-image]', 0)->{'data-ga-banner'};
|
||||
$serie = $element->find('span[class=model]', 0)->plaintext;
|
||||
$url = self::URI . substr($element->find('a', 0)->href, 1);
|
||||
if ($element->find('span[class*=block-product-nbModel]', 0) != null) {
|
||||
$availability = 'En Stock';
|
||||
} else {
|
||||
$availability = 'Sur commande';
|
||||
}
|
||||
$discount_html = $element->find('span[class*=tag--promo]', 0);
|
||||
if ($discount_html != null) {
|
||||
$discount = $discount_html->plaintext;
|
||||
} else {
|
||||
$discount = 'inconnue';
|
||||
}
|
||||
$price = $element->find('span[class=price red h1]', 0)->plaintext;
|
||||
$item = array();
|
||||
$item['title'] = $finish_name . ' ' . $serie;
|
||||
$item['content'] = '<p><img style="vertical-align:middle ; padding: 10px" src="' . $image . '" />'
|
||||
. $finish_name . ' ' . $serie . '</p>';
|
||||
$item['content'] .= '<ul><li>Disponibilité : ' . $availability . '</li>';
|
||||
$item['content'] .= '<li>Série : ' . $serie . '</li>';
|
||||
$item['content'] .= '<li>Remise : ' . $discount . '</li>';
|
||||
$item['content'] .= '<li>Prix : ' . $price . '</li></ul>';
|
||||
|
||||
// Add a fictionnal anchor to the RSS element URL, based on the item content ;
|
||||
// As the URL could be identical even if the price change, some RSS reader will not show those offers as new items
|
||||
$item['uri'] = $url . '#' . md5($item['content']);
|
||||
|
||||
$this->items[] = $item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the session cookie and the form token
|
||||
*
|
||||
* @param string $pageURL The URL from which to get the values
|
||||
*/
|
||||
private function getInitialParameters($pageURL) {
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $pageURL);
|
||||
curl_setopt($ch, CURLOPT_HEADER, true);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
$data = curl_exec($ch);
|
||||
|
||||
// Separate the response header and the content
|
||||
$headerSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
|
||||
$header = substr($data, 0, $headerSize);
|
||||
$content = substr($data, $headerSize);
|
||||
curl_close($ch);
|
||||
|
||||
// Extract the cookies from the headers
|
||||
$cookies = '';
|
||||
$http_response_header = explode("\r\n", $header);
|
||||
foreach ($http_response_header as $hdr) {
|
||||
if (strpos($hdr, 'Set-Cookie') !== false) {
|
||||
$cLine = explode(':', $hdr)[1];
|
||||
$cLine = explode(';', $cLine)[0];
|
||||
$cookies .= ';' . $cLine;
|
||||
}
|
||||
}
|
||||
$this->cookies = trim(substr($cookies, 1));
|
||||
|
||||
// Get the token from the content
|
||||
$html = str_get_html($content);
|
||||
$token = $html->find('input[type=hidden][id=form__token]', 0);
|
||||
$this->token = $token->value;
|
||||
}
|
||||
}
|
||||
|
435
bridges/BadDragonBridge.php
Normal file
435
bridges/BadDragonBridge.php
Normal file
@@ -0,0 +1,435 @@
|
||||
<?php
|
||||
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(
|
||||
'name' => 'Ready Made',
|
||||
'type' => 'checkbox'
|
||||
),
|
||||
'flop' => array(
|
||||
'name' => 'Flops',
|
||||
'type' => 'checkbox'
|
||||
),
|
||||
'skus' => array(
|
||||
'name' => 'Products',
|
||||
'exampleValue' => 'chanceflared, crackers',
|
||||
'title' => 'Comma separated list of product SKUs'
|
||||
),
|
||||
'onesize' => array(
|
||||
'name' => 'One-Size',
|
||||
'type' => 'checkbox'
|
||||
),
|
||||
'mini' => array(
|
||||
'name' => 'Mini',
|
||||
'type' => 'checkbox'
|
||||
),
|
||||
'small' => array(
|
||||
'name' => 'Small',
|
||||
'type' => 'checkbox'
|
||||
),
|
||||
'medium' => array(
|
||||
'name' => 'Medium',
|
||||
'type' => 'checkbox'
|
||||
),
|
||||
'large' => array(
|
||||
'name' => 'Large',
|
||||
'type' => 'checkbox'
|
||||
),
|
||||
'extralarge' => array(
|
||||
'name' => 'Extra Large',
|
||||
'type' => 'checkbox'
|
||||
),
|
||||
'category' => array(
|
||||
'name' => 'Category',
|
||||
'type' => 'list',
|
||||
'values' => array(
|
||||
'All' => 'all',
|
||||
'Accessories' => 'accessories',
|
||||
'Merchandise' => 'merchandise',
|
||||
'Dildos' => 'insertable',
|
||||
'Masturbators' => 'penetrable',
|
||||
'Packers' => 'packer',
|
||||
'Lil\' Squirts' => 'shooter',
|
||||
'Lil\' Vibes' => 'vibrator',
|
||||
'Wearables' => 'wearable'
|
||||
),
|
||||
'defaultValue' => 'all',
|
||||
),
|
||||
'soft' => array(
|
||||
'name' => 'Soft Firmness',
|
||||
'type' => 'checkbox'
|
||||
),
|
||||
'med_firm' => array(
|
||||
'name' => 'Medium Firmness',
|
||||
'type' => 'checkbox'
|
||||
),
|
||||
'firm' => array(
|
||||
'name' => 'Firm',
|
||||
'type' => 'checkbox'
|
||||
),
|
||||
'split' => array(
|
||||
'name' => 'Split Firmness',
|
||||
'type' => 'checkbox'
|
||||
),
|
||||
'maxprice' => array(
|
||||
'name' => 'Max Price',
|
||||
'type' => 'number',
|
||||
'required' => true,
|
||||
'defaultValue' => 300
|
||||
),
|
||||
'minprice' => array(
|
||||
'name' => 'Min Price',
|
||||
'type' => 'number',
|
||||
'defaultValue' => 0
|
||||
),
|
||||
'cumtube' => array(
|
||||
'name' => 'Cumtube',
|
||||
'type' => 'checkbox'
|
||||
),
|
||||
'suctionCup' => array(
|
||||
'name' => 'Suction Cup',
|
||||
'type' => 'checkbox'
|
||||
),
|
||||
'noAccessories' => array(
|
||||
'name' => 'No Accessories',
|
||||
'type' => 'checkbox'
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
/*
|
||||
* This sets index $strFrom (or $strTo if set) in $outArr to 'on' if
|
||||
* $inArr[$param] contains $strFrom.
|
||||
* It is used for translating BD's shop filter URLs into something we can use.
|
||||
*
|
||||
* For the query '?type[]=ready_made&type[]=flop' we would have an array like:
|
||||
* Array (
|
||||
* [type] => Array (
|
||||
* [0] => ready_made
|
||||
* [1] => flop
|
||||
* )
|
||||
* )
|
||||
* which could be translated into:
|
||||
* Array (
|
||||
* [ready_made] => on
|
||||
* [flop] => on
|
||||
* )
|
||||
* */
|
||||
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();
|
||||
|
||||
// Sale
|
||||
$regex = '/^(https?:\/\/)?bad-dragon\.com\/sales/';
|
||||
if(preg_match($regex, $url, $matches) > 0) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
// Clearance
|
||||
$regex = '/^(https?:\/\/)?bad-dragon\.com\/shop\/clearance/';
|
||||
if(preg_match($regex, $url, $matches) > 0) {
|
||||
parse_str(parse_url($url, PHP_URL_QUERY), $urlParams);
|
||||
|
||||
$this->setParam($urlParams, $params, 'type', 'ready_made');
|
||||
$this->setParam($urlParams, $params, 'type', 'flop');
|
||||
|
||||
if(isset($urlParams['skus'])) {
|
||||
$skus = array();
|
||||
foreach($urlParams['skus'] as $sku) {
|
||||
is_string($sku) && $skus[] = $sku;
|
||||
is_array($sku) && $skus[] = $sku[0];
|
||||
}
|
||||
$params['skus'] = implode(',', $skus);
|
||||
}
|
||||
|
||||
$this->setParam($urlParams, $params, 'sizes', 'onesize');
|
||||
$this->setParam($urlParams, $params, 'sizes', 'mini');
|
||||
$this->setParam($urlParams, $params, 'sizes', 'small');
|
||||
$this->setParam($urlParams, $params, 'sizes', 'medium');
|
||||
$this->setParam($urlParams, $params, 'sizes', 'large');
|
||||
$this->setParam($urlParams, $params, 'sizes', 'extralarge');
|
||||
|
||||
if(isset($urlParams['category'])) {
|
||||
$params['category'] = strtolower($urlParams['category']);
|
||||
} else{
|
||||
$params['category'] = 'all';
|
||||
}
|
||||
|
||||
$this->setParam($urlParams, $params, 'firmnessValues', 'soft');
|
||||
$this->setParam($urlParams, $params, 'firmnessValues', 'medium', 'med_firm');
|
||||
$this->setParam($urlParams, $params, 'firmnessValues', 'firm');
|
||||
$this->setParam($urlParams, $params, 'firmnessValues', 'split');
|
||||
|
||||
if(isset($urlParams['price'])) {
|
||||
isset($urlParams['price']['max'])
|
||||
&& $params['maxprice'] = $urlParams['price']['max'];
|
||||
isset($urlParams['price']['min'])
|
||||
&& $params['minprice'] = $urlParams['price']['min'];
|
||||
}
|
||||
|
||||
isset($urlParams['cumtube'])
|
||||
&& $urlParams['cumtube'] === '1'
|
||||
&& $params['cumtube'] = 'on';
|
||||
isset($urlParams['suctionCup'])
|
||||
&& $urlParams['suctionCup'] === '1'
|
||||
&& $params['suctionCup'] = 'on';
|
||||
isset($urlParams['noAccessories'])
|
||||
&& $urlParams['noAccessories'] === '1'
|
||||
&& $params['noAccessories'] = 'on';
|
||||
|
||||
return $params;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getName() {
|
||||
switch($this->queriedContext) {
|
||||
case 'Sales':
|
||||
return 'Bad Dragon Sales';
|
||||
case 'Clearance':
|
||||
return 'Bad Dragon Clearance Search';
|
||||
default:
|
||||
return parent::getName();
|
||||
}
|
||||
}
|
||||
|
||||
public function getURI() {
|
||||
switch($this->queriedContext) {
|
||||
case 'Sales':
|
||||
return self::URI . 'sales';
|
||||
case 'Clearance':
|
||||
return $this->inputToURL();
|
||||
default:
|
||||
return parent::getURI();
|
||||
}
|
||||
}
|
||||
|
||||
public function collectData() {
|
||||
switch($this->queriedContext) {
|
||||
case 'Sales':
|
||||
$sales = json_decode(getContents(self::URI . 'api/sales'))
|
||||
or returnServerError('Failed to query BD API');
|
||||
|
||||
foreach($sales as $sale) {
|
||||
$item = array();
|
||||
|
||||
$item['title'] = $sale->title;
|
||||
$item['timestamp'] = strtotime($sale->startDate);
|
||||
|
||||
$item['uri'] = $this->getURI() . '/' . $sale->slug;
|
||||
|
||||
$contentHTML = '<p><img src="' . $sale->image->url . '"></p>';
|
||||
if(isset($sale->endDate)) {
|
||||
$contentHTML .= '<p><b>This promotion ends on '
|
||||
. gmdate('M j, Y \a\t g:i A T', strtotime($sale->endDate))
|
||||
. '</b></p>';
|
||||
} else {
|
||||
$contentHTML .= '<p><b>This promotion never ends</b></p>';
|
||||
}
|
||||
$ul = false;
|
||||
$content = json_decode($sale->content);
|
||||
foreach($content->blocks as $block) {
|
||||
switch($block->type) {
|
||||
case 'header-one':
|
||||
$contentHTML .= '<h1>' . $block->text . '</h1>';
|
||||
break;
|
||||
case 'header-two':
|
||||
$contentHTML .= '<h2>' . $block->text . '</h2>';
|
||||
break;
|
||||
case 'header-three':
|
||||
$contentHTML .= '<h3>' . $block->text . '</h3>';
|
||||
break;
|
||||
case 'unordered-list-item':
|
||||
if(!$ul) {
|
||||
$contentHTML .= '<ul>';
|
||||
$ul = true;
|
||||
}
|
||||
$contentHTML .= '<li>' . $block->text . '</li>';
|
||||
break;
|
||||
default:
|
||||
if($ul) {
|
||||
$contentHTML .= '</ul>';
|
||||
$ul = false;
|
||||
}
|
||||
$contentHTML .= '<p>' . $block->text . '</p>';
|
||||
break;
|
||||
}
|
||||
}
|
||||
$item['content'] = $contentHTML;
|
||||
|
||||
$this->items[] = $item;
|
||||
}
|
||||
break;
|
||||
case 'Clearance':
|
||||
$toyData = json_decode(getContents($this->inputToURL(true)))
|
||||
or returnServerError('Failed to query BD API');
|
||||
|
||||
$productList = json_decode(getContents(self::URI
|
||||
. 'api/inventory-toy/product-list'))
|
||||
or returnServerError('Failed to query BD API');
|
||||
|
||||
foreach($toyData->toys as $toy) {
|
||||
$item = array();
|
||||
|
||||
$item['uri'] = $this->getURI()
|
||||
. '#'
|
||||
. $toy->id;
|
||||
$item['timestamp'] = strtotime($toy->created);
|
||||
|
||||
foreach($productList as $product) {
|
||||
if($product->sku == $toy->sku) {
|
||||
$item['title'] = $product->name;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// images
|
||||
$content = '<p>';
|
||||
foreach($toy->images as $image) {
|
||||
$content .= '<a href="'
|
||||
. $image->fullFilename
|
||||
. '"><img src="'
|
||||
. $image->thumbFilename
|
||||
. '" /></a>';
|
||||
}
|
||||
// price
|
||||
$content .= '</p><p><b>Price:</b> $'
|
||||
. $toy->price
|
||||
// size
|
||||
. '<br /><b>Size:</b> '
|
||||
. $toy->size
|
||||
// color
|
||||
. '<br /><b>Color:</b> '
|
||||
. $toy->color
|
||||
// features
|
||||
. '<br /><b>Features:</b> '
|
||||
. ($toy->suction_cup ? 'Suction cup' : '')
|
||||
. ($toy->suction_cup && $toy->cumtube ? ', ' : '')
|
||||
. ($toy->cumtube ? 'Cumtube' : '')
|
||||
. ($toy->suction_cup || $toy->cumtube ? '' : 'None');
|
||||
// firmness
|
||||
$firmnessTexts = array(
|
||||
'2' => 'Extra soft',
|
||||
'3' => 'Soft',
|
||||
'5' => 'Medium',
|
||||
'8' => 'Firm'
|
||||
);
|
||||
$firmnesses = explode('/', $toy->firmness);
|
||||
if(count($firmnesses) === 2) {
|
||||
$content .= '<br /><b>Firmness:</b> '
|
||||
. $firmnessTexts[$firmnesses[0]]
|
||||
. ', '
|
||||
. $firmnessTexts[$firmnesses[1]];
|
||||
} else{
|
||||
$content .= '<br /><b>Firmness:</b> '
|
||||
. $firmnessTexts[$firmnesses[0]];
|
||||
}
|
||||
// flop
|
||||
if($toy->type === 'flop') {
|
||||
$content .= '<br /><b>Flop reason:</b> '
|
||||
. $toy->flop_reason;
|
||||
}
|
||||
$content .= '</p>';
|
||||
$item['content'] = $content;
|
||||
|
||||
$enclosures = array();
|
||||
foreach($toy->images as $image) {
|
||||
$enclosures[] = $image->fullFilename;
|
||||
}
|
||||
$item['enclosures'] = $enclosures;
|
||||
|
||||
$categories = array();
|
||||
$categories[] = $toy->sku;
|
||||
$categories[] = $toy->type;
|
||||
$categories[] = $toy->size;
|
||||
if($toy->cumtube) {
|
||||
$categories[] = 'cumtube';
|
||||
}
|
||||
if($toy->suction_cup) {
|
||||
$categories[] = 'suction_cup';
|
||||
}
|
||||
$item['categories'] = $categories;
|
||||
|
||||
$this->items[] = $item;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private function inputToURL($api = false) {
|
||||
$url = self::URI;
|
||||
$url .= ($api ? 'api/inventory-toys?' : 'shop/clearance?');
|
||||
|
||||
// Default parameters
|
||||
$url .= 'limit=60';
|
||||
$url .= '&page=1';
|
||||
$url .= '&sort[field]=created';
|
||||
$url .= '&sort[direction]=desc';
|
||||
|
||||
// Product types
|
||||
$url .= ($this->getInput('ready_made') ? '&type[]=ready_made' : '');
|
||||
$url .= ($this->getInput('flop') ? '&type[]=flop' : '');
|
||||
|
||||
// Product names
|
||||
foreach(array_filter(explode(',', $this->getInput('skus'))) as $sku) {
|
||||
$url .= '&skus[]=' . urlencode(trim($sku));
|
||||
}
|
||||
|
||||
// Size
|
||||
$url .= ($this->getInput('onesize') ? '&sizes[]=onesize' : '');
|
||||
$url .= ($this->getInput('mini') ? '&sizes[]=mini' : '');
|
||||
$url .= ($this->getInput('small') ? '&sizes[]=small' : '');
|
||||
$url .= ($this->getInput('medium') ? '&sizes[]=medium' : '');
|
||||
$url .= ($this->getInput('large') ? '&sizes[]=large' : '');
|
||||
$url .= ($this->getInput('extralarge') ? '&sizes[]=extralarge' : '');
|
||||
|
||||
// Category
|
||||
$url .= ($this->getInput('category') ? '&category='
|
||||
. urlencode($this->getInput('category')) : '');
|
||||
|
||||
// Firmness
|
||||
if($api) {
|
||||
$url .= ($this->getInput('soft') ? '&firmnessValues[]=3' : '');
|
||||
$url .= ($this->getInput('med_firm') ? '&firmnessValues[]=5' : '');
|
||||
$url .= ($this->getInput('firm') ? '&firmnessValues[]=8' : '');
|
||||
if($this->getInput('split')) {
|
||||
$url .= '&firmnessValues[]=3/5';
|
||||
$url .= '&firmnessValues[]=3/8';
|
||||
$url .= '&firmnessValues[]=8/3';
|
||||
$url .= '&firmnessValues[]=5/8';
|
||||
$url .= '&firmnessValues[]=8/5';
|
||||
}
|
||||
} else{
|
||||
$url .= ($this->getInput('soft') ? '&firmnessValues[]=soft' : '');
|
||||
$url .= ($this->getInput('med_firm') ? '&firmnessValues[]=medium' : '');
|
||||
$url .= ($this->getInput('firm') ? '&firmnessValues[]=firm' : '');
|
||||
$url .= ($this->getInput('split') ? '&firmnessValues[]=split' : '');
|
||||
}
|
||||
|
||||
// Price
|
||||
$url .= ($this->getInput('maxprice') ? '&price[max]='
|
||||
. $this->getInput('maxprice') : '&price[max]=300');
|
||||
$url .= ($this->getInput('minprice') ? '&price[min]='
|
||||
. $this->getInput('minprice') : '&price[min]=0');
|
||||
|
||||
// Features
|
||||
$url .= ($this->getInput('cumtube') ? '&cumtube=1' : '');
|
||||
$url .= ($this->getInput('suctionCup') ? '&suctionCup=1' : '');
|
||||
$url .= ($this->getInput('noAccessories') ? '&noAccessories=1' : '');
|
||||
|
||||
return $url;
|
||||
}
|
||||
}
|
103
bridges/BakaUpdatesMangaReleasesBridge.php
Normal file
103
bridges/BakaUpdatesMangaReleasesBridge.php
Normal file
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
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';
|
||||
const PARAMETERS = array(array(
|
||||
'series_id' => array(
|
||||
'name' => 'Series ID',
|
||||
'type' => 'number',
|
||||
'required' => true,
|
||||
'exampleValue' => '12345'
|
||||
)
|
||||
));
|
||||
const LIMIT_COLS = 5;
|
||||
const LIMIT_ITEMS = 10;
|
||||
|
||||
private $feedName = '';
|
||||
|
||||
public function collectData() {
|
||||
$html = getSimpleHTMLDOM($this->getURI())
|
||||
or returnServerError('Series not found');
|
||||
|
||||
// content is an unstructured pile of divs, ugly to parse
|
||||
$cols = $html->find('div#main_content div.row > div.text');
|
||||
if (!$cols)
|
||||
returnServerError('No releases');
|
||||
|
||||
$rows = array_slice(
|
||||
array_chunk($cols, self::LIMIT_COLS), 0, self::LIMIT_ITEMS
|
||||
);
|
||||
|
||||
if (isset($rows[0][1])) {
|
||||
$this->feedName = $this->filterHTML($rows[0][1]->plaintext);
|
||||
}
|
||||
|
||||
foreach($rows as $cols) {
|
||||
if (count($cols) < self::LIMIT_COLS) continue;
|
||||
|
||||
$item = array();
|
||||
$title = array();
|
||||
|
||||
$item['content'] = '';
|
||||
|
||||
$objDate = $cols[0];
|
||||
if ($objDate)
|
||||
$item['timestamp'] = strtotime($objDate->plaintext);
|
||||
|
||||
$objTitle = $cols[1];
|
||||
if ($objTitle) {
|
||||
$title[] = $this->filterHTML($objTitle->plaintext);
|
||||
$item['content'] .= '<p>Series: ' . $this->filterText($objTitle->innertext) . '</p>';
|
||||
}
|
||||
|
||||
$objVolume = $cols[2];
|
||||
if ($objVolume && !empty($objVolume->plaintext))
|
||||
$title[] = 'Vol.' . $objVolume->plaintext;
|
||||
|
||||
$objChapter = $cols[3];
|
||||
if ($objChapter && !empty($objChapter->plaintext))
|
||||
$title[] = 'Chp.' . $objChapter->plaintext;
|
||||
|
||||
$objAuthor = $cols[4];
|
||||
if ($objAuthor && !empty($objAuthor->plaintext)) {
|
||||
$item['author'] = $this->filterHTML($objAuthor->plaintext);
|
||||
$item['content'] .= '<p>Groups: ' . $this->filterText($objAuthor->innertext) . '</p>';
|
||||
}
|
||||
|
||||
$item['title'] = implode(' ', $title);
|
||||
$item['uri'] = $this->getURI();
|
||||
$item['uid'] = $this->getSanitizedHash($item['title']);
|
||||
|
||||
$this->items[] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
public function getURI(){
|
||||
$series_id = $this->getInput('series_id');
|
||||
if (!empty($series_id)) {
|
||||
return self::URI . 'releases.html?search=' . $series_id . '&stype=series';
|
||||
}
|
||||
return self::URI;
|
||||
}
|
||||
|
||||
public function getName(){
|
||||
if(!empty($this->feedName)) {
|
||||
return $this->feedName . ' - ' . self::NAME;
|
||||
}
|
||||
return parent::getName();
|
||||
}
|
||||
|
||||
private function getSanitizedHash($string) {
|
||||
return hash('sha1', preg_replace('/[^a-zA-Z0-9\-\.]/', '', ucwords(strtolower($string))));
|
||||
}
|
||||
|
||||
private function filterText($text) {
|
||||
return rtrim($text, '* ');
|
||||
}
|
||||
|
||||
private function filterHTML($text) {
|
||||
return $this->filterText(html_entity_decode($text));
|
||||
}
|
||||
}
|
@@ -13,48 +13,72 @@ class BandcampBridge extends BridgeAbstract {
|
||||
'required' => true
|
||||
)
|
||||
));
|
||||
const IMGURI = 'https://f4.bcbits.com/';
|
||||
const IMGSIZE_300PX = 23;
|
||||
const IMGSIZE_700PX = 16;
|
||||
|
||||
public function getIcon() {
|
||||
return 'https://s4.bcbits.com/img/bc_favicon.ico';
|
||||
}
|
||||
|
||||
public function collectData(){
|
||||
$html = getSimpleHTMLDOM($this->getURI())
|
||||
or returnServerError('No results for this query.');
|
||||
$url = self::URI . 'api/hub/1/dig_deeper';
|
||||
$data = $this->buildRequestJson();
|
||||
$header = array(
|
||||
'Content-Type: application/json',
|
||||
'Content-Length: ' . strlen($data)
|
||||
);
|
||||
$opts = array(
|
||||
CURLOPT_CUSTOMREQUEST => 'POST',
|
||||
CURLOPT_POSTFIELDS => $data
|
||||
);
|
||||
$content = getContents($url, $header, $opts)
|
||||
or returnServerError('Could not complete request to: ' . $url);
|
||||
|
||||
foreach($html->find('li.item') as $release) {
|
||||
$script = $release->find('div.art', 0)->getAttribute('onclick');
|
||||
$uri = ltrim($script, "return 'url(");
|
||||
$uri = rtrim($uri, "')");
|
||||
$json = json_decode($content);
|
||||
|
||||
$item = array();
|
||||
$item['author'] = $release->find('div.itemsubtext', 0)->plaintext
|
||||
. ' - '
|
||||
. $release->find('div.itemtext', 0)->plaintext;
|
||||
if ($json->ok !== true) {
|
||||
returnServerError('Invalid response');
|
||||
}
|
||||
|
||||
$item['title'] = $release->find('div.itemsubtext', 0)->plaintext
|
||||
. ' - '
|
||||
. $release->find('div.itemtext', 0)->plaintext;
|
||||
foreach ($json->items as $entry) {
|
||||
$url = $entry->tralbum_url;
|
||||
$artist = $entry->artist;
|
||||
$title = $entry->title;
|
||||
// e.g. record label is the releaser, but not the artist
|
||||
$releaser = $entry->band_name !== $entry->artist ? $entry->band_name : null;
|
||||
|
||||
$item['content'] = '<img src="'
|
||||
. $uri
|
||||
. '"/><br/>'
|
||||
. $release->find('div.itemsubtext', 0)->plaintext
|
||||
. ' - '
|
||||
. $release->find('div.itemtext', 0)->plaintext;
|
||||
$full_title = $artist . ' - ' . $title;
|
||||
$full_artist = $artist;
|
||||
if (isset($releaser)) {
|
||||
$full_title .= ' (' . $releaser . ')';
|
||||
$full_artist .= ' (' . $releaser . ')';
|
||||
}
|
||||
$small_img = $this->getImageUrl($entry->art_id, self::IMGSIZE_300PX);
|
||||
$img = $this->getImageUrl($entry->art_id, self::IMGSIZE_700PX);
|
||||
|
||||
$item['id'] = $release->find('a', 0)->getAttribute('href');
|
||||
$item['uri'] = $release->find('a', 0)->getAttribute('href');
|
||||
$item = array(
|
||||
'uri' => $url,
|
||||
'author' => $full_artist,
|
||||
'title' => $full_title
|
||||
);
|
||||
$item['content'] = "<img src='$small_img' /><br/>$full_title";
|
||||
$item['enclosures'] = array($img);
|
||||
$this->items[] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
public function getURI(){
|
||||
if(!is_null($this->getInput('tag'))) {
|
||||
return self::URI . 'tag/' . urlencode($this->getInput('tag')) . '?sort_field=date';
|
||||
}
|
||||
private function buildRequestJson(){
|
||||
$requestJson = array(
|
||||
'tag' => $this->getInput('tag'),
|
||||
'page' => 1,
|
||||
'sort' => 'date'
|
||||
);
|
||||
return json_encode($requestJson);
|
||||
}
|
||||
|
||||
return parent::getURI();
|
||||
private function getImageUrl($id, $size){
|
||||
return self::IMGURI . 'img/a' . $id . '_' . $size . '.jpg';
|
||||
}
|
||||
|
||||
public function getName(){
|
||||
|
103
bridges/BinanceBridge.php
Normal file
103
bridges/BinanceBridge.php
Normal file
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
class BinanceBridge extends BridgeAbstract {
|
||||
const NAME = 'Binance';
|
||||
const URI = 'https://www.binance.com';
|
||||
const DESCRIPTION = 'Subscribe to the Binance blog or the Binance Zendesk announcements.';
|
||||
const MAINTAINER = 'thefranke';
|
||||
const CACHE_TIMEOUT = 3600; // 1h
|
||||
|
||||
const PARAMETERS = array( array(
|
||||
'category' => array(
|
||||
'name' => 'category',
|
||||
'type' => 'list',
|
||||
'exampleValue' => 'Blog',
|
||||
'title' => 'Select a category',
|
||||
'values' => array(
|
||||
'Blog' => 'Blog',
|
||||
'Announcements' => 'Announcements'
|
||||
)
|
||||
)
|
||||
));
|
||||
|
||||
public function getIcon() {
|
||||
return 'https://bin.bnbstatic.com/static/images/common/favicon.ico';
|
||||
}
|
||||
|
||||
public function getName() {
|
||||
return self::NAME . ' ' . $this->getInput('category');
|
||||
}
|
||||
|
||||
public function getURI() {
|
||||
if ($this->getInput('category') == 'Blog')
|
||||
return self::URI . '/en/blog';
|
||||
else
|
||||
return 'https://binance.zendesk.com/hc/en-us/categories/115000056351-Announcements';
|
||||
}
|
||||
|
||||
protected function collectBlogData() {
|
||||
$html = getSimpleHTMLDOM($this->getURI())
|
||||
or returnServerError('Could not fetch Binance blog data.');
|
||||
|
||||
foreach($html->find('div[direction="row"]') as $element) {
|
||||
|
||||
$date = $element->find('div[direction="column"]', 0);
|
||||
$day = $date->find('div', 0)->innertext;
|
||||
$month = $date->find('div', 1)->innertext;
|
||||
$extractedDate = $day . ' ' . $month;
|
||||
|
||||
$abstract = $element->find('div[direction="column"]', 1);
|
||||
$a = $abstract->find('a', 0);
|
||||
$uri = self::URI . $a->href;
|
||||
$title = $a->innertext;
|
||||
|
||||
$full = getSimpleHTMLDOMCached($uri);
|
||||
$content = $full->find('div.desc', 1);
|
||||
|
||||
$item = array();
|
||||
$item['title'] = $title;
|
||||
$item['uri'] = $uri;
|
||||
$item['timestamp'] = strtotime($extractedDate);
|
||||
$item['author'] = 'Binance';
|
||||
$item['content'] = $content;
|
||||
|
||||
$this->items[] = $item;
|
||||
|
||||
if (count($this->items) >= 10)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected function collectAnnouncementData() {
|
||||
$html = getSimpleHTMLDOM($this->getURI())
|
||||
or returnServerError('Could not fetch Zendesk announcement data.');
|
||||
|
||||
foreach($html->find('a.article-list-link') as $a) {
|
||||
$title = $a->innertext;
|
||||
$uri = 'https://binance.zendesk.com' . $a->href;
|
||||
|
||||
$full = getSimpleHTMLDOMCached($uri);
|
||||
$content = $full->find('div.article-body', 0);
|
||||
$date = $full->find('time', 0)->getAttribute('datetime');
|
||||
|
||||
$item = array();
|
||||
|
||||
$item['title'] = $title;
|
||||
$item['uri'] = $uri;
|
||||
$item['timestamp'] = strtotime($date);
|
||||
$item['author'] = 'Binance';
|
||||
$item['content'] = $content;
|
||||
|
||||
$this->items[] = $item;
|
||||
|
||||
if (count($this->items) >= 10)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public function collectData() {
|
||||
if ($this->getInput('category') == 'Blog')
|
||||
$this->collectBlogData();
|
||||
else
|
||||
$this->collectAnnouncementData();
|
||||
}
|
||||
}
|
119
bridges/BingSearchBridge.php
Normal file
119
bridges/BingSearchBridge.php
Normal file
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
|
||||
class BingSearchBridge extends BridgeAbstract
|
||||
{
|
||||
const NAME = 'Bing search';
|
||||
const URI = 'https://www.bing.com/';
|
||||
const DESCRIPTION = 'Return images from bing search discover';
|
||||
const MAINTAINER = 'DnAp';
|
||||
const PARAMETERS = array(
|
||||
'Image Discover' => array(
|
||||
'category' => array(
|
||||
'name' => 'Categories',
|
||||
'type' => 'list',
|
||||
'values' => self::IMAGE_DISCOVER_CATEGORIES
|
||||
),
|
||||
'image_size' => array(
|
||||
'name' => 'Image size',
|
||||
'type' => 'list',
|
||||
'values' => array(
|
||||
'Small' => 'turl',
|
||||
'Full size' => 'imgurl'
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
const IMAGE_DISCOVER_CATEGORIES = array(
|
||||
'Abstract' => 'abstract',
|
||||
'Animals' => 'animals',
|
||||
'Anime' => 'anime',
|
||||
'Architecture' => 'architecture',
|
||||
'Arts and Crafts' => 'arts-and-crafts',
|
||||
'Beauty' => 'beauty',
|
||||
'Cars and Motorcycles' => 'cars-and-motorcycles',
|
||||
'Cats' => 'cats',
|
||||
'Celebrities' => 'celebrities',
|
||||
'Comics' => 'comics',
|
||||
'DIY' => 'diy',
|
||||
'Dogs' => 'dogs',
|
||||
'Fitness' => 'fitness',
|
||||
'Food and Drink' => 'food-and-drink',
|
||||
'Funny' => 'funny',
|
||||
'Gadgets' => 'gadgets',
|
||||
'Gardening' => 'gardening',
|
||||
'Geeky' => 'geeky',
|
||||
'Hairstyles' => 'hairstyles',
|
||||
'Home Decor' => 'home-decor',
|
||||
'Marine Life' => 'marine-life',
|
||||
'Men\'s Fashion' => 'men%27s-fashion',
|
||||
'Nature' => 'nature',
|
||||
'Outdoors' => 'outdoors',
|
||||
'Parenting' => 'parenting',
|
||||
'Phone Wallpapers' => 'phone-wallpapers',
|
||||
'Photography' => 'photography',
|
||||
'Quotes' => 'quotes',
|
||||
'Recipes' => 'recipes',
|
||||
'Snow' => 'snow',
|
||||
'Tattoos' => 'tattoos',
|
||||
'Travel' => 'travel',
|
||||
'Video Games' => 'video-games',
|
||||
'Weddings' => 'weddings',
|
||||
'Women\'s Fashion' => 'women%27s-fashion',
|
||||
);
|
||||
|
||||
public function getIcon()
|
||||
{
|
||||
return 'https://www.bing.com/sa/simg/bing_p_rr_teal_min.ico';
|
||||
}
|
||||
|
||||
public function collectData()
|
||||
{
|
||||
$this->items = $this->imageDiscover($this->getInput('category'));
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
if ($this->getInput('category')) {
|
||||
if (self::IMAGE_DISCOVER_CATEGORIES[$this->getInput('categories')] !== null) {
|
||||
$category = self::IMAGE_DISCOVER_CATEGORIES[$this->getInput('categories')];
|
||||
} else {
|
||||
$category = 'Unknown';
|
||||
}
|
||||
|
||||
return 'Best ' . $category . ' - Bing Image Discover';
|
||||
}
|
||||
return parent::getName();
|
||||
}
|
||||
|
||||
private function imageDiscover($category)
|
||||
{
|
||||
$html = getSimpleHTMLDOM(self::URI . '/discover/' . $category)
|
||||
or returnServerError('Could not request ' . self::NAME);
|
||||
$sizeKey = $this->getInput('image_size');
|
||||
|
||||
$items = [];
|
||||
foreach ($html->find('a.iusc') as $element) {
|
||||
$data = json_decode(htmlspecialchars_decode($element->getAttribute('m')), true);
|
||||
|
||||
$item = array();
|
||||
$item['title'] = basename(rtrim($data['imgurl'], '/'));
|
||||
$item['uri'] = $data['imgurl'];
|
||||
$item['content'] = '<a href="' . $data['imgurl'] . '">
|
||||
<img src="' . $data[$sizeKey] . '" alt="' . $item['title'] . '"></a>
|
||||
<p>Source: <a href="' . $this->curUrl($data['surl']) . '"> </a></p>';
|
||||
$item['enclosures'] = $data['imgurl'];
|
||||
|
||||
$items[] = $item;
|
||||
}
|
||||
return $items;
|
||||
}
|
||||
|
||||
private function curUrl($url)
|
||||
{
|
||||
if (strlen($url) <= 80) {
|
||||
return $url;
|
||||
}
|
||||
return substr($url, 0, 80) . '...';
|
||||
}
|
||||
}
|
@@ -43,5 +43,4 @@ class BlaguesDeMerdeBridge extends BridgeAbstract {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
142
bridges/BrutBridge.php
Normal file
142
bridges/BrutBridge.php
Normal file
@@ -0,0 +1,142 @@
|
||||
<?php
|
||||
class BrutBridge extends BridgeAbstract {
|
||||
const NAME = 'Brut Bridge';
|
||||
const URI = 'https://www.brut.media';
|
||||
const DESCRIPTION = 'Returns 5 newest videos by category and edition';
|
||||
const MAINTAINER = 'VerifiedJoseph';
|
||||
const PARAMETERS = array(array(
|
||||
'category' => array(
|
||||
'name' => 'Category',
|
||||
'type' => 'list',
|
||||
'values' => array(
|
||||
'News' => 'news',
|
||||
'International' => 'international',
|
||||
'Economy' => 'economy',
|
||||
'Science and Technology' => 'science-and-technology',
|
||||
'Entertainment' => 'entertainment',
|
||||
'Sports' => 'sport',
|
||||
'Nature' => 'nature',
|
||||
),
|
||||
'defaultValue' => 'news',
|
||||
),
|
||||
'edition' => array(
|
||||
'name' => ' Edition',
|
||||
'type' => 'list',
|
||||
'values' => array(
|
||||
'United States' => 'us',
|
||||
'United Kingdom' => 'uk',
|
||||
'France' => 'fr',
|
||||
'India' => 'in',
|
||||
'Mexico' => 'mx',
|
||||
),
|
||||
'defaultValue' => 'us',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
const CACHE_TIMEOUT = 1800; // 30 mins
|
||||
|
||||
private $videoId = '';
|
||||
private $videoType = '';
|
||||
private $videoImage = '';
|
||||
|
||||
public function collectData() {
|
||||
|
||||
$html = getSimpleHTMLDOM($this->getURI())
|
||||
or returnServerError('Could not request: ' . $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 $index => $li) {
|
||||
$item = array();
|
||||
|
||||
$videoPath = self::URI . $li->children(0)->href;
|
||||
|
||||
$videoPageHtml = getSimpleHTMLDOMCached($videoPath, 3600)
|
||||
or returnServerError('Could not request: ' . $videoPath);
|
||||
|
||||
$this->videoImage = $videoPageHtml->find('meta[name="twitter:image"]', 0)->content;
|
||||
|
||||
$this->processTwitterImage();
|
||||
|
||||
$description = $videoPageHtml->find('div.description', 0);
|
||||
|
||||
$item['uri'] = $videoPath;
|
||||
$item['title'] = $description->find('h1', 0)->plaintext;
|
||||
|
||||
if ($description->find('div.date', 0)->children(0)) {
|
||||
$description->find('div.date', 0)->children(0)->outertext = '';
|
||||
}
|
||||
|
||||
$item['content'] = $this->processContent(
|
||||
$description
|
||||
);
|
||||
|
||||
$item['timestamp'] = $this->processDate($description);
|
||||
$item['enclosures'][] = $this->videoImage;
|
||||
|
||||
$this->items[] = $item;
|
||||
|
||||
if (count($this->items) >= 5) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getURI() {
|
||||
|
||||
if (!is_null($this->getInput('edition')) && !is_null($this->getInput('category'))) {
|
||||
return self::URI . '/' . $this->getInput('edition') . '/' . $this->getInput('category');
|
||||
}
|
||||
|
||||
return parent::getURI();
|
||||
}
|
||||
|
||||
private function processDate($description) {
|
||||
|
||||
if ($this->getInput('edition') === 'uk') {
|
||||
$date = DateTime::createFromFormat('d/m/Y H:i', $description->find('div.date', 0)->innertext);
|
||||
return strtotime($date->format('Y-m-d H:i:s'));
|
||||
}
|
||||
|
||||
return strtotime($description->find('div.date', 0)->innertext);
|
||||
}
|
||||
|
||||
private function processContent($description) {
|
||||
|
||||
$content = '<video controls poster="' . $this->videoImage . '" preload="none">
|
||||
<source src="https://content.brut.media/video/' . $this->videoId . '-' . $this->videoType . '-web.mp4"
|
||||
type="video/mp4">
|
||||
</video>';
|
||||
$content .= '<p>' . $description->find('h2.mb-1', 0)->innertext . '</p>';
|
||||
|
||||
if ($description->find('div.text.pb-3', 0)->children(1)->class != 'date') {
|
||||
$content .= '<p>' . $description->find('div.text.pb-3', 0)->children(1)->innertext . '</p>';
|
||||
}
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
private function processTwitterImage() {
|
||||
/**
|
||||
* Extract video ID + type from twitter image
|
||||
*
|
||||
* Example (wrapped):
|
||||
* https://img.brut.media/thumbnail/
|
||||
* the-life-of-rita-moreno-2cce75b5-d448-44d2-a97c-ca50d6470dd4-square.jpg
|
||||
* ?ts=1559337892
|
||||
*/
|
||||
$fpath = parse_url($this->videoImage, PHP_URL_PATH);
|
||||
$fname = basename($fpath);
|
||||
$fname = substr($fname, 0, strrpos($fname, '.'));
|
||||
$parts = explode('-', $fname);
|
||||
|
||||
if (end($parts) === 'auto') {
|
||||
$key = array_search('auto', $parts);
|
||||
unset($parts[$key]);
|
||||
}
|
||||
|
||||
$this->videoId = implode('-', array_splice($parts, -6, 5));
|
||||
$this->videoType = end($parts);
|
||||
}
|
||||
}
|
@@ -17,7 +17,6 @@ class BundesbankBridge extends BridgeAbstract {
|
||||
self::PARAM_LANG => array(
|
||||
'name' => 'Language',
|
||||
'type' => 'list',
|
||||
'required' => true,
|
||||
'defaultValue' => self::LANG_DE,
|
||||
'values' => array(
|
||||
'English' => self::LANG_EN,
|
||||
@@ -83,5 +82,4 @@ class BundesbankBridge extends BridgeAbstract {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
134
bridges/CachetBridge.php
Normal file
134
bridges/CachetBridge.php
Normal file
@@ -0,0 +1,134 @@
|
||||
<?php
|
||||
|
||||
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(
|
||||
'name' => 'Cachet installation',
|
||||
'type' => 'text',
|
||||
'required' => true,
|
||||
'title' => 'The URL of the Cachet installation',
|
||||
'exampleValue' => 'https://demo.cachethq.io/',
|
||||
), 'additional_info' => array(
|
||||
'name' => 'Additional Timestamps',
|
||||
'type' => 'checkbox',
|
||||
'title' => 'Whether to include the given timestamps'
|
||||
)
|
||||
)
|
||||
);
|
||||
const CACHE_TIMEOUT = 300;
|
||||
|
||||
private $componentCache = [];
|
||||
|
||||
public function getURI() {
|
||||
return $this->getInput('host') === null ? 'https://cachethq.io/' : $this->getInput('host');
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates the ping request to the cache API
|
||||
*
|
||||
* @param string $ping
|
||||
* @return boolean
|
||||
*/
|
||||
private function validatePing($ping) {
|
||||
$ping = json_decode($ping);
|
||||
if ($ping === null) {
|
||||
return false;
|
||||
}
|
||||
return $ping->data === 'Pong!';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the component name of a cachat component
|
||||
*
|
||||
* @param integer $id
|
||||
* @return string
|
||||
*/
|
||||
private function getComponentName($id) {
|
||||
if ($id === 0) {
|
||||
return '';
|
||||
}
|
||||
if (array_key_exists($id, $this->componentCache)) {
|
||||
return $this->componentCache[$id];
|
||||
}
|
||||
|
||||
$component = getContents($this->getURI() . '/api/v1/components/' . $id);
|
||||
$component = json_decode($component);
|
||||
if ($component === null) {
|
||||
return '';
|
||||
}
|
||||
return $component->data->name;
|
||||
}
|
||||
|
||||
public function collectData() {
|
||||
$ping = getContents(urljoin($this->getURI(), '/api/v1/ping'));
|
||||
if (!$this->validatePing($ping)) {
|
||||
returnClientError('Provided URI is invalid!');
|
||||
}
|
||||
|
||||
$url = urljoin($this->getURI(), '/api/v1/incidents?sort=id&order=desc');
|
||||
$incidents = getContents($url);
|
||||
$incidents = json_decode($incidents);
|
||||
if ($incidents === null) {
|
||||
returnClientError('/api/v1/incidents returned no valid json');
|
||||
}
|
||||
|
||||
usort($incidents->data, function ($a, $b) {
|
||||
$timeA = strtotime($a->updated_at);
|
||||
$timeB = strtotime($b->updated_at);
|
||||
return $timeA > $timeB ? -1 : 1;
|
||||
});
|
||||
|
||||
foreach ($incidents->data as $incident) {
|
||||
|
||||
if (isset($incident->permalink)) {
|
||||
$permalink = $incident->permalink;
|
||||
} else {
|
||||
$permalink = urljoin($this->getURI(), '/incident/' . $incident->id);
|
||||
}
|
||||
|
||||
$title = $incident->human_status . ': ' . $incident->name;
|
||||
$message = '';
|
||||
if ($this->getInput('additional_info')) {
|
||||
if (isset($incident->occurred_at)) {
|
||||
$message .= 'Occurred at: ' . $incident->occurred_at . "\r\n";
|
||||
}
|
||||
if (isset($incident->scheduled_at)) {
|
||||
$message .= 'Scheduled at: ' . $incident->scheduled_at . "\r\n";
|
||||
}
|
||||
if (isset($incident->created_at)) {
|
||||
$message .= 'Created at: ' . $incident->created_at . "\r\n";
|
||||
}
|
||||
if (isset($incident->updated_at)) {
|
||||
$message .= 'Updated at: ' . $incident->updated_at . "\r\n\r\n";
|
||||
}
|
||||
}
|
||||
|
||||
$message .= $incident->message;
|
||||
$content = nl2br($message);
|
||||
$componentName = $this->getComponentName($incident->component_id);
|
||||
$uidOrig = $permalink . $incident->created_at;
|
||||
$uid = hash('sha512', $uidOrig);
|
||||
$timestamp = strtotime($incident->created_at);
|
||||
$categories = [];
|
||||
$categories[] = $incident->human_status;
|
||||
if ($componentName !== '') {
|
||||
$categories[] = $componentName;
|
||||
}
|
||||
|
||||
$item = [];
|
||||
$item['uri'] = $permalink;
|
||||
$item['title'] = $title;
|
||||
$item['timestamp'] = $timestamp;
|
||||
$item['content'] = $content;
|
||||
$item['uid'] = $uid;
|
||||
$item['categories'] = $categories;
|
||||
|
||||
$this->items[] = $item;
|
||||
}
|
||||
}
|
||||
}
|
22
bridges/ComboiosDePortugalBridge.php
Normal file
22
bridges/ComboiosDePortugalBridge.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
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() {
|
||||
$html = getSimpleHTMLDOM($this->getURI() . '/consultar-horarios/avisos')
|
||||
or returnServerError('Could not load content');
|
||||
|
||||
foreach($html->find('.warnings-table a') as $element) {
|
||||
$item = array();
|
||||
|
||||
$item['title'] = $element->innertext;
|
||||
$item['uri'] = self::BASE_URI . implode('/', array_map('urlencode', explode('/', $element->href)));
|
||||
|
||||
$this->items[] = $item;
|
||||
}
|
||||
}
|
||||
}
|
@@ -15,7 +15,6 @@ class ContainerLinuxReleasesBridge extends BridgeAbstract {
|
||||
'channel' => [
|
||||
'name' => 'Release Channel',
|
||||
'type' => 'list',
|
||||
'required' => true,
|
||||
'defaultValue' => self::STABLE,
|
||||
'values' => [
|
||||
'Stable' => self::STABLE,
|
||||
|
@@ -3,7 +3,7 @@ class CourrierInternationalBridge extends BridgeAbstract {
|
||||
|
||||
const MAINTAINER = 'teromene';
|
||||
const NAME = 'Courrier International Bridge';
|
||||
const URI = 'http://CourrierInternational.com/';
|
||||
const URI = 'https://www.courrierinternational.com/';
|
||||
const CACHE_TIMEOUT = 300; // 5 min
|
||||
const DESCRIPTION = 'Courrier International bridge';
|
||||
|
||||
|
@@ -113,7 +113,33 @@ class CrewbayBridge extends BridgeAbstract {
|
||||
|
||||
foreach ($annonces as $annonce) {
|
||||
$detail = $annonce->find('.btn--profile', 0);
|
||||
$htmlDetail = getSimpleHTMLDOMCached($detail->getAttribute('data-modal-href'));
|
||||
$htmlDetail = getSimpleHTMLDOMCached($detail->href);
|
||||
|
||||
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);
|
||||
} else {
|
||||
$positions = array(str_replace('Wanted:', '', $annonce->find('.content li', 0)->plaintext));
|
||||
}
|
||||
} else {
|
||||
$list = $htmlDetail->find('.viewer-details .viewer-list');
|
||||
$positions = explode("\r\n", end($list)->find('span.value', 0)->plaintext);
|
||||
}
|
||||
|
||||
$found = false;
|
||||
$keyword = $this->getInput('status') == 'professional' ? 'professional_position' : 'recreational_position';
|
||||
foreach ($positions as $position) {
|
||||
if (strpos(trim($position), $this->getInput($keyword)) !== false) {
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$found) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$item = array();
|
||||
|
||||
@@ -134,22 +160,24 @@ class CrewbayBridge extends BridgeAbstract {
|
||||
$images = $annonce->find('.avatar img');
|
||||
$item['enclosures'] = array(end($images)->getAttribute('src'));
|
||||
|
||||
if ($this->getInput('type') == 'boats') {
|
||||
$fields = array('job', 'boat', 'skipper');
|
||||
} else {
|
||||
$fields = array('profile', 'positions', 'info', 'qualifications' , 'skills', 'references');
|
||||
}
|
||||
$content = $htmlDetail->find('.viewer-intro--info', 0)->innertext;
|
||||
|
||||
$content = '';
|
||||
foreach ($fields as $field) {
|
||||
$info = $htmlDetail->find('.profile--modal-body .info-' . $field, 0);
|
||||
if ($info) {
|
||||
$content .= $htmlDetail->find('.profile--modal-body .info-' . $field, 0)->innertext;
|
||||
$sections = $htmlDetail->find('.viewer-container .viewer-section');
|
||||
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'))) {
|
||||
// Basic sections
|
||||
$content .= $section->find('.viewer-section-title h3', 0)->outertext;
|
||||
$content .= $section->find('.viewer-section-content', 0)->innertext;
|
||||
}
|
||||
} else {
|
||||
// Info section
|
||||
$content .= $section->find('.viewer-section-content h3', 0)->outertext;
|
||||
$content .= $section->find('.viewer-section-content p', 0)->outertext;
|
||||
}
|
||||
}
|
||||
|
||||
$item['content'] = $content;
|
||||
|
||||
if (!empty($this->getInput('keyword'))) {
|
||||
$keyword = strtolower($this->getInput('keyword'));
|
||||
if (strpos(strtolower($item['title']), $keyword) === false) {
|
||||
@@ -159,28 +187,16 @@ 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);
|
||||
} else {
|
||||
$positions = array(str_replace('Wanted:', '', $annonce->find('.content li', 0)->plaintext));
|
||||
}
|
||||
} else {
|
||||
$positions = explode("\r\n", trim($htmlDetail->find('.info-positions .value', 0)->plaintext));
|
||||
}
|
||||
$item['content'] = $content;
|
||||
|
||||
$found = false;
|
||||
$keyword = $this->getInput('status') == 'professional' ? 'professional_position' : 'recreational_position';
|
||||
foreach ($positions as $position) {
|
||||
if (strpos(trim($position), $this->getInput($keyword)) !== false) {
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
$tags = $htmlDetail->find('li.viewer-tags--tag');
|
||||
foreach ($tags as $tag) {
|
||||
if (!isset($item['categories'])) {
|
||||
$item['categories'] = array();
|
||||
}
|
||||
|
||||
if (!$found) {
|
||||
continue;
|
||||
$text = trim($tag->plaintext);
|
||||
if (!in_array($text, $item['categories'])) {
|
||||
$item['categories'][] = $text;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -15,27 +15,23 @@ class DealabsBridge extends PepperBridgeAbstract {
|
||||
'hide_expired' => array(
|
||||
'name' => 'Masquer les éléments expirés',
|
||||
'type' => 'checkbox',
|
||||
'required' => 'true'
|
||||
),
|
||||
'hide_local' => array(
|
||||
'name' => 'Masquer les deals locaux',
|
||||
'type' => 'checkbox',
|
||||
'title' => 'Masquer les deals en magasins physiques',
|
||||
'required' => 'true'
|
||||
),
|
||||
'priceFrom' => array(
|
||||
'name' => 'Prix minimum',
|
||||
'type' => 'text',
|
||||
'title' => 'Prix mnimum en euros',
|
||||
'required' => 'false',
|
||||
'defaultValue' => ''
|
||||
'required' => false
|
||||
),
|
||||
'priceTo' => array(
|
||||
'name' => 'Prix maximum',
|
||||
'type' => 'text',
|
||||
'title' => 'Prix maximum en euros',
|
||||
'required' => 'false',
|
||||
'defaultValue' => ''
|
||||
'required' => false
|
||||
),
|
||||
),
|
||||
|
||||
@@ -43,7 +39,6 @@ class DealabsBridge extends PepperBridgeAbstract {
|
||||
'group' => array(
|
||||
'name' => 'Groupe',
|
||||
'type' => 'list',
|
||||
'required' => 'true',
|
||||
'title' => 'Groupe dont il faut afficher les deals',
|
||||
'values' => array(
|
||||
'Abonnements internet' => 'abonnements-internet',
|
||||
@@ -959,7 +954,6 @@ class DealabsBridge extends PepperBridgeAbstract {
|
||||
'order' => array(
|
||||
'name' => 'Trier par',
|
||||
'type' => 'list',
|
||||
'required' => 'true',
|
||||
'title' => 'Ordre de tri des deals',
|
||||
'values' => array(
|
||||
'Du deal le plus Hot au moins Hot' => '',
|
||||
@@ -1224,7 +1218,6 @@ class PepperBridgeAbstract extends BridgeAbstract {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the Shipping costs from a Deal if it exists
|
||||
* @return string String of the deal shipping Cost
|
||||
@@ -1383,8 +1376,11 @@ class PepperBridgeAbstract extends BridgeAbstract {
|
||||
|
||||
// Add the Hour and minutes
|
||||
$date_str .= ' 00:00';
|
||||
|
||||
$date = DateTime::createFromFormat('j F Y H:i', $date_str);
|
||||
// In some case, the date is not recognized : as a workaround the actual date is taken
|
||||
if($date === false) {
|
||||
$date = new DateTime();
|
||||
}
|
||||
return $date->getTimestamp();
|
||||
}
|
||||
|
||||
@@ -1457,8 +1453,6 @@ class PepperBridgeAbstract extends BridgeAbstract {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This is some "localisation" function that returns the needed content using
|
||||
* the "$lang" class variable in the local class
|
||||
@@ -1472,5 +1466,4 @@ class PepperBridgeAbstract extends BridgeAbstract {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -6,72 +6,75 @@ class DemonoidBridge extends BridgeAbstract {
|
||||
const URI = 'https://www.demonoid.pw/';
|
||||
const DESCRIPTION = 'Returns results from search';
|
||||
|
||||
const PARAMETERS = array(array(
|
||||
'q' => array(
|
||||
'name' => 'keywords',
|
||||
'exampleValue' => 'keyword1 keyword2…',
|
||||
'required' => true,
|
||||
const PARAMETERS = array(
|
||||
'Keywords' => array(
|
||||
'q' => array(
|
||||
'name' => 'keywords',
|
||||
'exampleValue' => 'keyword1 keyword2…',
|
||||
'required' => true,
|
||||
),
|
||||
'category' => array(
|
||||
'name' => 'Category',
|
||||
'type' => 'list',
|
||||
'values' => array(
|
||||
'All' => 0,
|
||||
'Movies' => 1,
|
||||
'Music' => 2,
|
||||
'TV' => 3,
|
||||
'Games' => 4,
|
||||
'Applications' => 5,
|
||||
'Pictures' => 8,
|
||||
'Anime' => 9,
|
||||
'Comics' => 10,
|
||||
'Books' => 11,
|
||||
'Audiobooks' => 17
|
||||
)
|
||||
)
|
||||
),
|
||||
'category' => array(
|
||||
'name' => 'Category',
|
||||
'type' => 'list',
|
||||
'values' => array(
|
||||
'All' => 0,
|
||||
'Movies' => 1,
|
||||
'Music' => 2,
|
||||
'TV' => 3,
|
||||
'Games' => 4,
|
||||
'Applications' => 5,
|
||||
'Pictures' => 8,
|
||||
'Anime' => 9,
|
||||
'Comics' => 10,
|
||||
'Books' => 11,
|
||||
'Audiobooks' => 17
|
||||
'Category Only' => array(
|
||||
'catOnly' => array(
|
||||
'name' => 'Category',
|
||||
'type' => 'list',
|
||||
'values' => array(
|
||||
'All' => 0,
|
||||
'Movies' => 1,
|
||||
'Music' => 2,
|
||||
'TV' => 3,
|
||||
'Games' => 4,
|
||||
'Applications' => 5,
|
||||
'Pictures' => 8,
|
||||
'Anime' => 9,
|
||||
'Comics' => 10,
|
||||
'Books' => 11,
|
||||
'Audiobooks' => 17
|
||||
)
|
||||
)
|
||||
)
|
||||
), array(
|
||||
'catOnly' => array(
|
||||
'name' => 'Category',
|
||||
'type' => 'list',
|
||||
'values' => array(
|
||||
'All' => 0,
|
||||
'Movies' => 1,
|
||||
'Music' => 2,
|
||||
'TV' => 3,
|
||||
'Games' => 4,
|
||||
'Applications' => 5,
|
||||
'Pictures' => 8,
|
||||
'Anime' => 9,
|
||||
'Comics' => 10,
|
||||
'Books' => 11,
|
||||
'Audiobooks' => 17
|
||||
)
|
||||
)
|
||||
), array(
|
||||
'userid' => array(
|
||||
'name' => 'user id',
|
||||
'exampleValue' => '00000',
|
||||
'required' => true,
|
||||
'type' => 'number'
|
||||
),
|
||||
'category' => array(
|
||||
'name' => 'Category',
|
||||
'type' => 'list',
|
||||
'values' => array(
|
||||
'All' => 0,
|
||||
'Movies' => 1,
|
||||
'Music' => 2,
|
||||
'TV' => 3,
|
||||
'Games' => 4,
|
||||
'Applications' => 5,
|
||||
'Pictures' => 8,
|
||||
'Anime' => 9,
|
||||
'Comics' => 10,
|
||||
'Books' => 11,
|
||||
'Audiobooks' => 17
|
||||
'User ID' => array(
|
||||
'userid' => array(
|
||||
'name' => 'user id',
|
||||
'exampleValue' => '00000',
|
||||
'required' => true,
|
||||
'type' => 'number'
|
||||
),
|
||||
'category' => array(
|
||||
'name' => 'Category',
|
||||
'type' => 'list',
|
||||
'values' => array(
|
||||
'All' => 0,
|
||||
'Movies' => 1,
|
||||
'Music' => 2,
|
||||
'TV' => 3,
|
||||
'Games' => 4,
|
||||
'Applications' => 5,
|
||||
'Pictures' => 8,
|
||||
'Anime' => 9,
|
||||
'Comics' => 10,
|
||||
'Books' => 11,
|
||||
'Audiobooks' => 17
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
public function collectData() {
|
||||
|
113
bridges/DerpibooruBridge.php
Normal file
113
bridges/DerpibooruBridge.php
Normal file
@@ -0,0 +1,113 @@
|
||||
<?php
|
||||
class DerpibooruBridge extends BridgeAbstract {
|
||||
const NAME = 'Derpibooru Bridge';
|
||||
const URI = 'https://derpibooru.org/';
|
||||
const DESCRIPTION = 'Returns newest posts from a Derpibooru search';
|
||||
const CACHE_TIMEOUT = 300; // 5min
|
||||
const MAINTAINER = 'Roliga';
|
||||
|
||||
const PARAMETERS = array(
|
||||
array(
|
||||
'f' => array(
|
||||
'name' => 'Filter',
|
||||
'type' => 'list',
|
||||
'values' => array(
|
||||
'Everything' => 56027,
|
||||
'18+ R34' => 37432,
|
||||
'Legacy Default' => 37431,
|
||||
'18+ Dark' => 37429,
|
||||
'Maximum Spoilers' => 37430,
|
||||
'Default' => 100073
|
||||
),
|
||||
'defaultValue' => 56027
|
||||
|
||||
),
|
||||
'q' => array(
|
||||
'name' => 'Query',
|
||||
'required' => true
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
public function detectParameters($url){
|
||||
$params = array();
|
||||
|
||||
// Search page e.g. https://derpibooru.org/search?q=cute
|
||||
$regex = '/^(https?:\/\/)?(www\.)?derpibooru.org\/search.+q=([^\/&?\n]+)/';
|
||||
if(preg_match($regex, $url, $matches) > 0) {
|
||||
$params['q'] = urldecode($matches[3]);
|
||||
return $params;
|
||||
}
|
||||
|
||||
// Tag page, e.g. https://derpibooru.org/tags/artist-colon-devinian
|
||||
$regex = '/^(https?:\/\/)?(www\.)?derpibooru.org\/tags\/([^\/&?\n]+)/';
|
||||
if(preg_match($regex, $url, $matches) > 0) {
|
||||
$params['q'] = str_replace('-colon-', ':', urldecode($matches[3]));
|
||||
return $params;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getName(){
|
||||
if(!is_null($this->getInput('q'))) {
|
||||
return 'Derpibooru search for: '
|
||||
. $this->getInput('q');
|
||||
} else {
|
||||
return parent::getName();
|
||||
}
|
||||
}
|
||||
|
||||
public function getURI(){
|
||||
if(!is_null($this->getInput('f')) && !is_null($this->getInput('q'))) {
|
||||
return self::URI
|
||||
. 'search?filter_id='
|
||||
. urlencode($this->getInput('f'))
|
||||
. '&q='
|
||||
. urlencode($this->getInput('q'));
|
||||
} else {
|
||||
return parent::getURI();
|
||||
}
|
||||
}
|
||||
|
||||
public function collectData(){
|
||||
$queryJson = json_decode(getContents(
|
||||
self::URI
|
||||
. 'search.json?filter_id='
|
||||
. urlencode($this->getInput('f'))
|
||||
. '&q='
|
||||
. urlencode($this->getInput('q'))
|
||||
)) or returnServerError('Failed to query Derpibooru');
|
||||
|
||||
foreach($queryJson->search as $post) {
|
||||
$item = array();
|
||||
|
||||
$postUri = self::URI . $post->id;
|
||||
|
||||
$item['uri'] = $postUri;
|
||||
$item['title'] = $post->id;
|
||||
$item['timestamp'] = strtotime($post->created_at);
|
||||
$item['author'] = $post->uploader;
|
||||
$item['enclosures'] = array('https:' . $post->image);
|
||||
$item['categories'] = explode(', ', $post->tags);
|
||||
|
||||
$item['content'] = '<p><a href="' // image preview
|
||||
. $postUri
|
||||
. '"><img src="https:'
|
||||
. $post->representations->medium
|
||||
. '"></a></p><p>' // description
|
||||
. $post->description
|
||||
. '</p><p><b>Size:</b> ' // image size
|
||||
. $post->width
|
||||
. 'x'
|
||||
. $post->height
|
||||
. '<br><b>Source:</b> <a href="' // source link
|
||||
. $post->source_url
|
||||
. '">'
|
||||
. $post->source_url
|
||||
. '</a></p>';
|
||||
|
||||
$this->items[] = $item;
|
||||
}
|
||||
}
|
||||
}
|
@@ -15,7 +15,6 @@ class DesoutterBridge extends BridgeAbstract {
|
||||
'news_lang' => array(
|
||||
'name' => 'Language',
|
||||
'type' => 'list',
|
||||
'required' => true,
|
||||
'title' => 'Select your language',
|
||||
'defaultValue' => 'Corporate',
|
||||
'values' => array(
|
||||
@@ -66,7 +65,6 @@ class DesoutterBridge extends BridgeAbstract {
|
||||
'industry_lang' => array(
|
||||
'name' => 'Language',
|
||||
'type' => 'list',
|
||||
'required' => true,
|
||||
'title' => 'Select your language',
|
||||
'defaultValue' => 'Corporate',
|
||||
'values' => array(
|
||||
@@ -117,7 +115,6 @@ class DesoutterBridge extends BridgeAbstract {
|
||||
'full' => array(
|
||||
'name' => 'Load full articles',
|
||||
'type' => 'checkbox',
|
||||
'required' => false,
|
||||
'title' => 'Enable to load the full article for each item'
|
||||
)
|
||||
)
|
||||
@@ -236,5 +233,4 @@ class DesoutterBridge extends BridgeAbstract {
|
||||
|
||||
echo $list;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -22,8 +22,7 @@ class DevToBridge extends BridgeAbstract {
|
||||
'name' => 'Full article',
|
||||
'type' => 'checkbox',
|
||||
'required' => false,
|
||||
'title' => 'Enable to receive the full article for each item',
|
||||
'defaultValue' => false
|
||||
'title' => 'Enable to receive the full article for each item'
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -101,5 +100,4 @@ EOD;
|
||||
|
||||
return $html->find('[id="article-body"]', 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@ class DilbertBridge extends BridgeAbstract {
|
||||
|
||||
const MAINTAINER = 'kranack';
|
||||
const NAME = 'Dilbert Daily Strip';
|
||||
const URI = 'http://dilbert.com';
|
||||
const URI = 'https://dilbert.com';
|
||||
const CACHE_TIMEOUT = 21600; // 6h
|
||||
const DESCRIPTION = 'The Unofficial Dilbert Daily Comic Strip';
|
||||
|
||||
@@ -17,9 +17,9 @@ class DilbertBridge extends BridgeAbstract {
|
||||
$img = $element->find('img', 0);
|
||||
$link = $element->find('a', 0);
|
||||
$comic = $img->src;
|
||||
$title = $link->alt;
|
||||
$title = $img->alt;
|
||||
$url = $link->href;
|
||||
$date = substr($url, 25);
|
||||
$date = substr(strrchr($url, '/'), 1);
|
||||
if (empty($title))
|
||||
$title = 'Dilbert Comic Strip on ' . $date;
|
||||
$date = strtotime($date);
|
||||
|
@@ -62,7 +62,11 @@ class DiscogsBridge extends BridgeAbstract {
|
||||
$item['id'] = $release['id'];
|
||||
$resId = array_key_exists('main_release', $release) ? $release['main_release'] : $release['id'];
|
||||
$item['uri'] = self::URI . $this->getInput('artistid') . '/release/' . $resId;
|
||||
$item['timestamp'] = DateTime::createFromFormat('Y', $release['year'])->getTimestamp();
|
||||
|
||||
if(isset($release['year'])) {
|
||||
$item['timestamp'] = DateTime::createFromFormat('Y', $release['year'])->getTimestamp();
|
||||
}
|
||||
|
||||
$item['content'] = $item['author'] . ' - ' . $item['title'];
|
||||
$this->items[] = $item;
|
||||
}
|
||||
|
63
bridges/EconomistBridge.php
Normal file
63
bridges/EconomistBridge.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
class EconomistBridge extends BridgeAbstract {
|
||||
const NAME = 'The Economist: Latest Updates';
|
||||
const URI = 'https://www.economist.com';
|
||||
const DESCRIPTION = 'Fetches the latest updates from the Economist.';
|
||||
const MAINTAINER = 'thefranke';
|
||||
const CACHE_TIMEOUT = 3600; // 1h
|
||||
|
||||
public function getIcon() {
|
||||
return 'https://www.economist.com/sites/default/files/econfinal_favicon.ico';
|
||||
}
|
||||
|
||||
public function collectData() {
|
||||
$html = getSimpleHTMLDOM(self::URI . '/latest/')
|
||||
or returnServerError('Could not fetch latest updates form The Economist.');
|
||||
|
||||
foreach($html->find('article') as $element) {
|
||||
|
||||
$a = $element->find('a', 0);
|
||||
$href = self::URI . $a->href;
|
||||
$full = getSimpleHTMLDOMCached($href);
|
||||
$article = $full->find('article', 0);
|
||||
|
||||
$header = $article->find('h1', 0);
|
||||
$author = $article->find('span[itemprop="author"]', 0);
|
||||
$time = $article->find('time[itemprop="dateCreated"]', 0);
|
||||
$content = $article->find('div[itemprop="description"]', 0);
|
||||
|
||||
// Remove newsletter subscription box
|
||||
$newsletter = $content->find('div[class="newsletter-form__message"]', 0);
|
||||
if ($newsletter)
|
||||
$newsletter->outertext = '';
|
||||
|
||||
$newsletterForm = $content->find('form', 0);
|
||||
if ($newsletterForm)
|
||||
$newsletterForm->outertext = '';
|
||||
|
||||
// Remove next and previous article URLs at the bottom
|
||||
$nextprev = $content->find('div[class="blog-post__next-previous-wrapper"]', 0);
|
||||
if ($nextprev)
|
||||
$nextprev->outertext = '';
|
||||
|
||||
$section = [ $article->find('h3[itemprop="articleSection"]', 0)->plaintext ];
|
||||
|
||||
$item = array();
|
||||
$item['title'] = $header->find('span', 0)->innertext . ': '
|
||||
. $header->find('span', 1)->innertext;
|
||||
|
||||
$item['uri'] = $href;
|
||||
$item['timestamp'] = strtotime($time->datetime);
|
||||
$item['author'] = $author->innertext;
|
||||
$item['categories'] = $section;
|
||||
|
||||
$item['content'] = '<img style="max-width: 100%" src="'
|
||||
. $a->find('img', 0)->src . '">' . $content->innertext;
|
||||
|
||||
$this->items[] = $item;
|
||||
|
||||
if (count($this->items) >= 10)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
@@ -6,25 +6,36 @@ class EliteDangerousGalnetBridge extends BridgeAbstract {
|
||||
const URI = 'https://community.elitedangerous.com/galnet/';
|
||||
const CACHE_TIMEOUT = 7200; // 2h
|
||||
const DESCRIPTION = 'Returns the latest page of news from Galnet';
|
||||
|
||||
public function getIcon() {
|
||||
return 'https://community.elitedangerous.com/sites/
|
||||
EDSITE_COMM/themes/bootstrap/bootstrap_community/favicon.ico';
|
||||
}
|
||||
const PARAMETERS = array(
|
||||
array(
|
||||
'language' => array(
|
||||
'name' => 'Language',
|
||||
'type' => 'list',
|
||||
'values' => array(
|
||||
'English' => 'en',
|
||||
'French' => 'fr',
|
||||
'German' => 'de'
|
||||
),
|
||||
'defaultValue' => 'en'
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
public function collectData(){
|
||||
$html = getSimpleHTMLDOM(self::URI)
|
||||
$language = $this->getInput('language');
|
||||
$url = 'https://community.elitedangerous.com/';
|
||||
$url = $url . $language . '/galnet';
|
||||
$html = getSimpleHTMLDOM($url)
|
||||
or returnServerError('Error while downloading the website content');
|
||||
|
||||
foreach($html->find('div.article') as $element) {
|
||||
$item = array();
|
||||
|
||||
$uri = $element->find('h3 a', 0)->href;
|
||||
$uri = self::URI . substr($uri, strlen('/galnet/'));
|
||||
$uri = 'https://community.elitedangerous.com/' . $language . $uri;
|
||||
$item['uri'] = $uri;
|
||||
|
||||
$title = $element->find('h3 a', 0)->plaintext;
|
||||
$item['title'] = substr($title, 1); //remove the space between icon and title
|
||||
$item['title'] = $element->find('h3 a', 0)->plaintext;
|
||||
|
||||
$content = $element->find('p', -1)->innertext;
|
||||
$item['content'] = $content;
|
||||
|
@@ -120,9 +120,9 @@ class ElloBridge extends BridgeAbstract {
|
||||
}
|
||||
|
||||
private function getAPIKey() {
|
||||
$cache = Cache::create('FileCache');
|
||||
$cache->setPath(PATH_CACHE);
|
||||
$cache->setParameters(['key']);
|
||||
$cache = Cache::create(Configuration::getConfig('cache', 'type'));
|
||||
$cache->setScope(get_called_class());
|
||||
$cache->setKey(['key']);
|
||||
$key = $cache->loadData();
|
||||
|
||||
if($key == null) {
|
||||
@@ -143,5 +143,4 @@ class ElloBridge extends BridgeAbstract {
|
||||
|
||||
return parent::getName();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -15,7 +15,6 @@ class ExtremeDownloadBridge extends BridgeAbstract {
|
||||
'filter' => array(
|
||||
'name' => 'Type de contenu',
|
||||
'type' => 'list',
|
||||
'required' => 'true',
|
||||
'title' => 'Type de contenu à suivre : Téléchargement, Streaming ou les deux',
|
||||
'values' => array(
|
||||
'Streaming et Téléchargement' => 'both',
|
||||
@@ -100,5 +99,4 @@ class ExtremeDownloadBridge extends BridgeAbstract {
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -72,15 +72,15 @@ class FB2Bridge extends BridgeAbstract {
|
||||
$pageInfo = $this->getPageInfos($page, $cookies);
|
||||
|
||||
if($pageInfo['userId'] === null) {
|
||||
echo <<<EOD
|
||||
returnClientError(<<<EOD
|
||||
Unable to get the page id. You should consider getting the ID by hand, then importing it into FB2Bridge
|
||||
EOD;
|
||||
die();
|
||||
EOD
|
||||
);
|
||||
} elseif($pageInfo['userId'] == -1) {
|
||||
echo <<<EOD
|
||||
returnClientError(<<<EOD
|
||||
This page is not accessible without being logged in.
|
||||
EOD;
|
||||
die();
|
||||
EOD
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ EOD;
|
||||
foreach($html->find('article') as $content) {
|
||||
|
||||
$item = array();
|
||||
//echo $content; die();
|
||||
|
||||
preg_match('/publish_time\\\":([0-9]+),/', $content->getAttribute('data-store', 0), $match);
|
||||
if(isset($match[1]))
|
||||
$timestamp = $match[1];
|
||||
@@ -103,7 +103,7 @@ EOD;
|
||||
$timestamp = 0;
|
||||
|
||||
$item['uri'] = html_entity_decode('http://touch.facebook.com'
|
||||
. $content->find("div[class='_52jc _5qc4 _24u0 _36xo']", 0)->find('a', 0)->getAttribute('href'), ENT_QUOTES);
|
||||
. $content->find("div[class='_52jc _5qc4 _78cz _24u0 _36xo']", 0)->find('a', 0)->getAttribute('href'), ENT_QUOTES);
|
||||
|
||||
//Decode images
|
||||
$imagecleaned = preg_replace_callback('/<i [^>]* style="[^"]*url\(\'(.*?)\'\).*?><\/i>/m', function ($matches) {
|
||||
@@ -198,7 +198,6 @@ EOD;
|
||||
|
||||
}
|
||||
|
||||
|
||||
//Builds the HTML from the encoded JS that Facebook provides.
|
||||
private function buildContent($pageContent){
|
||||
// The html ends with:
|
||||
@@ -213,7 +212,6 @@ EOD;
|
||||
return str_get_html($htmlContent);
|
||||
}
|
||||
|
||||
|
||||
//Builds the cookie from the page, as Facebook sometimes refuses to give
|
||||
//the page if no cookie is provided.
|
||||
private function getCookies($pageURL){
|
||||
@@ -289,5 +287,4 @@ EOD;
|
||||
public function getURI(){
|
||||
return 'http://facebook.com';
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -11,7 +11,6 @@ class FDroidBridge extends BridgeAbstract {
|
||||
'u' => array(
|
||||
'name' => 'Widget selection',
|
||||
'type' => 'list',
|
||||
'required' => true,
|
||||
'values' => array(
|
||||
'Latest added apps' => 'added',
|
||||
'Latest updated apps' => 'updated'
|
||||
@@ -29,14 +28,14 @@ class FDroidBridge extends BridgeAbstract {
|
||||
or returnServerError('Could not request F-Droid.');
|
||||
|
||||
// targetting the corresponding widget based on user selection
|
||||
// "updated" is the 4th widget on the page, "added" is the 5th
|
||||
// "updated" is the 5th widget on the page, "added" is the 6th
|
||||
|
||||
switch($this->getInput('u')) {
|
||||
case 'updated':
|
||||
$html_widget = $html->find('div.sidebar-widget', 4);
|
||||
$html_widget = $html->find('div.sidebar-widget', 5);
|
||||
break;
|
||||
default:
|
||||
$html_widget = $html->find('div.sidebar-widget', 5);
|
||||
$html_widget = $html->find('div.sidebar-widget', 6);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@@ -179,8 +179,7 @@ class FacebookBridge extends BridgeAbstract {
|
||||
|
||||
if(filter_var(
|
||||
$group,
|
||||
FILTER_VALIDATE_URL,
|
||||
FILTER_FLAG_HOST_REQUIRED | FILTER_FLAG_PATH_REQUIRED)) {
|
||||
FILTER_VALIDATE_URL, FILTER_FLAG_PATH_REQUIRED)) {
|
||||
// User provided a URL
|
||||
|
||||
$urlparts = parse_url($group);
|
||||
@@ -220,8 +219,7 @@ class FacebookBridge extends BridgeAbstract {
|
||||
$ogtitle = $html->find('meta[property="og:title"]', 0)
|
||||
or returnServerError('Unable to find group title!');
|
||||
|
||||
return htmlspecialchars_decode($ogtitle->content, ENT_QUOTES);
|
||||
|
||||
return html_entity_decode($ogtitle->content, ENT_QUOTES);
|
||||
}
|
||||
|
||||
private function extractGroupURI($post) {
|
||||
@@ -659,14 +657,8 @@ EOD;
|
||||
$date = 0;
|
||||
}
|
||||
|
||||
// Build title from username and content
|
||||
$title = $author;
|
||||
|
||||
if(strlen($title) > 24)
|
||||
$title = substr($title, 0, strpos(wordwrap($title, 24), "\n")) . '...';
|
||||
|
||||
$title = $title . ' | ' . strip_tags($content);
|
||||
|
||||
// Build title from content
|
||||
$title = strip_tags($post->find('.userContent', 0)->innertext);
|
||||
if(strlen($title) > 64)
|
||||
$title = substr($title, 0, strpos(wordwrap($title, 64), "\n")) . '...';
|
||||
|
||||
@@ -677,10 +669,10 @@ EOD;
|
||||
}
|
||||
|
||||
//Build and add final item
|
||||
$item['uri'] = htmlspecialchars_decode($uri);
|
||||
$item['content'] = htmlspecialchars_decode($content);
|
||||
$item['title'] = $title;
|
||||
$item['author'] = $author;
|
||||
$item['uri'] = htmlspecialchars_decode($uri, ENT_QUOTES);
|
||||
$item['content'] = htmlspecialchars_decode($content, ENT_QUOTES);
|
||||
$item['title'] = htmlspecialchars_decode($title, ENT_QUOTES);
|
||||
$item['author'] = htmlspecialchars_decode($author, ENT_QUOTES);
|
||||
$item['timestamp'] = $date;
|
||||
|
||||
if(strpos($item['content'], '<img') === false) {
|
||||
@@ -693,7 +685,6 @@ EOD;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion (User)
|
||||
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@ class FeedExpanderExampleBridge extends FeedExpander {
|
||||
|
||||
const MAINTAINER = 'logmanoriginal';
|
||||
const NAME = 'FeedExpander Example';
|
||||
const URI = '#';
|
||||
const URI = 'http://github.com/RSS-Bridge/rss-bridge/';
|
||||
const DESCRIPTION = 'Example bridge to test FeedExpander';
|
||||
|
||||
const PARAMETERS = array(
|
||||
@@ -11,7 +11,6 @@ class FeedExpanderExampleBridge extends FeedExpander {
|
||||
'version' => array(
|
||||
'name' => 'Version',
|
||||
'type' => 'list',
|
||||
'required' => true,
|
||||
'title' => 'Select your feed format/version',
|
||||
'defaultValue' => 'RSS 2.0',
|
||||
'values' => array(
|
||||
|
@@ -94,7 +94,7 @@ class FilterBridge extends FeedExpander {
|
||||
}
|
||||
try{
|
||||
$this->collectExpandableDatas($this->getURI());
|
||||
} catch (HttpException $e) {
|
||||
} catch (Exception $e) {
|
||||
$this->collectExpandableDatas($this->getURI());
|
||||
}
|
||||
}
|
||||
|
@@ -62,10 +62,10 @@ class FindACrewBridge extends BridgeAbstract {
|
||||
foreach ($annonces as $annonce) {
|
||||
$item = array();
|
||||
|
||||
$img = parent::getURI() . $annonce->find('.css_LstPic img', 0)->getAttribute('src');
|
||||
$item['title'] = $annonce->find('.css_LstCtrls span', 0)->plaintext;
|
||||
$item['uri'] = parent::getURI() . $annonce->find('.css_PnlCtrls a', 0)->href;
|
||||
$content = $annonce->find('.css_LstDtl div', 2)->innertext;
|
||||
$img = parent::getURI() . $annonce->find('.lst-pic img', 0)->getAttribute('src');
|
||||
$item['title'] = $annonce->find('.lst-tags span', 0)->plaintext;
|
||||
$item['uri'] = parent::getURI() . $annonce->find('.lst-ctrls a', 0)->href;
|
||||
$content = $annonce->find('.lst-dtl', 0)->innertext;
|
||||
$item['content'] = "<img src='$img' /><br>$content";
|
||||
$item['enclosures'] = array($img);
|
||||
$item['categories'] = array($annonce->find('.css_AccLocCur', 0)->plaintext);
|
||||
|
@@ -182,5 +182,4 @@ class FlickrBridge extends BridgeAbstract {
|
||||
return $url;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -37,5 +37,4 @@ class ForGifsBridge extends FeedExpander {
|
||||
return $item;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -10,7 +10,6 @@ class GBAtempBridge extends BridgeAbstract {
|
||||
'type' => array(
|
||||
'name' => 'Type',
|
||||
'type' => 'list',
|
||||
'required' => true,
|
||||
'values' => array(
|
||||
'News' => 'N',
|
||||
'Reviews' => 'R',
|
||||
|
@@ -8,8 +8,8 @@ class GOGBridge extends BridgeAbstract {
|
||||
|
||||
public function collectData() {
|
||||
|
||||
$values = getContents('https://www.gog.com/games/ajax/filtered?limit=25&sort=new') or
|
||||
die('Unable to get the news pages from GOG !');
|
||||
$values = getContents('https://www.gog.com/games/ajax/filtered?limit=25&sort=new')
|
||||
or returnServerError('Unable to get the news pages from GOG !');
|
||||
$decodedValues = json_decode($values);
|
||||
|
||||
$limit = 0;
|
||||
@@ -38,8 +38,8 @@ class GOGBridge extends BridgeAbstract {
|
||||
|
||||
private function buildGameContentPage($game) {
|
||||
|
||||
$gameDescriptionText = getContents('https://api.gog.com/products/' . $game->id . '?expand=description') or
|
||||
die('Unable to get game description from GOG !');
|
||||
$gameDescriptionText = getContents('https://api.gog.com/products/' . $game->id . '?expand=description')
|
||||
or returnServerError('Unable to get game description from GOG !');
|
||||
|
||||
$gameDescriptionValue = json_decode($gameDescriptionText);
|
||||
|
||||
@@ -62,5 +62,4 @@ class GOGBridge extends BridgeAbstract {
|
||||
return $content;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -9,7 +9,6 @@
|
||||
*/
|
||||
class GQMagazineBridge extends BridgeAbstract
|
||||
{
|
||||
|
||||
const MAINTAINER = 'Riduidel';
|
||||
|
||||
const NAME = 'GQMagazine';
|
||||
@@ -20,18 +19,18 @@ class GQMagazineBridge extends BridgeAbstract
|
||||
const CACHE_TIMEOUT = 7200; // 2h
|
||||
const DESCRIPTION = 'GQMagazine section extractor bridge. This bridge allows you get only a specific section.';
|
||||
|
||||
const DEFAULT_DOMAIN = 'www.gqmagazine.fr';
|
||||
|
||||
const PARAMETERS = array( array(
|
||||
'domain' => array(
|
||||
'name' => 'Domain to use',
|
||||
'required' => true,
|
||||
'values' => array(
|
||||
'www.gqmagazine.fr' => 'www.gqmagazine.fr'
|
||||
),
|
||||
'defaultValue' => 'www.gqmagazine.fr'
|
||||
'defaultValue' => self::DEFAULT_DOMAIN
|
||||
),
|
||||
'page' => array(
|
||||
'name' => 'Initial page to load',
|
||||
'required' => true
|
||||
'required' => true,
|
||||
'exampleValue' => 'sexe/news'
|
||||
),
|
||||
));
|
||||
|
||||
@@ -42,7 +41,12 @@ class GQMagazineBridge extends BridgeAbstract
|
||||
);
|
||||
|
||||
private function getDomain() {
|
||||
return $this->getInput('domain');
|
||||
$domain = $this->getInput('domain');
|
||||
if (empty($domain))
|
||||
$domain = self::DEFAULT_DOMAIN;
|
||||
if (strpos($domain, '://') === false)
|
||||
$domain = 'https://' . $domain;
|
||||
return $domain;
|
||||
}
|
||||
|
||||
public function getURI()
|
||||
|
@@ -160,5 +160,4 @@ EOD;
|
||||
return $content;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -28,7 +28,7 @@ class GithubIssueBridge extends BridgeAbstract {
|
||||
'i' => array(
|
||||
'name' => 'Issue number',
|
||||
'type' => 'number',
|
||||
'required' => 'true'
|
||||
'required' => true
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -37,10 +37,9 @@ class GithubIssueBridge extends BridgeAbstract {
|
||||
$name = $this->getInput('u') . '/' . $this->getInput('p');
|
||||
switch($this->queriedContext) {
|
||||
case 'Project Issues':
|
||||
$prefix = static::NAME . 's for ';
|
||||
if($this->getInput('c')) {
|
||||
$prefix = static::NAME . 's comments for ';
|
||||
} else {
|
||||
$prefix = static::NAME . 's for ';
|
||||
}
|
||||
$name = $prefix . $name;
|
||||
break;
|
||||
@@ -53,8 +52,9 @@ class GithubIssueBridge extends BridgeAbstract {
|
||||
}
|
||||
|
||||
public function getURI(){
|
||||
if(!is_null($this->getInput('u')) && !is_null($this->getInput('p'))) {
|
||||
$uri = static::URI . $this->getInput('u') . '/' . $this->getInput('p') . '/issues';
|
||||
if(null !== $this->getInput('u') && null !== $this->getInput('p')) {
|
||||
$uri = static::URI . $this->getInput('u') . '/'
|
||||
. $this->getInput('p') . '/issues';
|
||||
if($this->queriedContext === 'Issue comments') {
|
||||
$uri .= '/' . $this->getInput('i');
|
||||
} elseif($this->getInput('c')) {
|
||||
@@ -66,54 +66,54 @@ class GithubIssueBridge extends BridgeAbstract {
|
||||
return parent::getURI();
|
||||
}
|
||||
|
||||
protected function extractIssueComment($issueNbr, $title, $comment){
|
||||
$class = $comment->getAttribute('class');
|
||||
$classes = explode(' ', $class);
|
||||
$event = false;
|
||||
if(in_array('discussion-item', $classes)) {
|
||||
$event = true;
|
||||
}
|
||||
|
||||
$author = 'unknown';
|
||||
if($comment->find('.author', 0)) {
|
||||
$author = $comment->find('.author', 0)->plaintext;
|
||||
}
|
||||
|
||||
$uri = static::URI . $this->getInput('u') . '/' . $this->getInput('p') . '/issues/' . $issueNbr;
|
||||
|
||||
protected function extractIssueEvent($issueNbr, $title, $comment){
|
||||
$comment = $comment->firstChild();
|
||||
if(!$event) {
|
||||
$comment = $comment->nextSibling();
|
||||
}
|
||||
$uri = static::URI . $this->getInput('u') . '/' . $this->getInput('p')
|
||||
. '/issues/' . $issueNbr . '#' . $comment->getAttribute('id');
|
||||
|
||||
if($event) {
|
||||
$title .= ' / ' . substr($class, strpos($class, 'discussion-item-') + strlen('discussion-item-'));
|
||||
if(!$comment->hasAttribute('id')) {
|
||||
$items = array();
|
||||
$timestamp = strtotime($comment->find('relative-time', 0)->getAttribute('datetime'));
|
||||
$content = $comment->innertext;
|
||||
while($comment = $comment->nextSibling()) {
|
||||
$item = array();
|
||||
$item['author'] = $author;
|
||||
$item['title'] = html_entity_decode($title, ENT_QUOTES, 'UTF-8');
|
||||
$item['timestamp'] = $timestamp;
|
||||
$item['content'] = $content . '<p>' . $comment->children(1)->innertext . '</p>';
|
||||
$item['uri'] = $uri . '#' . $comment->children(1)->getAttribute('id');
|
||||
$items[] = $item;
|
||||
}
|
||||
return $items;
|
||||
$author = $comment->find('.author', 0)->plaintext;
|
||||
|
||||
$title .= ' / ' . trim($comment->plaintext);
|
||||
|
||||
$content = $title;
|
||||
if (null !== $comment->nextSibling()) {
|
||||
$content = $comment->nextSibling()->innertext;
|
||||
if ($comment->nextSibling()->nodeName() === 'span') {
|
||||
$content = $comment->nextSibling()->nextSibling()->innertext;
|
||||
}
|
||||
$content = $comment->parent()->innertext;
|
||||
} else {
|
||||
$title .= ' / ' . trim($comment->firstChild()->plaintext);
|
||||
$content = '<pre>' . $comment->find('.comment-body', 0)->innertext . '</pre>';
|
||||
}
|
||||
|
||||
$item = array();
|
||||
$item['author'] = $author;
|
||||
$item['uri'] = $uri . '#' . $comment->getAttribute('id');
|
||||
$item['uri'] = $uri;
|
||||
$item['title'] = html_entity_decode($title, ENT_QUOTES, 'UTF-8');
|
||||
$item['timestamp'] = strtotime($comment->find('relative-time', 0)->getAttribute('datetime'));
|
||||
$item['timestamp'] = strtotime(
|
||||
$comment->find('relative-time', 0)->getAttribute('datetime')
|
||||
);
|
||||
$item['content'] = $content;
|
||||
return $item;
|
||||
}
|
||||
|
||||
protected function extractIssueComment($issueNbr, $title, $comment){
|
||||
$uri = static::URI . $this->getInput('u') . '/'
|
||||
. $this->getInput('p') . '/issues/' . $issueNbr;
|
||||
|
||||
$author = $comment->find('.author', 0)->plaintext;
|
||||
|
||||
$title .= ' / ' . trim(
|
||||
$comment->find('.comment .timeline-comment-header-text', 0)->plaintext
|
||||
);
|
||||
|
||||
$content = $comment->find('.comment-body', 0)->innertext;
|
||||
|
||||
$item = array();
|
||||
$item['author'] = $author;
|
||||
$item['uri'] = $uri
|
||||
. '#' . $comment->firstChild()->nextSibling()->getAttribute('id');
|
||||
$item['title'] = html_entity_decode($title, ENT_QUOTES, 'UTF-8');
|
||||
$item['timestamp'] = strtotime(
|
||||
$comment->find('relative-time', 0)->getAttribute('datetime')
|
||||
);
|
||||
$item['content'] = $content;
|
||||
return $item;
|
||||
}
|
||||
@@ -121,17 +121,29 @@ class GithubIssueBridge extends BridgeAbstract {
|
||||
protected function extractIssueComments($issue){
|
||||
$items = array();
|
||||
$title = $issue->find('.gh-header-title', 0)->plaintext;
|
||||
$issueNbr = trim(substr($issue->find('.gh-header-number', 0)->plaintext, 1));
|
||||
$issueNbr = trim(
|
||||
substr($issue->find('.gh-header-number', 0)->plaintext, 1)
|
||||
);
|
||||
$comments = $issue->find('.js-discussion', 0);
|
||||
foreach($comments->children() as $comment) {
|
||||
if (!$comment->hasChildNodes()) {
|
||||
continue;
|
||||
}
|
||||
$comment = $comment->firstChild();
|
||||
$classes = explode(' ', $comment->getAttribute('class'));
|
||||
if(in_array('discussion-item', $classes)
|
||||
|| in_array('timeline-comment-wrapper', $classes)) {
|
||||
if (in_array('timeline-comment-wrapper', $classes)) {
|
||||
$item = $this->extractIssueComment($issueNbr, $title, $comment);
|
||||
if(array_keys($item) !== range(0, count($item) - 1)) {
|
||||
$item = array($item);
|
||||
$items[] = $item;
|
||||
continue;
|
||||
}
|
||||
while (in_array('discussion-item', $classes)) {
|
||||
$item = $this->extractIssueEvent($issueNbr, $title, $comment);
|
||||
$items[] = $item;
|
||||
$comment = $comment->nextSibling();
|
||||
if (null == $comment) {
|
||||
break;
|
||||
}
|
||||
$items = array_merge($items, $item);
|
||||
$classes = explode(' ', $comment->getAttribute('class'));
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
@@ -139,7 +151,9 @@ class GithubIssueBridge extends BridgeAbstract {
|
||||
|
||||
public function collectData(){
|
||||
$html = getSimpleHTMLDOM($this->getURI())
|
||||
or returnServerError('No results for Github Issue ' . $this->getURI());
|
||||
or returnServerError(
|
||||
'No results for Github Issue ' . $this->getURI()
|
||||
);
|
||||
|
||||
switch($this->queriedContext) {
|
||||
case 'Issue comments':
|
||||
@@ -148,31 +162,40 @@ class GithubIssueBridge extends BridgeAbstract {
|
||||
case 'Project Issues':
|
||||
foreach($html->find('.js-active-navigation-container .js-navigation-item') as $issue) {
|
||||
$info = $issue->find('.opened-by', 0);
|
||||
$issueNbr = substr(trim($info->plaintext), 1, strpos(trim($info->plaintext), ' '));
|
||||
$issueNbr = substr(
|
||||
trim($info->plaintext), 1, strpos(trim($info->plaintext), ' ')
|
||||
);
|
||||
|
||||
$item = array();
|
||||
$item['content'] = '';
|
||||
|
||||
if($this->getInput('c')) {
|
||||
$uri = static::URI . $this->getInput('u') . '/' . $this->getInput('p') . '/issues/' . $issueNbr;
|
||||
$uri = static::URI . $this->getInput('u')
|
||||
. '/' . $this->getInput('p') . '/issues/' . $issueNbr;
|
||||
$issue = getSimpleHTMLDOMCached($uri, static::CACHE_TIMEOUT);
|
||||
if($issue) {
|
||||
$this->items = array_merge($this->items, $this->extractIssueComments($issue));
|
||||
$this->items = array_merge(
|
||||
$this->items,
|
||||
$this->extractIssueComments($issue)
|
||||
);
|
||||
continue;
|
||||
}
|
||||
$item['content'] = 'Can not extract comments from ' . $uri;
|
||||
}
|
||||
|
||||
$item['author'] = $info->find('a', 0)->plaintext;
|
||||
$item['timestamp'] = strtotime($info->find('relative-time', 0)->getAttribute('datetime'));
|
||||
$item['timestamp'] = strtotime(
|
||||
$info->find('relative-time', 0)->getAttribute('datetime')
|
||||
);
|
||||
$item['title'] = html_entity_decode(
|
||||
$issue->find('.js-navigation-open', 0)->plaintext,
|
||||
ENT_QUOTES,
|
||||
'UTF-8'
|
||||
);
|
||||
$comments = $issue->find('.col-5', 0)->plaintext;
|
||||
$comments = trim($issue->find('.col-5', 0)->plaintext);
|
||||
$item['content'] .= "\n" . 'Comments: ' . ($comments ? $comments : '0');
|
||||
$item['uri'] = self::URI . $issue->find('.js-navigation-open', 0)->getAttribute('href');
|
||||
$item['uri'] = self::URI
|
||||
. $issue->find('.js-navigation-open', 0)->getAttribute('href');
|
||||
$this->items[] = $item;
|
||||
}
|
||||
break;
|
||||
@@ -180,7 +203,11 @@ class GithubIssueBridge extends BridgeAbstract {
|
||||
|
||||
array_walk($this->items, function(&$item){
|
||||
$item['content'] = preg_replace('/\s+/', ' ', $item['content']);
|
||||
$item['content'] = str_replace('href="/', 'href="' . static::URI, $item['content']);
|
||||
$item['content'] = str_replace(
|
||||
'href="/',
|
||||
'href="' . static::URI,
|
||||
$item['content']
|
||||
);
|
||||
$item['content'] = str_replace(
|
||||
'href="#',
|
||||
'href="' . substr($item['uri'], 0, strpos($item['uri'], '#') + 1),
|
||||
|
@@ -24,7 +24,7 @@ class GithubSearchBridge extends BridgeAbstract {
|
||||
$html = getSimpleHTMLDOM($url)
|
||||
or returnServerError('Error while downloading the website content');
|
||||
|
||||
foreach($html->find('div.repo-list-item') as $element) {
|
||||
foreach($html->find('li.repo-list-item') as $element) {
|
||||
$item = array();
|
||||
|
||||
$uri = $element->find('h3 a', 0)->href;
|
||||
|
5
bridges/GlassdoorBridge.php
Executable file → Normal file
5
bridges/GlassdoorBridge.php
Executable file → Normal file
@@ -117,7 +117,7 @@ class GlassdoorBridge extends BridgeAbstract {
|
||||
$item['title'] = $post->find('header', 0)->plaintext;
|
||||
$item['content'] = $post->find('div[class="excerpt-content"]', 0)->plaintext;
|
||||
$item['enclosures'] = array(
|
||||
$this->getFullSizeImageURI($post->find('div[class="post-thumb"]', 0)->{'data-original'})
|
||||
$this->getFullSizeImageURI($post->find('div[class*="post-thumb"]', 0)->{'data-original'})
|
||||
);
|
||||
|
||||
// optionally load full articles
|
||||
@@ -186,8 +186,7 @@ class GlassdoorBridge extends BridgeAbstract {
|
||||
* redirection and strange naming conventions.
|
||||
*/
|
||||
if(!filter_var($uri,
|
||||
FILTER_VALIDATE_URL,
|
||||
FILTER_FLAG_SCHEME_REQUIRED | FILTER_FLAG_HOST_REQUIRED | FILTER_FLAG_PATH_REQUIRED)) {
|
||||
FILTER_VALIDATE_URL, FILTER_FLAG_PATH_REQUIRED)) {
|
||||
returnClientError('The specified URL is invalid!');
|
||||
}
|
||||
|
||||
|
88
bridges/GlowficBridge.php
Normal file
88
bridges/GlowficBridge.php
Normal file
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
class GlowficBridge extends BridgeAbstract {
|
||||
const MAINTAINER = 'l1n';
|
||||
const NAME = 'Glowfic Bridge';
|
||||
const URI = 'https://www.glowfic.com';
|
||||
const CACHE_TIMEOUT = 3600; // 1 hour
|
||||
const DESCRIPTION = 'Returns the latest replies on a glowfic post.';
|
||||
const PARAMETERS = array(
|
||||
'global' => array(),
|
||||
'Thread' => array(
|
||||
'post_id' => array(
|
||||
'name' => 'Post ID',
|
||||
'title' => 'https://www.glowfic.com/posts/<POST ID>',
|
||||
'type' => 'number'
|
||||
),
|
||||
'start_page' => array(
|
||||
'name' => 'Start Page',
|
||||
'title' => 'To start from an offset page',
|
||||
'type' => 'number'
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
public function collectData() {
|
||||
$url = $this->getAPIURI();
|
||||
$metadata = get_headers( $url . '/replies', true ) or returnClientError('Post did not return reply headers.');
|
||||
$metadata['Last-Page'] = ceil( $metadata['Total'] / $metadata['Per-Page'] );
|
||||
if(!is_null($this->getInput('start_page')) &&
|
||||
$this->getInput('start_page') < 1 && $metadata['Last-Page'] - $this->getInput('start_page') > 0) {
|
||||
$first_page = $metadata['Last-Page'] - $this->getInput('start_page');
|
||||
} else if(!is_null($this->getInput('start_page')) && $this->getInput('start_page') <= $metadata['Last-Page']) {
|
||||
$first_page = $this->getInput('start_page');
|
||||
} else {
|
||||
$first_page = 1;
|
||||
}
|
||||
for ($page_offset = $first_page; $page_offset <= $metadata['Last-Page']; $page_offset++) {
|
||||
$jsonContents = getContents($url . '/replies?page=' . $page_offset ) or
|
||||
returnClientError('Could not retrieve replies for page ' . $page_offset . '.');
|
||||
$replies = json_decode($jsonContents);
|
||||
foreach ($replies as $reply) {
|
||||
$item = array();
|
||||
|
||||
$item['content'] = $reply->{'content'};
|
||||
$item['uri'] = $this->getURI() . '?page=' . $page_offset . '#reply-' . $reply->{'id'};
|
||||
if ($reply->{'icon'}) {
|
||||
$item['enclosures'] = array($reply->{'icon'}->{'url'});
|
||||
}
|
||||
$item['author'] = $reply->{'character'}->{'screenname'} . ' (' . $reply->{'character'}->{'name'} . ')';
|
||||
$item['timestamp'] = date('r', strtotime($reply->{'created_at'}));
|
||||
$item['title'] = 'Tag by ' . $reply->{'user'}->{'username'} . ' updated at ' . $reply->{'updated_at'};
|
||||
$this->items[] = $item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function getAPIURI() {
|
||||
$url = parent::getURI() . '/api/v1/posts/' . $this->getInput('post_id');
|
||||
return $url;
|
||||
}
|
||||
|
||||
public function getURI() {
|
||||
$url = parent::getURI() . '/posts/' . $this->getInput('post_id');
|
||||
return $url;
|
||||
}
|
||||
|
||||
private function getPost() {
|
||||
$url = $this->getAPIURI();
|
||||
$jsonPost = getContents( $url ) or returnClientError('Could not retrieve post metadata.');
|
||||
$post = json_decode($jsonPost);
|
||||
return $post;
|
||||
}
|
||||
|
||||
public function getName(){
|
||||
if(!is_null($this->getInput('post_id'))) {
|
||||
$post = $this->getPost();
|
||||
return $post->{'subject'} . ' - ' . parent::getName();
|
||||
}
|
||||
return parent::getName();
|
||||
}
|
||||
|
||||
public function getDescription(){
|
||||
if(!is_null($this->getInput('post_id'))) {
|
||||
$post = $this->getPost();
|
||||
return $post->{'content'};
|
||||
}
|
||||
return parent::getName();
|
||||
}
|
||||
}
|
@@ -1,209 +0,0 @@
|
||||
<?php
|
||||
class GooglePlusPostBridge extends BridgeAbstract{
|
||||
|
||||
private $title;
|
||||
private $url;
|
||||
|
||||
const MAINTAINER = 'Grummfy, logmanoriginal';
|
||||
const NAME = 'Google Plus Post Bridge';
|
||||
const URI = 'https://plus.google.com';
|
||||
const CACHE_TIMEOUT = 600; //10min
|
||||
const DESCRIPTION = 'Returns user public post (without API).';
|
||||
|
||||
const PARAMETERS = array( array(
|
||||
'username' => array(
|
||||
'name' => 'username or Id',
|
||||
'required' => true
|
||||
),
|
||||
'include_media' => array(
|
||||
'name' => 'Include media',
|
||||
'type' => 'checkbox',
|
||||
'title' => 'Enable to include media in the feed content'
|
||||
)
|
||||
));
|
||||
|
||||
public function getIcon() {
|
||||
return 'https://ssl.gstatic.com/images/branding/product/ico/google_plus_alldp.ico';
|
||||
}
|
||||
|
||||
public function collectData(){
|
||||
|
||||
$username = $this->getInput('username');
|
||||
|
||||
// Usernames start with a + if it's not an ID
|
||||
if(!is_numeric($username) && substr($username, 0, 1) !== '+') {
|
||||
$username = '+' . $username;
|
||||
}
|
||||
|
||||
$html = getSimpleHTMLDOM(static::URI . '/' . urlencode($username) . '/posts')
|
||||
or returnServerError('No results for this query.');
|
||||
|
||||
$html = defaultLinkTo($html, static::URI);
|
||||
|
||||
$this->title = $html->find('meta[property=og:title]', 0)->getAttribute('content');
|
||||
$this->url = $html->find('meta[property=og:url]', 0)->getAttribute('content');
|
||||
|
||||
foreach($html->find('div[jsname=WsjYwc]') as $post) {
|
||||
|
||||
$item = array();
|
||||
|
||||
$item['author'] = $post->find('div div div div a', 0)->innertext;
|
||||
$item['uri'] = $post->find('div div div a', 1)->href;
|
||||
|
||||
$timestamp = $post->find('a.qXj2He span', 0);
|
||||
|
||||
if($timestamp) {
|
||||
$item['timestamp'] = strtotime('+' . preg_replace(
|
||||
'/[^0-9A-Za-z]/',
|
||||
'',
|
||||
$timestamp->getAttribute('aria-label')));
|
||||
}
|
||||
|
||||
$message = $post->find('div[jsname=EjRJtf]', 0);
|
||||
|
||||
// Empty messages are not supported right now
|
||||
if(!$message) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$item['content'] = '<div style="float: left; padding: 0 10px 10px 0;"><a href="'
|
||||
. $this->url
|
||||
. '"><img align="top" alt="'
|
||||
. $item['author']
|
||||
. '" src="'
|
||||
. $post->find('div img', 0)->src
|
||||
. '" /></a></div><div>'
|
||||
. trim(strip_tags($message, '<a><p><div><img>'))
|
||||
. '</div>';
|
||||
|
||||
// Make title at least 50 characters long, but don't add '...' if it is shorter!
|
||||
if(strlen($message->plaintext) > 50) {
|
||||
$end = strpos($message->plaintext, ' ', 50) ?: strlen($message->plaintext);
|
||||
} else {
|
||||
$end = strlen($message->plaintext);
|
||||
}
|
||||
|
||||
if(strlen(substr($message->plaintext, 0, $end)) === strlen($message->plaintext)) {
|
||||
$item['title'] = $message->plaintext;
|
||||
} else {
|
||||
$item['title'] = substr($message->plaintext, 0, $end) . '...';
|
||||
}
|
||||
|
||||
$media = $post->find('[jsname="MTOxpb"]', 0);
|
||||
|
||||
if($media) {
|
||||
|
||||
$item['enclosures'] = array();
|
||||
|
||||
foreach($media->find('img') as $img) {
|
||||
$item['enclosures'][] = $this->fixImage($img)->src;
|
||||
}
|
||||
|
||||
if($this->getInput('include_media') === true && count($item['enclosures'] > 0)) {
|
||||
$item['content'] .= '<div style="clear: both;"><a href="'
|
||||
. $item['enclosures'][0]
|
||||
. '"><img src="'
|
||||
. $item['enclosures'][0]
|
||||
. '" /></a></div>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Add custom parameters (only useful for JSON or Plaintext)
|
||||
$item['fullname'] = $item['author'];
|
||||
$item['avatar'] = $post->find('div img', 0)->src;
|
||||
$item['id'] = $post->find('div div div', 0)->getAttribute('id');
|
||||
$item['content_simple'] = $message->plaintext;
|
||||
|
||||
$this->items[] = $item;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function getName(){
|
||||
return $this->title ?: 'Google Plus Post Bridge';
|
||||
}
|
||||
|
||||
public function getURI(){
|
||||
return $this->url ?: parent::getURI();
|
||||
}
|
||||
|
||||
private function fixImage($img) {
|
||||
|
||||
// There are certain images like .gif which link to a static picture and
|
||||
// get replaced dynamically via JS in the browser. If we want the "real"
|
||||
// image we need to account for that.
|
||||
|
||||
$urlparts = parse_url($img->src);
|
||||
|
||||
if(array_key_exists('host', $urlparts)) {
|
||||
|
||||
// For some reason some URIs don't contain the scheme, assume https
|
||||
if(!array_key_exists('scheme', $urlparts)) {
|
||||
$urlparts['scheme'] = 'https';
|
||||
}
|
||||
|
||||
$pathelements = explode('/', $urlparts['path']);
|
||||
|
||||
switch($urlparts['host']) {
|
||||
|
||||
case 'lh3.googleusercontent.com':
|
||||
|
||||
if(pathinfo(end($pathelements), PATHINFO_EXTENSION)) {
|
||||
|
||||
// The second to last element of the path specifies the
|
||||
// image format. The URL is still valid if we remove it.
|
||||
unset($pathelements[count($pathelements) - 2]);
|
||||
|
||||
} elseif(strrpos(end($pathelements), '=') !== false) {
|
||||
|
||||
// Some images go throug a proxy. For those images they
|
||||
// add size information after an equal sign.
|
||||
// Example: '=w530-h298-n'. Again this can safely be
|
||||
// removed to get the original image.
|
||||
$pathelements[count($pathelements) - 1] = substr(
|
||||
end($pathelements),
|
||||
0,
|
||||
strrpos(end($pathelements), '=')
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
$urlparts['path'] = implode('/', $pathelements);
|
||||
|
||||
}
|
||||
|
||||
$img->src = $this->build_url($urlparts);
|
||||
return $img;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* From: https://gist.github.com/Ellrion/f51ba0d40ae1d62eeae44fd1adf7b704
|
||||
* slightly adjusted to work with PHP < 7.0
|
||||
* @param array $parts
|
||||
* @return string
|
||||
*/
|
||||
private function build_url(array $parts)
|
||||
{
|
||||
|
||||
$scheme = isset($parts['scheme']) ? ($parts['scheme'] . '://') : '';
|
||||
$host = isset($parts['host']) ? $parts['host'] : '';
|
||||
$port = isset($parts['port']) ? (':' . $parts['port']) : '';
|
||||
$user = isset($parts['user']) ? $parts['user'] : '';
|
||||
$pass = isset($parts['pass']) ? (':' . $parts['pass']) : '';
|
||||
$pass = ($user || $pass) ? ($pass . '@') : '';
|
||||
$path = isset($parts['path']) ? $parts['path'] : '';
|
||||
$query = isset($parts['query']) ? ('?' . $parts['query']) : '';
|
||||
$fragment = isset($parts['fragment']) ? ('#' . $parts['fragment']) : '';
|
||||
|
||||
return implode('', [$scheme, $user, $pass, $host, $port, $path, $query, $fragment]);
|
||||
|
||||
}
|
||||
|
||||
}
|
@@ -16,13 +16,13 @@ class HDWallpapersBridge extends BridgeAbstract {
|
||||
),
|
||||
'r' => array(
|
||||
'name' => 'resolution',
|
||||
'defaultValue' => '1920x1200',
|
||||
'exampleValue' => '1920x1200, 1680x1050,…'
|
||||
'defaultValue' => 'HD',
|
||||
'exampleValue' => 'HD, 1920x1200, 1680x1050,…'
|
||||
)
|
||||
));
|
||||
|
||||
public function collectData(){
|
||||
$category = $this->category;
|
||||
$category = $this->getInput('c');
|
||||
if(strrpos($category, 'wallpapers') !== strlen($category) - strlen('wallpapers')) {
|
||||
$category .= '-desktop-wallpapers';
|
||||
}
|
||||
@@ -45,13 +45,12 @@ class HDWallpapersBridge extends BridgeAbstract {
|
||||
$thumbnail = $element->find('img', 0);
|
||||
|
||||
$item = array();
|
||||
// http://www.hdwallpapers.in/download/yosemite_reflections-1680x1050.jpg
|
||||
$item['uri'] = self::URI
|
||||
. '/download'
|
||||
. str_replace('wallpapers.html', $this->getInput('r') . '.jpg', $element->href);
|
||||
|
||||
$item['timestamp'] = time();
|
||||
$item['title'] = $element->find('p', 0)->text();
|
||||
$item['title'] = $element->find('em1', 0)->text();
|
||||
$item['content'] = $item['title']
|
||||
. '<br><a href="'
|
||||
. $item['uri']
|
||||
@@ -60,6 +59,7 @@ class HDWallpapersBridge extends BridgeAbstract {
|
||||
. $thumbnail->src
|
||||
. '" /></a>';
|
||||
|
||||
$item['enclosures'] = array($item['uri']);
|
||||
$this->items[] = $item;
|
||||
|
||||
$num++;
|
||||
|
102
bridges/HaveIBeenPwnedBridge.php
Normal file
102
bridges/HaveIBeenPwnedBridge.php
Normal file
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
class HaveIBeenPwnedBridge extends BridgeAbstract {
|
||||
const NAME = 'Have I Been Pwned (HIBP) Bridge';
|
||||
const URI = 'https://haveibeenpwned.com';
|
||||
const DESCRIPTION = 'Returns list of Pwned websites';
|
||||
const MAINTAINER = 'VerifiedJoseph';
|
||||
const PARAMETERS = array(array(
|
||||
'order' => array(
|
||||
'name' => 'Order by',
|
||||
'type' => 'list',
|
||||
'values' => array(
|
||||
'Breach date' => 'breachDate',
|
||||
'Date added to HIBP' => 'dateAdded',
|
||||
),
|
||||
'defaultValue' => 'dateAdded',
|
||||
)
|
||||
));
|
||||
|
||||
const CACHE_TIMEOUT = 3600;
|
||||
|
||||
private $breachDateRegex = '/Breach date: ([0-9]{1,2} [A-Z-a-z]+ [0-9]{4})/';
|
||||
private $dateAddedRegex = '/Date added to HIBP: ([0-9]{1,2} [A-Z-a-z]+ [0-9]{4})/';
|
||||
private $accountsRegex = '/Compromised accounts: ([0-9,]+)/';
|
||||
|
||||
private $breaches = array();
|
||||
|
||||
public function collectData() {
|
||||
|
||||
$html = getSimpleHTMLDOM(self::URI . '/PwnedWebsites')
|
||||
or returnServerError('Could not request: ' . self::URI . '/PwnedWebsites');
|
||||
|
||||
$breaches = array();
|
||||
|
||||
foreach($html->find('div.row') as $breach) {
|
||||
$item = array();
|
||||
|
||||
if ($breach->class != 'row') {
|
||||
continue;
|
||||
}
|
||||
|
||||
preg_match($this->breachDateRegex, $breach->find('p', 1)->plaintext, $breachDate)
|
||||
or returnServerError('Could not extract details');
|
||||
|
||||
preg_match($this->dateAddedRegex, $breach->find('p', 1)->plaintext, $dateAdded)
|
||||
or returnServerError('Could not extract details');
|
||||
|
||||
preg_match($this->accountsRegex, $breach->find('p', 1)->plaintext, $accounts)
|
||||
or returnServerError('Could not extract details');
|
||||
|
||||
$permalink = $breach->find('p', 1)->find('a', 0)->href;
|
||||
|
||||
// Remove permalink
|
||||
$breach->find('p', 1)->find('a', 0)->outertext = '';
|
||||
|
||||
$item['title'] = $breach->find('h3', 0)->plaintext . ' - ' . $accounts[1] . ' breached accounts';
|
||||
$item['dateAdded'] = strtotime($dateAdded[1]);
|
||||
$item['breachDate'] = strtotime($breachDate[1]);
|
||||
$item['uri'] = self::URI . '/PwnedWebsites' . $permalink;
|
||||
|
||||
$item['content'] = '<p>' . $breach->find('p', 0)->innertext . '<p>';
|
||||
$item['content'] .= '<p>' . $breach->find('p', 1)->innertext . '<p>';
|
||||
|
||||
$this->breaches[] = $item;
|
||||
}
|
||||
|
||||
$this->orderBreaches();
|
||||
$this->createItems();
|
||||
}
|
||||
|
||||
/**
|
||||
* Order Breaches by date added or date breached
|
||||
*/
|
||||
private function orderBreaches() {
|
||||
|
||||
$sortBy = $this->getInput('order');
|
||||
$sort = array();
|
||||
|
||||
foreach ($this->breaches as $key => $item) {
|
||||
$sort[$key] = $item[$sortBy];
|
||||
}
|
||||
|
||||
array_multisort($sort, SORT_DESC, $this->breaches);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Create items from breaches array
|
||||
*/
|
||||
private function createItems() {
|
||||
|
||||
foreach ($this->breaches as $breach) {
|
||||
$item = array();
|
||||
|
||||
$item['title'] = $breach['title'];
|
||||
$item['timestamp'] = $breach[$this->getInput('order')];
|
||||
$item['uri'] = $breach['uri'];
|
||||
$item['content'] = $breach['content'];
|
||||
|
||||
$this->items[] = $item;
|
||||
}
|
||||
}
|
||||
}
|
75
bridges/HeiseBridge.php
Normal file
75
bridges/HeiseBridge.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
class HeiseBridge extends FeedExpander {
|
||||
const MAINTAINER = 'Dreckiger-Dan';
|
||||
const NAME = 'Heise Online Bridge';
|
||||
const URI = 'https://heise.de/';
|
||||
const CACHE_TIMEOUT = 1800; // 30min
|
||||
const DESCRIPTION = 'Returns the full articles instead of only the intro';
|
||||
const PARAMETERS = array(array(
|
||||
'category' => array(
|
||||
'name' => 'Category',
|
||||
'type' => 'list',
|
||||
'values' => array(
|
||||
'Alle News'
|
||||
=> 'https://www.heise.de/newsticker/heise-atom.xml',
|
||||
'Top-News'
|
||||
=> 'https://www.heise.de/newsticker/heise-top-atom.xml',
|
||||
'Internet-Störungen'
|
||||
=> 'https://www.heise.de/netze/netzwerk-tools/imonitor-internet-stoerungen/feed/aktuelle-meldungen/',
|
||||
'Alle News von heise Developer'
|
||||
=> 'https://www.heise.de/developer/rss/news-atom.xml'
|
||||
)
|
||||
),
|
||||
'limit' => array(
|
||||
'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);
|
||||
$uri = $item['uri'];
|
||||
|
||||
do {
|
||||
$article = getSimpleHTMLDOMCached($uri)
|
||||
or returnServerError('Could not open article: ' . $uri);
|
||||
|
||||
$article = defaultLinkTo($article, $uri);
|
||||
$item = $this->addArticleToItem($item, $article);
|
||||
|
||||
if($next = $article->find('.pagination a[rel="next"]', 0))
|
||||
$uri = $next->href;
|
||||
} while ($next);
|
||||
|
||||
return $item;
|
||||
}
|
||||
|
||||
private function addArticleToItem($item, $article) {
|
||||
if($author = $article->find('[itemprop="author"]', 0))
|
||||
$item['author'] = $author->plaintext;
|
||||
|
||||
$content = $article->find('div[class*="article-content"]', 0);
|
||||
|
||||
foreach($content->find('p, h3, ul, table, pre, img') as $element) {
|
||||
$item['content'] .= $element;
|
||||
}
|
||||
|
||||
foreach($content->find('img') as $img) {
|
||||
$item['enclosures'][] = $img->src;
|
||||
}
|
||||
|
||||
return $item;
|
||||
}
|
||||
}
|
@@ -17,27 +17,23 @@ class HotUKDealsBridge extends PepperBridgeAbstract {
|
||||
'hide_expired' => array(
|
||||
'name' => 'Hide expired deals',
|
||||
'type' => 'checkbox',
|
||||
'required' => 'true'
|
||||
),
|
||||
'hide_local' => array(
|
||||
'name' => 'Hide local deals',
|
||||
'type' => 'checkbox',
|
||||
'title' => 'Hide deals in physical store',
|
||||
'required' => 'true'
|
||||
),
|
||||
'priceFrom' => array(
|
||||
'name' => 'Minimal Price',
|
||||
'type' => 'text',
|
||||
'title' => 'Minmal Price in Pounds',
|
||||
'required' => 'false',
|
||||
'defaultValue' => ''
|
||||
'required' => false
|
||||
),
|
||||
'priceTo' => array(
|
||||
'name' => 'Maximum Price',
|
||||
'type' => 'text',
|
||||
'title' => 'Maximum Price in Pounds',
|
||||
'required' => 'false',
|
||||
'defaultValue' => ''
|
||||
'required' => false
|
||||
),
|
||||
),
|
||||
|
||||
@@ -45,7 +41,6 @@ class HotUKDealsBridge extends PepperBridgeAbstract {
|
||||
'group' => array(
|
||||
'name' => 'Group',
|
||||
'type' => 'list',
|
||||
'required' => 'true',
|
||||
'title' => 'Group whose deals must be displayed',
|
||||
'values' => array(
|
||||
'2DS' => '2ds',
|
||||
@@ -1319,7 +1314,6 @@ class HotUKDealsBridge extends PepperBridgeAbstract {
|
||||
'order' => array(
|
||||
'name' => 'Order by',
|
||||
'type' => 'list',
|
||||
'required' => 'true',
|
||||
'title' => 'Sort order of deals',
|
||||
'values' => array(
|
||||
'From the most to the least hot deal' => '-hot',
|
||||
|
@@ -7,19 +7,19 @@ class InstagramBridge extends BridgeAbstract {
|
||||
const DESCRIPTION = 'Returns the newest images';
|
||||
|
||||
const PARAMETERS = array(
|
||||
array(
|
||||
'Username' => array(
|
||||
'u' => array(
|
||||
'name' => 'username',
|
||||
'required' => true
|
||||
)
|
||||
),
|
||||
array(
|
||||
'Hashtag' => array(
|
||||
'h' => array(
|
||||
'name' => 'hashtag',
|
||||
'required' => true
|
||||
)
|
||||
),
|
||||
array(
|
||||
'Location' => array(
|
||||
'l' => array(
|
||||
'name' => 'location',
|
||||
'required' => true
|
||||
@@ -82,10 +82,20 @@ class InstagramBridge extends BridgeAbstract {
|
||||
$item = array();
|
||||
$item['uri'] = self::URI . 'p/' . $media->shortcode . '/';
|
||||
|
||||
if (isset($media->owner->username)) {
|
||||
$item['author'] = $media->owner->username;
|
||||
}
|
||||
|
||||
if (isset($media->edge_media_to_caption->edges[0]->node->text)) {
|
||||
$item['title'] = $media->edge_media_to_caption->edges[0]->node->text;
|
||||
$textContent = $media->edge_media_to_caption->edges[0]->node->text;
|
||||
} else {
|
||||
$item['title'] = basename($media->display_url);
|
||||
$textContent = '(no text)';
|
||||
}
|
||||
|
||||
$item['title'] = ($media->is_video ? '▶ ' : '') . trim($textContent);
|
||||
$titleLinePos = strpos(wordwrap($item['title'], 120), "\n");
|
||||
if ($titleLinePos != false) {
|
||||
$item['title'] = substr($item['title'], 0, $titleLinePos) . '...';
|
||||
}
|
||||
|
||||
if(!is_null($this->getInput('u')) && $media->__typename == 'GraphSidecar') {
|
||||
@@ -93,8 +103,11 @@ class InstagramBridge extends BridgeAbstract {
|
||||
$item['content'] = $data[0];
|
||||
$item['enclosures'] = $data[1];
|
||||
} else {
|
||||
$item['content'] = '<img src="' . htmlentities($media->display_url) . '" alt="' . $item['title'] . '" />';
|
||||
$item['enclosures'] = array($media->display_url);
|
||||
$mediaURI = self::URI . 'p/' . $media->shortcode . '/media?size=l';
|
||||
$item['content'] = '<a href="' . htmlentities($item['uri']) . '" target="_blank">';
|
||||
$item['content'] .= '<img src="' . htmlentities($mediaURI) . '" alt="' . $item['title'] . '" />';
|
||||
$item['content'] .= '</a><br><br>' . nl2br(htmlentities($textContent));
|
||||
$item['enclosures'] = array($mediaURI);
|
||||
}
|
||||
|
||||
$item['timestamp'] = $media->taken_at_timestamp;
|
||||
|
@@ -21,7 +21,6 @@ class InstructablesBridge extends BridgeAbstract {
|
||||
'category' => array(
|
||||
'name' => 'Category',
|
||||
'type' => 'list',
|
||||
'required' => true,
|
||||
'values' => array(
|
||||
'Play' => array(
|
||||
'All' => '/play/',
|
||||
@@ -240,7 +239,6 @@ class InstructablesBridge extends BridgeAbstract {
|
||||
'filter' => array(
|
||||
'name' => 'Filter',
|
||||
'type' => 'list',
|
||||
'required' => true,
|
||||
'values' => array(
|
||||
'Featured' => ' ',
|
||||
'Recent' => 'recent/',
|
||||
|
128
bridges/IvooxBridge.php
Normal file
128
bridges/IvooxBridge.php
Normal file
@@ -0,0 +1,128 @@
|
||||
<?php
|
||||
/**
|
||||
* IvooxRssBridge
|
||||
* Returns the latest search result
|
||||
* TODO: support podcast episodes list
|
||||
*/
|
||||
class IvooxBridge extends BridgeAbstract {
|
||||
const NAME = 'Ivoox Bridge';
|
||||
const URI = 'https://www.ivoox.com/';
|
||||
const CACHE_TIMEOUT = 10800; // 3h
|
||||
const DESCRIPTION = 'Returns the 10 newest episodes by keyword search';
|
||||
const MAINTAINER = 'xurxof'; // based on YoutubeBridge by mitsukarenai
|
||||
const PARAMETERS = array(
|
||||
'Search result' => array(
|
||||
's' => array(
|
||||
'name' => 'keyword',
|
||||
'exampleValue' => 'test'
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
private function ivBridgeAddItem(
|
||||
$episode_link,
|
||||
$podcast_name,
|
||||
$episode_title,
|
||||
$author_name,
|
||||
$episode_description,
|
||||
$publication_date,
|
||||
$episode_duration) {
|
||||
$item = array();
|
||||
$item['title'] = htmlspecialchars_decode($podcast_name . ': ' . $episode_title);
|
||||
$item['author'] = $author_name;
|
||||
$item['timestamp'] = $publication_date;
|
||||
$item['uri'] = $episode_link;
|
||||
$item['content'] = '<a href="' . $episode_link . '">' . $podcast_name . ': ' . $episode_title
|
||||
. '</a><br />Duration: ' . $episode_duration
|
||||
. '<br />Description:<br />' . $episode_description;
|
||||
$this->items[] = $item;
|
||||
}
|
||||
|
||||
private function ivBridgeParseHtmlListing($html) {
|
||||
$limit = 4;
|
||||
$count = 0;
|
||||
|
||||
foreach($html->find('div.flip-container') as $flipper) {
|
||||
$linkcount = 0;
|
||||
if(!empty($flipper->find( 'div.modulo-type-banner' ))) {
|
||||
// ad
|
||||
continue;
|
||||
}
|
||||
|
||||
if($count < $limit) {
|
||||
foreach($flipper->find('div.header-modulo') as $element) {
|
||||
foreach($element->find('a') as $link) {
|
||||
if ($linkcount == 0) {
|
||||
$episode_link = $link->href;
|
||||
$episode_title = $link->title;
|
||||
} elseif ($linkcount == 1) {
|
||||
$author_link = $link->href;
|
||||
$author_name = $link->title;
|
||||
} elseif ($linkcount == 2) {
|
||||
$podcast_link = $link->href;
|
||||
$podcast_name = $link->title;
|
||||
}
|
||||
|
||||
$linkcount++;
|
||||
}
|
||||
}
|
||||
|
||||
$episode_description = $flipper->find('button.btn-link', 0)->getAttribute('data-content');
|
||||
$episode_duration = $flipper->find('p.time', 0)->innertext;
|
||||
$publication_date = $flipper->find('li.date', 0)->getAttribute('title');
|
||||
|
||||
// alternative date_parse_from_format
|
||||
// or DateTime::createFromFormat('G:i - d \d\e M \d\e Y', $publication);
|
||||
// TODO: month name translations, due function doesn't support locale
|
||||
|
||||
$a = strptime($publication_date, '%H:%M - %d de %b. de %Y'); // obsolete function, uses c libraries
|
||||
$publication_date = mktime(0, 0, 0, $a['tm_mon'] + 1, $a['tm_mday'], $a['tm_year'] + 1900);
|
||||
|
||||
$this->ivBridgeAddItem(
|
||||
$episode_link,
|
||||
$podcast_name,
|
||||
$episode_title,
|
||||
$author_name,
|
||||
$episode_description,
|
||||
$publication_date,
|
||||
$episode_duration
|
||||
);
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function collectData() {
|
||||
|
||||
// store locale, change to spanish
|
||||
$originalLocales = explode(';', setlocale(LC_ALL, 0));
|
||||
setlocale(LC_ALL, 'es_ES.utf8');
|
||||
|
||||
$xml = '';
|
||||
$html = '';
|
||||
$url_feed = '';
|
||||
if($this->getInput('s')) { /* Search modes */
|
||||
$this->request = str_replace(' ', '-', $this->getInput('s'));
|
||||
$url_feed = self::URI . urlencode($this->request) . '_sb_f_1.html?o=uploaddate';
|
||||
} else {
|
||||
returnClientError('Not valid mode at IvooxBridge');
|
||||
}
|
||||
|
||||
$dom = getSimpleHTMLDOM($url_feed)
|
||||
or returnServerError('Could not request ' . $url_feed);
|
||||
$this->ivBridgeParseHtmlListing($dom);
|
||||
|
||||
// restore locale
|
||||
|
||||
foreach($originalLocales as $localeSetting) {
|
||||
if(strpos($localeSetting, '=') !== false) {
|
||||
list($category, $locale) = explode('=', $localeSetting);
|
||||
} else {
|
||||
$category = LC_ALL;
|
||||
$locale = $localeSetting;
|
||||
}
|
||||
|
||||
setlocale($category, $locale);
|
||||
}
|
||||
}
|
||||
}
|
@@ -34,7 +34,6 @@ class JustETFBridge extends BridgeAbstract {
|
||||
'global' => array(
|
||||
'lang' => array(
|
||||
'name' => 'Language',
|
||||
'required' => true,
|
||||
'type' => 'list',
|
||||
'values' => array(
|
||||
'Englisch' => 'en',
|
||||
@@ -132,7 +131,7 @@ class JustETFBridge extends BridgeAbstract {
|
||||
|
||||
date_time_set($df, 0, 0);
|
||||
|
||||
// debugMessage(date_format($df, 'U'));
|
||||
// Debug::log(date_format($df, 'U'));
|
||||
|
||||
return date_format($df, 'U');
|
||||
}
|
||||
@@ -210,7 +209,7 @@ class JustETFBridge extends BridgeAbstract {
|
||||
$element = $article->find('div.subheadline', 0)
|
||||
or returnServerError('Date not found!');
|
||||
|
||||
// debugMessage($element->plaintext);
|
||||
// Debug::log($element->plaintext);
|
||||
|
||||
$date = trim(explode('|', $element->plaintext)[0]);
|
||||
|
||||
@@ -223,7 +222,7 @@ class JustETFBridge extends BridgeAbstract {
|
||||
|
||||
$element->find('a', 0)->onclick = '';
|
||||
|
||||
// debugMessage($element->innertext);
|
||||
// Debug::log($element->innertext);
|
||||
|
||||
return $element->innertext;
|
||||
}
|
||||
@@ -288,7 +287,7 @@ class JustETFBridge extends BridgeAbstract {
|
||||
$element = $html->find('div.infobox div.vallabel', 0)
|
||||
or returnServerError('Date not found!');
|
||||
|
||||
// debugMessage($element->plaintext);
|
||||
// Debug::log($element->plaintext);
|
||||
|
||||
$date = trim(explode("\r\n", $element->plaintext)[1]);
|
||||
|
||||
@@ -348,6 +347,5 @@ class JustETFBridge extends BridgeAbstract {
|
||||
|
||||
return $element->plaintext;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
@@ -53,6 +53,7 @@ class KATBridge extends BridgeAbstract {
|
||||
$guessedDate['tm_year'] + 1900);
|
||||
return $timestamp;
|
||||
}
|
||||
|
||||
$catBool = $this->getInput('cat_check');
|
||||
if($catBool) {
|
||||
$catNum = $this->getInput('cat');
|
||||
|
@@ -150,5 +150,4 @@ class KernelBugTrackerBridge extends BridgeAbstract {
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -11,7 +11,6 @@ class KununuBridge extends BridgeAbstract {
|
||||
'site' => array(
|
||||
'name' => 'Site',
|
||||
'type' => 'list',
|
||||
'required' => true,
|
||||
'title' => 'Select your site',
|
||||
'values' => array(
|
||||
'Austria' => 'at',
|
||||
@@ -23,7 +22,6 @@ class KununuBridge extends BridgeAbstract {
|
||||
'full' => array(
|
||||
'name' => 'Load full article',
|
||||
'type' => 'checkbox',
|
||||
'required' => false,
|
||||
'exampleValue' => 'checked',
|
||||
'title' => 'Activate to load full article'
|
||||
)
|
||||
|
@@ -419,7 +419,6 @@ class LeBonCoinBridge extends BridgeAbstract {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private function buildRequestJson() {
|
||||
|
||||
$requestJson = new StdClass();
|
||||
@@ -534,5 +533,4 @@ class LeBonCoinBridge extends BridgeAbstract {
|
||||
return json_encode($requestJson);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -20,12 +20,13 @@ class LeMondeInformatiqueBridge extends FeedExpander {
|
||||
str_replace(
|
||||
'/grande/',
|
||||
'/petite/',
|
||||
$article_html->find('.article-image', 0)->find('img', 0)->src
|
||||
$article_html->find('.article-image > img, figure > img', 0)->src
|
||||
)
|
||||
);
|
||||
|
||||
//No response header sets the encoding, explicit conversion is needed or subsequent xml_encode() will fail
|
||||
$item['content'] = utf8_encode($this->cleanArticle($article_html->find('div.col-primary', 0)->innertext));
|
||||
$content_node = $article_html->find('div.col-primary, div.col-sm-9', 0);
|
||||
$item['content'] = utf8_encode($this->cleanArticle($content_node->innertext));
|
||||
$item['author'] = utf8_encode($article_html->find('div.author-infos', 0)->find('b', 0)->plaintext);
|
||||
|
||||
return $item;
|
||||
|
@@ -13,7 +13,6 @@ class MangareaderBridge extends BridgeAbstract {
|
||||
'category' => array(
|
||||
'name' => 'Category',
|
||||
'type' => 'list',
|
||||
'required' => true,
|
||||
'values' => array(
|
||||
'All' => 'all',
|
||||
'Action' => 'action',
|
||||
|
60
bridges/MediapartBridge.php
Normal file
60
bridges/MediapartBridge.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
class MediapartBridge extends FeedExpander {
|
||||
const MAINTAINER = 'killruana';
|
||||
const NAME = 'Mediapart Bridge';
|
||||
const URI = 'https://www.mediapart.fr/';
|
||||
const PARAMETERS = array(
|
||||
array(
|
||||
'single_page_mode' => array(
|
||||
'name' => 'Single page article',
|
||||
'type' => 'checkbox',
|
||||
'title' => 'Display long articles on a single page',
|
||||
'defaultValue' => 'checked'
|
||||
),
|
||||
'mpsessid' => array(
|
||||
'name' => 'MPSESSID',
|
||||
'type' => 'text',
|
||||
'title' => 'Value of the session cookie MPSESSID'
|
||||
)
|
||||
)
|
||||
);
|
||||
const CACHE_TIMEOUT = 7200; // 2h
|
||||
const DESCRIPTION = 'Returns the newest articles.';
|
||||
|
||||
public function collectData() {
|
||||
$url = self::URI . 'articles/feed';
|
||||
$this->collectExpandableDatas($url);
|
||||
}
|
||||
|
||||
protected function parseItem($newsItem) {
|
||||
$item = parent::parseItem($newsItem);
|
||||
|
||||
// Enable single page mode?
|
||||
if ($this->getInput('single_page_mode') === true) {
|
||||
$item['uri'] .= '?onglet=full';
|
||||
}
|
||||
|
||||
// If a session cookie is defined, get the full article
|
||||
$mpsessid = $this->getInput('mpsessid');
|
||||
if (!empty($mpsessid)) {
|
||||
// Set the session cookie
|
||||
$opt = array();
|
||||
$opt[CURLOPT_COOKIE] = 'MPSESSID=' . $mpsessid;
|
||||
|
||||
// Get the page
|
||||
$articlePage = getSimpleHTMLDOM(
|
||||
$newsItem->link . '?onglet=full',
|
||||
array(),
|
||||
$opt);
|
||||
|
||||
// Extract the article content
|
||||
$content = $articlePage->find('div.content-article', 0)->innertext;
|
||||
$content = sanitize($content);
|
||||
$content = defaultLinkTo($content, static::URI);
|
||||
$item['content'] .= $content;
|
||||
}
|
||||
|
||||
return $item;
|
||||
}
|
||||
}
|
102
bridges/ModelKarteiBridge.php
Normal file
102
bridges/ModelKarteiBridge.php
Normal file
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
class ModelKarteiBridge extends BridgeAbstract {
|
||||
const NAME = 'model-kartei.de';
|
||||
const URI = 'https://www.model-kartei.de/';
|
||||
const DESCRIPTION = 'Get the public comp card gallery';
|
||||
const MAINTAINER = 'fulmeek';
|
||||
const PARAMETERS = array(array(
|
||||
'model_id' => array(
|
||||
'name' => 'Model ID',
|
||||
'exampleValue' => '123456'
|
||||
)
|
||||
));
|
||||
|
||||
const LIMIT_ITEMS = 10;
|
||||
|
||||
private $feedName = '';
|
||||
|
||||
public function collectData() {
|
||||
$model_id = preg_replace('/[^0-9]/', '', $this->getInput('model_id'));
|
||||
if (empty($model_id))
|
||||
returnServerError('Invalid model ID');
|
||||
|
||||
$html = getSimpleHTMLDOM(self::URI . 'sedcards/model/' . $model_id . '/')
|
||||
or returnServerError('Model not found');
|
||||
|
||||
$objTitle = $html->find('.sTitle', 0);
|
||||
if ($objTitle)
|
||||
$this->feedName = $objTitle->plaintext;
|
||||
|
||||
$itemlist = $html->find('#photoList .photoPreview');
|
||||
if (!$itemlist)
|
||||
returnServerError('No gallery');
|
||||
|
||||
foreach($itemlist as $idx => $element) {
|
||||
if ($idx >= self::LIMIT_ITEMS)
|
||||
break;
|
||||
|
||||
$item = array();
|
||||
|
||||
$title = $element->title;
|
||||
$date = $element->{'data-date'};
|
||||
$author = $this->feedName;
|
||||
$text = '';
|
||||
|
||||
$objImage = $element->find('a.photoLink img', 0);
|
||||
$objLink = $element->find('a.photoLink', 0);
|
||||
|
||||
if ($objLink) {
|
||||
$page = getSimpleHTMLDOMCached($objLink->href);
|
||||
|
||||
if (empty($title)) {
|
||||
$objTitle = $page->find('.p-title', 0);
|
||||
if ($objTitle)
|
||||
$title = $objTitle->plaintext;
|
||||
}
|
||||
if (empty($date)) {
|
||||
$objDate = $page->find('.cameraDetails .date', 0);
|
||||
if ($objDate)
|
||||
$date = strtotime($objDate->parent()->plaintext);
|
||||
}
|
||||
if (empty($author)) {
|
||||
$objAuthor = $page->find('.p-publisher a', 0);
|
||||
if ($objAuthor)
|
||||
$author = $objAuthor->plaintext;
|
||||
}
|
||||
|
||||
$objFullImage = $page->find('img#gofullscreen', 0);
|
||||
if ($objFullImage)
|
||||
$objImage = $objFullImage;
|
||||
|
||||
$objText = $page->find('.p-desc', 0);
|
||||
if ($objText)
|
||||
$text = $objText->plaintext;
|
||||
}
|
||||
|
||||
$item['title'] = $title;
|
||||
$item['timestamp'] = $date;
|
||||
$item['author'] = $author;
|
||||
|
||||
if ($objImage)
|
||||
$item['content'] = '<img src="' . $objImage->src . '"/>';
|
||||
if ($objLink) {
|
||||
$item['uri'] = $objLink->href;
|
||||
if (!empty($item['content']))
|
||||
$item['content'] = '<a href="' . $objLink->href . '" target="_blank">' . $item['content'] . '</a>';
|
||||
} else {
|
||||
$item['uri'] = 'urn:sha1:' . hash('sha1', $item['content']);
|
||||
}
|
||||
if (!empty($text))
|
||||
$item['content'] = '<p>' . $text . '</p>' . $item['content'];
|
||||
|
||||
$this->items[] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
public function getName(){
|
||||
if(!empty($this->feedName)) {
|
||||
return $this->feedName . ' - ' . self::NAME;
|
||||
}
|
||||
return parent::getName();
|
||||
}
|
||||
}
|
153
bridges/MozillaBugTrackerBridge.php
Normal file
153
bridges/MozillaBugTrackerBridge.php
Normal file
@@ -0,0 +1,153 @@
|
||||
<?php
|
||||
class MozillaBugTrackerBridge extends BridgeAbstract {
|
||||
|
||||
const NAME = 'Mozilla Bug Tracker';
|
||||
const URI = 'https://bugzilla.mozilla.org';
|
||||
const DESCRIPTION = 'Returns feeds for bug comments';
|
||||
const MAINTAINER = 'AntoineTurmel';
|
||||
const PARAMETERS = array(
|
||||
'Bug comments' => array(
|
||||
'id' => array(
|
||||
'name' => 'Bug tracking ID',
|
||||
'type' => 'number',
|
||||
'required' => true,
|
||||
'title' => 'Insert bug tracking ID',
|
||||
'exampleValue' => 121241
|
||||
),
|
||||
'limit' => array(
|
||||
'name' => 'Number of comments to return',
|
||||
'type' => 'number',
|
||||
'required' => false,
|
||||
'title' => 'Specify number of comments to return',
|
||||
'defaultValue' => -1
|
||||
),
|
||||
'sorting' => array(
|
||||
'name' => 'Sorting',
|
||||
'type' => 'list',
|
||||
'required' => false,
|
||||
'title' => 'Defines the sorting order of the comments returned',
|
||||
'defaultValue' => 'of',
|
||||
'values' => array(
|
||||
'Oldest first' => 'of',
|
||||
'Latest first' => 'lf'
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
private $bugid = '';
|
||||
private $bugdesc = '';
|
||||
|
||||
public function getIcon() {
|
||||
return self::URI . '/extensions/BMO/web/images/favicon.ico';
|
||||
}
|
||||
|
||||
public function collectData(){
|
||||
$limit = $this->getInput('limit');
|
||||
$sorting = $this->getInput('sorting');
|
||||
|
||||
// We use the print preview page for simplicity
|
||||
$html = getSimpleHTMLDOMCached($this->getURI() . '&format=multiple',
|
||||
86400,
|
||||
null,
|
||||
null,
|
||||
true,
|
||||
true,
|
||||
DEFAULT_TARGET_CHARSET,
|
||||
false, // Do NOT remove line breaks
|
||||
DEFAULT_BR_TEXT,
|
||||
DEFAULT_SPAN_TEXT);
|
||||
|
||||
if($html === false)
|
||||
returnServerError('Failed to load page!');
|
||||
|
||||
// Store header information into private members
|
||||
$this->bugid = $html->find('#bugzilla-body', 0)->find('a', 0)->innertext;
|
||||
$this->bugdesc = $html->find('table.bugfields', 0)->find('tr', 0)->find('td', 0)->innertext;
|
||||
|
||||
// Get and limit comments
|
||||
$comments = $html->find('.bz_comment_table div.bz_comment');
|
||||
|
||||
if($limit > 0 && count($comments) > $limit) {
|
||||
$comments = array_slice($comments, count($comments) - $limit, $limit);
|
||||
}
|
||||
|
||||
// Order comments
|
||||
switch($sorting) {
|
||||
case 'lf': $comments = array_reverse($comments, true);
|
||||
case 'of':
|
||||
default: // Nothing to do, keep original order
|
||||
}
|
||||
|
||||
foreach($comments as $comment) {
|
||||
$comment = $this->inlineStyles($comment);
|
||||
|
||||
$item = array();
|
||||
$item['uri'] = $this->getURI() . '#' . $comment->id;
|
||||
$item['author'] = $comment->find('span.bz_comment_user', 0)->innertext;
|
||||
$item['title'] = $comment->find('span.bz_comment_number', 0)->find('a', 0)->innertext;
|
||||
$item['timestamp'] = strtotime($comment->find('span.bz_comment_time', 0)->innertext);
|
||||
$item['content'] = $comment->find('pre.bz_comment_text', 0)->innertext;
|
||||
|
||||
// Fix line breaks (they use LF)
|
||||
$item['content'] = str_replace("\n", '<br>', $item['content']);
|
||||
|
||||
// Fix relative URIs
|
||||
$item['content'] = $this->replaceRelativeURI($item['content']);
|
||||
|
||||
$this->items[] = $item;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function getURI(){
|
||||
switch($this->queriedContext) {
|
||||
case 'Bug comments':
|
||||
return parent::getURI()
|
||||
. '/show_bug.cgi?id='
|
||||
. $this->getInput('id');
|
||||
break;
|
||||
default: return parent::getURI();
|
||||
}
|
||||
}
|
||||
|
||||
public function getName(){
|
||||
switch($this->queriedContext) {
|
||||
case 'Bug comments':
|
||||
return 'Bug '
|
||||
. $this->bugid
|
||||
. ' tracker for '
|
||||
. $this->bugdesc
|
||||
. ' - '
|
||||
. parent::getName();
|
||||
break;
|
||||
default: return parent::getName();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Replaces all relative URIs with absolute ones
|
||||
*
|
||||
* @param string $content The source string
|
||||
* @return string Returns the source string with all relative URIs replaced
|
||||
* by absolute ones.
|
||||
*/
|
||||
private function replaceRelativeURI($content){
|
||||
return preg_replace('/href="(?!http)/', 'href="' . self::URI . '/', $content);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds styles as attributes to tags with known classes
|
||||
*
|
||||
* @param object $html A simplehtmldom object
|
||||
* @return object Returns the original object with styles added as
|
||||
* attributes.
|
||||
*/
|
||||
private function inlineStyles($html){
|
||||
foreach($html->find('.bz_obsolete') as $element) {
|
||||
$element->style = 'text-decoration:line-through;';
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
29
bridges/MozillaSecurityBridge.php
Normal file
29
bridges/MozillaSecurityBridge.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
class MozillaSecurityBridge extends BridgeAbstract {
|
||||
|
||||
const MAINTAINER = 'm0le.net';
|
||||
const NAME = 'Mozilla Security Advisories';
|
||||
const URI = 'https://www.mozilla.org/en-US/security/advisories/';
|
||||
const CACHE_TIMEOUT = 7200; // 2h
|
||||
const DESCRIPTION = 'Mozilla Security Advisories';
|
||||
const WEBROOT = 'https://www.mozilla.org';
|
||||
|
||||
public function collectData(){
|
||||
$html = getSimpleHTMLDOM(self::URI)
|
||||
or returnServerError('Could not request MSA.');
|
||||
|
||||
$html = defaultLinkTo($html, self::WEBROOT);
|
||||
|
||||
$item = array();
|
||||
$articles = $html->find('div[itemprop="articleBody"] h2');
|
||||
|
||||
foreach ($articles as $element) {
|
||||
$item['title'] = $element->innertext;
|
||||
$item['timestamp'] = strtotime($element->innertext);
|
||||
$item['content'] = $element->next_sibling()->innertext;
|
||||
$item['uri'] = self::URI . '?' . $item['timestamp'];
|
||||
$item['uid'] = self::URI . '?' . $item['timestamp'];
|
||||
$this->items[] = $item;
|
||||
}
|
||||
}
|
||||
}
|
@@ -17,27 +17,23 @@ class MydealsBridge extends PepperBridgeAbstract {
|
||||
'hide_expired' => array(
|
||||
'name' => 'Abgelaufenes ausblenden',
|
||||
'type' => 'checkbox',
|
||||
'required' => 'true'
|
||||
),
|
||||
'hide_local' => array(
|
||||
'name' => 'Lokales ausblenden',
|
||||
'type' => 'checkbox',
|
||||
'title' => 'Deals im physischen Geschäft ausblenden',
|
||||
'required' => 'true'
|
||||
),
|
||||
'priceFrom' => array(
|
||||
'name' => 'Minimaler Preis',
|
||||
'type' => 'text',
|
||||
'title' => 'Minmaler Preis in Euros',
|
||||
'required' => 'false',
|
||||
'defaultValue' => ''
|
||||
'required' => false
|
||||
),
|
||||
'priceTo' => array(
|
||||
'name' => 'Maximaler Preis',
|
||||
'type' => 'text',
|
||||
'title' => 'maximaler Preis in Euro',
|
||||
'required' => 'false',
|
||||
'defaultValue' => ''
|
||||
'required' => false
|
||||
),
|
||||
),
|
||||
|
||||
@@ -45,7 +41,6 @@ class MydealsBridge extends PepperBridgeAbstract {
|
||||
'group' => array(
|
||||
'name' => 'Gruppen',
|
||||
'type' => 'list',
|
||||
'required' => 'true',
|
||||
'title' => 'Gruppe, deren Deals angezeigt werden müssen',
|
||||
'values' => array(
|
||||
'Elektronik' => 'elektronik',
|
||||
@@ -68,7 +63,6 @@ class MydealsBridge extends PepperBridgeAbstract {
|
||||
'order' => array(
|
||||
'name' => 'sortieren nach',
|
||||
'type' => 'list',
|
||||
'required' => 'true',
|
||||
'title' => 'Sortierung der deals',
|
||||
'values' => array(
|
||||
'Vom heißesten zum kältesten Deal' => '',
|
||||
|
37
bridges/N26Bridge.php
Normal file
37
bridges/N26Bridge.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
class N26Bridge extends BridgeAbstract
|
||||
{
|
||||
const MAINTAINER = 'quentinus95';
|
||||
const NAME = 'N26 Blog';
|
||||
const URI = 'https://n26.com';
|
||||
const CACHE_TIMEOUT = 1800;
|
||||
const DESCRIPTION = 'Returns recent blog posts from N26.';
|
||||
|
||||
public function getIcon()
|
||||
{
|
||||
return 'https://n26.com/favicon.ico';
|
||||
}
|
||||
|
||||
public function collectData()
|
||||
{
|
||||
$html = getSimpleHTMLDOM(self::URI . '/en-fr/blog-archive')
|
||||
or returnServerError('Error while downloading the website content');
|
||||
|
||||
foreach($html->find('div.ga') as $article) {
|
||||
$item = [];
|
||||
|
||||
$item['uri'] = self::URI . $article->find('h2 a', 0)->href;
|
||||
$item['title'] = $article->find('h2 a', 0)->plaintext;
|
||||
|
||||
$fullArticle = getSimpleHTMLDOM($item['uri'])
|
||||
or returnServerError('Error while downloading the full article');
|
||||
|
||||
$dateElement = $fullArticle->find('span[class="fk fl de ch fm by"]', 0);
|
||||
$item['timestamp'] = strtotime($dateElement->plaintext);
|
||||
$item['content'] = $fullArticle->find('main article', 0)->innertext;
|
||||
|
||||
$this->items[] = $item;
|
||||
}
|
||||
}
|
||||
}
|
@@ -11,7 +11,6 @@ class NineGagBridge extends BridgeAbstract {
|
||||
'd' => array(
|
||||
'name' => 'Section',
|
||||
'type' => 'list',
|
||||
'required' => true,
|
||||
'values' => array(
|
||||
'Hot' => 'hot',
|
||||
'Trending' => 'trending',
|
||||
@@ -28,7 +27,6 @@ class NineGagBridge extends BridgeAbstract {
|
||||
'g' => array(
|
||||
'name' => 'Section',
|
||||
'type' => 'list',
|
||||
'required' => true,
|
||||
'values' => array(
|
||||
'Animals' => 'cute',
|
||||
'Anime & Manga' => 'anime-manga',
|
||||
@@ -88,7 +86,6 @@ class NineGagBridge extends BridgeAbstract {
|
||||
't' => array(
|
||||
'name' => 'Type',
|
||||
'type' => 'list',
|
||||
'required' => true,
|
||||
'values' => array(
|
||||
'Hot' => 'hot',
|
||||
'Fresh' => 'fresh',
|
||||
|
@@ -21,8 +21,7 @@ class NotAlwaysBridge extends BridgeAbstract {
|
||||
'Friendly' => 'friendly',
|
||||
'Hopeless' => 'hopeless',
|
||||
'Unfiltered' => 'unfiltered'
|
||||
),
|
||||
'required' => true
|
||||
)
|
||||
)
|
||||
));
|
||||
|
||||
|
@@ -9,7 +9,6 @@ class OnVaSortirBridge extends FeedExpander {
|
||||
'city' => array(
|
||||
'name' => 'City',
|
||||
'type' => 'list',
|
||||
'required' => true,
|
||||
'values' => array(
|
||||
'Agen' => 'Agen',
|
||||
'Ajaccio' => 'Ajaccio',
|
||||
@@ -111,11 +110,11 @@ class OnVaSortirBridge extends FeedExpander {
|
||||
'Valence' => 'valence',
|
||||
'Vannes' => 'vannes',
|
||||
'Zurich' => 'zurich',
|
||||
),
|
||||
'defaultValue' => ''
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
protected function parseItem($item){
|
||||
$item = parent::parseItem($item);
|
||||
$html = getSimpleHTMLDOMCached($item['uri']);
|
||||
@@ -123,6 +122,7 @@ class OnVaSortirBridge extends FeedExpander {
|
||||
$item['content'] = utf8_encode($text);
|
||||
return $item;
|
||||
}
|
||||
|
||||
public function collectData(){
|
||||
$this->collectExpandableDatas('https://' .
|
||||
$this->getInput('city') . '.onvasortir.com/rss.php');
|
||||
|
962
bridges/OneFortuneADayBridge.php
Normal file
962
bridges/OneFortuneADayBridge.php
Normal file
@@ -0,0 +1,962 @@
|
||||
<?php
|
||||
class OneFortuneADayBridge extends BridgeAbstract {
|
||||
const NAME = 'One Fortune a Day';
|
||||
const URI = 'https://github.com/fulmeek';
|
||||
const DESCRIPTION = 'Get a fortune quote every single day.';
|
||||
const MAINTAINER = 'fulmeek';
|
||||
const PARAMETERS = array(array(
|
||||
'time' => array(
|
||||
'name' => 'Time in UTC',
|
||||
'type' => 'list',
|
||||
'values' => array(
|
||||
'0:00' => 0,
|
||||
'1:00' => 1,
|
||||
'2:00' => 2,
|
||||
'3:00' => 3,
|
||||
'4:00' => 4,
|
||||
'5:00' => 5,
|
||||
'6:00' => 6,
|
||||
'7:00' => 7,
|
||||
'8:00' => 8,
|
||||
'9:00' => 9,
|
||||
'10:00' => 10,
|
||||
'11:00' => 11,
|
||||
'12:00' => 12,
|
||||
'13:00' => 13,
|
||||
'14:00' => 14,
|
||||
'15:00' => 15,
|
||||
'16:00' => 16,
|
||||
'17:00' => 17,
|
||||
'18:00' => 18,
|
||||
'19:00' => 19,
|
||||
'20:00' => 20,
|
||||
'21:00' => 21,
|
||||
'22:00' => 22,
|
||||
'23:00' => 23,
|
||||
),
|
||||
'defaultValue' => 5
|
||||
),
|
||||
'lucky' => array(
|
||||
'name' => 'Lucky number (optional)',
|
||||
'type' => 'text'
|
||||
)
|
||||
));
|
||||
|
||||
const LIMIT_ITEMS = 7;
|
||||
const DAY_SECS = 86400;
|
||||
|
||||
public function getDescription(){
|
||||
return self::DESCRIPTION . '<br/>Set a lucky number to get your personal quotes, like ' . mt_rand();
|
||||
}
|
||||
|
||||
public function collectData() {
|
||||
$time = gmmktime((int)$this->getInput('time'), 0, 0);
|
||||
if ($time > time())
|
||||
$time -= self::DAY_SECS;
|
||||
|
||||
for ($i = self::LIMIT_ITEMS; $i > 0; --$i) {
|
||||
$seed = gmdate('Ymd', $time) . $this->getInput('lucky');
|
||||
$quote = $this->getQuote($seed);
|
||||
|
||||
$item['title'] = strftime('%A, %x', $time);
|
||||
$item['content'] = htmlentities($quote, ENT_QUOTES, 'UTF-8');
|
||||
$item['timestamp'] = $time;
|
||||
$item['uid'] = hash('sha1', $seed);
|
||||
|
||||
$this->items[] = $item;
|
||||
|
||||
$time -= self::DAY_SECS;
|
||||
}
|
||||
}
|
||||
|
||||
private function getQuote($seed) {
|
||||
$quotes = explode('//', <<<QUOTES
|
||||
People are naturally attracted to you.
|
||||
//You learn from your mistakes... You will learn a lot today.
|
||||
//If you have something good in your life, don't let it go!
|
||||
//What ever you're goal is in life, embrace it visualize it, and for it will be
|
||||
yours.
|
||||
//Your shoes will make you happy today.
|
||||
//You cannot love life until you live the life you love.
|
||||
//Be on the lookout for coming events; They cast their shadows beforehand.
|
||||
//Land is always on the mind of a flying bird.
|
||||
//The man or woman you desire feels the same about you.
|
||||
//Meeting adversity well is the source of your strength.
|
||||
//A dream you have will come true.
|
||||
//Our deeds determine us, as much as we determine our deeds.
|
||||
//Never give up. You're not a failure if you don't give up.
|
||||
//You will become great if you believe in yourself.
|
||||
//There is no greater pleasure than seeing your loved ones prosper.
|
||||
//You will marry your lover.
|
||||
//A very attractive person has a message for you.
|
||||
//You already know the answer to the questions lingering inside your head.
|
||||
//It is now, and in this world, that we must live.
|
||||
//You must try, or hate yourself for not trying.
|
||||
//You can make your own happiness.
|
||||
//The greatest risk is not taking one.
|
||||
//The love of your life is stepping into your planet this summer.
|
||||
//Love can last a lifetime, if you want it to.
|
||||
//Adversity is the parent of virtue.
|
||||
//Serious trouble will bypass you.
|
||||
//A short stranger will soon enter your life with blessings to share.
|
||||
//Now is the time to try something new.
|
||||
//Wealth awaits you very soon.
|
||||
//If you feel you are right, stand firmly by your convictions.
|
||||
//If winter comes, can spring be far behind?
|
||||
//Keep your eye out for someone special.
|
||||
//You are very talented in many ways.
|
||||
//A stranger, is a friend you have not spoken to yet.
|
||||
//A new voyage will fill your life with untold memories.
|
||||
//You will travel to many exotic places in your lifetime.
|
||||
//Your ability for accomplishment will follow with success.
|
||||
//Nothing astonishes men so much as common sense and plain dealing.
|
||||
//Its amazing how much good you can do if you dont care who gets the credit.
|
||||
//Everyone agrees. You are the best.
|
||||
//LIFE CONSIST NOT IN HOLDING GOOD CARDS, BUT IN PLAYING THOSE YOU HOLD WELL.
|
||||
//Jealousy doesn't open doors, it closes them!
|
||||
//It's better to be alone sometimes.
|
||||
//When fear hurts you, conquer it and defeat it!
|
||||
//Let the deeds speak.
|
||||
//You will be called in to fulfill a position of high honor and responsibility.
|
||||
//The man on the top of the mountain did not fall there.
|
||||
//You will conquer obstacles to achieve success.
|
||||
//Joys are often the shadows, cast by sorrows.
|
||||
//Fortune favors the brave.
|
||||
//An upward movement initiated in time can counteract fate.
|
||||
//A journey of a thousand miles begins with a single step.
|
||||
//Sometimes you just need to lay on the floor.
|
||||
//Never give up. Always find a reason to keep trying.
|
||||
//If you have something worth fighting for, then fight for it.
|
||||
//Stop wishing. Start doing.
|
||||
//Accept your past without regrets. Handle your present with confidence. Face
|
||||
your future without fear.
|
||||
//Stay true to those who would do the same for you.
|
||||
//Ask yourself if what you are doing today is getting you closer to where you
|
||||
want to be tomorrow.
|
||||
//Happiness is an activity.
|
||||
//Help is always needed but not always appreciated. Stay true to your heart and
|
||||
help those in need weather they appreciate it or not.
|
||||
//Hone your competitive instincts.
|
||||
//Finish your work on hand don't be greedy.
|
||||
//For success today, look first to yourself.
|
||||
//Your fortune is as sweet as a cookie.
|
||||
//Integrity is the essence of everything successful.
|
||||
//If you're happy, you're successful.
|
||||
//You will always be surrounded by true friends
|
||||
//Believing that you are beautiful will make you appear beautiful to others
|
||||
around you.
|
||||
//Happinees comes from a good life.
|
||||
//Before trying to please others think of what makes you happy.
|
||||
//When hungry, order more Chinese food.
|
||||
//Your golden opportunity is coming shortly.
|
||||
//For hate is never conquered by hate. Hate is conquered by love .
|
||||
//You will make many changes before settling down happily.
|
||||
//A man is born to live and not prepare to live.
|
||||
//You cannot become rich except by enriching others.
|
||||
//Don't pursue happiness - create it.
|
||||
//You will be successful in love.
|
||||
//All your fingers can't be of the same length.
|
||||
//Wise sayings often fall on barren ground, but a kind word is never thrown away.
|
||||
//A lifetime of happiness is in store for you.
|
||||
//It is very possible that you will achieve greatness in your lifetime.
|
||||
//Be tactful; overlook your own opportunity.
|
||||
//You are the controller of your destiny.
|
||||
//Everything happens for a reson.
|
||||
//How can you have a beutiful ending without making beautiful mistakes.
|
||||
//You can open doors with your charm and patience.
|
||||
//Welcome the change coming into your life.
|
||||
//There will be a happy romance for you shortly.
|
||||
//Your fondest dream will come true within this year.
|
||||
//You have a deep interest in all that is artistic.
|
||||
//Your emotional nature is strong and sensitive.
|
||||
//A letter of great importance may reach you any day now.
|
||||
//Good health will be yours for a long time.
|
||||
//You will become better acquainted with a coworker.
|
||||
//To be old and wise, you must first be young and stupid.
|
||||
//Failure is only the opportunity to begin again more intelligently.
|
||||
//Integrity is doing the right thing, even if nobody is watching.
|
||||
//Conquer your fears or they will conquer you.
|
||||
//You are a lover of words; One day you will write a book.
|
||||
//In this life it is not what we take up, but what we give up, that makes us
|
||||
rich.
|
||||
//Fear can keep us up all night long, but faith makes one fine pillow.
|
||||
//Seek out the significance of your problem at this time. Try to understand.
|
||||
//Never upset the driver of the car you're in; they're the master of your
|
||||
destiny until you get home.
|
||||
//He who slithers among the ground is not always a foe.
|
||||
//You learn from your mistakes, you will learn a lot today.
|
||||
//You only need look to your own reflection for inspiration. Because you are
|
||||
Beautiful!
|
||||
//You are not judged by your efforts you put in; you are judged on your
|
||||
performance.
|
||||
//Rivers need springs.
|
||||
//Good news from afar may bring you a welcome visitor.
|
||||
//When all else seems to fail, smile for today and just love someone.
|
||||
//Patience is a virtue, unless its against a brick wall.
|
||||
//When you look down, all you see is dirt, so keep looking up.
|
||||
//If you are afraid to shake the dice, you will never throw a six.
|
||||
//Even if the person who appears most wrong, is also quite often right.
|
||||
//A single conversation with a wise man is better than ten years of study.
|
||||
//Happiness is often a rebound from hard work.
|
||||
//The world may be your oyster, but that doesn't mean you'll get it's pearl.
|
||||
//Your life will be filled with magical moments.
|
||||
//You're true love will show himself to you under the moonlight.
|
||||
//Do not follow where the path may lead. Go where there is no path...and leave a
|
||||
trail
|
||||
//Do not fear what you don't know
|
||||
//The object of your desire comes closer.
|
||||
//You have a flair for adding a fanciful dimension to any story.
|
||||
//If you wish to know the mind of a man, listen to his words
|
||||
//The most useless energy is trying to change what and who God so carefully
|
||||
created.
|
||||
//Do not be covered in sadness or be fooled in happiness they both must exist
|
||||
//You will have unexpected great good luck.
|
||||
//You will have a pleasant surprise
|
||||
//All progress occurs because people dare to be different.
|
||||
//Your ability for accomplishment will be followed by success.
|
||||
//The world is always ready to receive talent with open arms.
|
||||
//Things may come to those who wait, but only the things left by those who
|
||||
hustle.
|
||||
//We can't help everyone. But everyone can help someone.
|
||||
//Every day is a new day. But tomorrow is never promised.
|
||||
//Express yourself: Don't hold back!
|
||||
//It is not necessary to show others you have change; the change will be obvious.
|
||||
//You have a deep appreciation of the arts and music.
|
||||
//If your desires are not extravagant, they will be rewarded.
|
||||
//You try hard, never to fail. You don't, never to win.
|
||||
//Never give up on someone that you don't go a day without thinking about.
|
||||
//It never pays to kick a skunk.
|
||||
//In case of fire, keep calm, pay bill and run.
|
||||
//Next full moon brings an enchanting evening.
|
||||
//Not all closed eye is sleeping nor open eye is seeing.
|
||||
//Impossible is a word only to be found in the dictionary of fools.
|
||||
//You will soon witness a miracle.
|
||||
//The time is alway right to do what is right.
|
||||
//Love is as necessary to human beings as food and shelter.
|
||||
//You will make heads turn.
|
||||
//You are extremely loved. Don't worry :)
|
||||
//If you are never patient, you will never get anything done. If you believe you
|
||||
can do it, you will be rewarded with success.
|
||||
//You will soon embark on a business venture.
|
||||
//You believe in the goodness of man kind.
|
||||
//You will have a long and wealthy life.
|
||||
//You will take a pleasant journey to a place far away.
|
||||
//You are a person of culture.
|
||||
//Keep it simple. The more you say, the less people remember.
|
||||
//Life is like a dogsled team. If you ain't the lead dog, the scenery never
|
||||
changes.
|
||||
//Prosperity makes friends and adversity tries them.
|
||||
//Nothing seems impossible to you.
|
||||
//Patience is bitter, but its fruit is sweet.
|
||||
//The only certainty is that nothing is certain.
|
||||
//Success is the sum of my unique visions realized by the sweat of perseverance.
|
||||
//When you expect your opponent to yield, you also should avoid hurting him.
|
||||
//Human evolution: “wider freeway but narrower viewpoints.
|
||||
//Intelligence is the door to freedom and alert attention is the mother of
|
||||
intelligence.
|
||||
//Back away from individuals who are impulsive.
|
||||
//Enjoyed the meal? Buy one to go too.
|
||||
//You believe in the goodness of mankind.
|
||||
//A big fortune will descend upon you this year.
|
||||
//Now these three remain, faith, hope, and love. The greatest of these is love.
|
||||
//For success today look first to yourself.
|
||||
//Determination is the wake-up call to the human will.
|
||||
//There are no limitations to the mind except those we aknowledge.
|
||||
//A merry heart does good like a medicine.
|
||||
//Whenever possible, keep it simple.
|
||||
//Your dearest wish will come true.
|
||||
//Poverty is no disgrace.
|
||||
//If you don’t do it excellently, don’t do it at all.
|
||||
//You have an unusual equipment for success, use it properly.
|
||||
//Emotion is energy in motion.
|
||||
//You will soon be honored by someone you respect.
|
||||
//Punctuality is the politeness of kings and the duty of gentle people
|
||||
everywhere.
|
||||
//Your happiness is intertwined with your outlook on life.
|
||||
//Elegant surroundings will soon be yours.
|
||||
//If you feel you are right, stand firmly by your convictions.
|
||||
//Your smile brings happiness to everyone you meet.
|
||||
//Instead of worrying and agonizing, move ahead constructively.
|
||||
//Do you believe? Endurance and persistence will be rewarded.
|
||||
//A new business venture is on the horizon.
|
||||
//Never underestimate the power of the human touch.
|
||||
//Hold on to the past but eventually, let the times go and keep the memories
|
||||
into the present.
|
||||
//Truth is an unpopular subject. Because it is unquestionably correct.
|
||||
//The most important thing in communication is to hear what isn’t being said.
|
||||
//You are broad minded and socially active.
|
||||
//Your dearest dream is coming true. God looks after you especially.
|
||||
//You will recieve some high prize or award.
|
||||
//Your present question marks are going to succeed.
|
||||
//You have a fine capacity for the enjoyment of life.
|
||||
//You will live long and enjoy life.
|
||||
//An admirer is concealing his/her affection for you.
|
||||
//A wish is what makes life happen when you dream of rose petals.
|
||||
//Love can turn cottage into a golden palace.
|
||||
//Lend your money and lose your freind.
|
||||
//You will kiss your crush ohhh lalahh
|
||||
//You will be rewarded for being a good listener in the next week.
|
||||
//If you never give up on love, It will never give up on you.
|
||||
//Unleash your life force.
|
||||
//Your wish will come true.
|
||||
//There is a prospect of a thrilling time ahead for you.
|
||||
//No distance is too far, if two hearts are tied together.
|
||||
//Land is always in the mind of the flying birds.
|
||||
//Try? No! Do or do not, there is no try.
|
||||
//Do not worry, you will have great peace.
|
||||
//It's about time you asked that special someone on a date.
|
||||
//You create your own stage ... the audience is waiting.
|
||||
//It is never too late. Just as it is never too early.
|
||||
//Discover the power within yourself.
|
||||
//Good things take time.
|
||||
//Stop thinking about the road not taken and pave over the one you did.
|
||||
//Put your unhappiness aside. Life is beautiful, be happy.
|
||||
//You can still love what you can not have in life.
|
||||
//Make a wise choice everyday.
|
||||
//Circumstance does not make the man; it reveals him to himself.
|
||||
//The man who waits till tomorrow, misses the opportunities of today.
|
||||
//Life does not get better by chance. It gets better by change.
|
||||
//If you never expect anything you can never be disappointed.
|
||||
//People in your surroundings will be more cooperative than usual.
|
||||
//True wisdom is found in happiness.
|
||||
//Ones always regrets what could have done. Remember for next time.
|
||||
//Follow your bliss and the Universe will open doors where there were once only
|
||||
walls.
|
||||
//Find a peaceful place where you can make plans for the future.
|
||||
//All the water in the world can't sink a ship unless it gets inside.
|
||||
//The earth is a school learn in it.
|
||||
//In music, one must think with his heart and feel with his brain.
|
||||
//If you speak honestly, everyone will listen.
|
||||
//Ganerosity will repay itself sooner than you imagine.
|
||||
//good things take time
|
||||
//Do what is right, not what you should.
|
||||
//To effect the quality of the day is no small achievement.
|
||||
//Simplicity and clearity should be the theme in your dress.
|
||||
//Virtuous find joy while Wrongdoers find grieve in their actions.
|
||||
//Not all closed eye is sleeping, nor open eye is seeing.
|
||||
//Bread today is better than cake tomorrow.
|
||||
//In evrything there is a piece of truth.But a piece.
|
||||
//A feeling is an idea with roots.
|
||||
//Man is born to live and not prepare to live
|
||||
//It's all right to have butterflies in your stomach. Just get them to fly in
|
||||
formation.
|
||||
//If you don t give something, you will not get anything
|
||||
//The harder you try to not be like your parents, the more likely you will
|
||||
become them
|
||||
//Someday everything will all make perfect sense
|
||||
//you will think for yourself when you stop letting others think for you
|
||||
//Everything will be ok. Don't obsess. Time will prove you right, you must stay
|
||||
where you are.
|
||||
//Let's finish this up now, someone is waiting for you on that
|
||||
//The finest men like the finest steels have been tempered in the hottest
|
||||
furnace.
|
||||
//A dream you have will come true
|
||||
//The worst of friends may become the best of enemies, but you will always find
|
||||
yourself hanging on.
|
||||
//I think, you ate your fortune while you were eating your cookie
|
||||
//If u love someone keep fighting for them
|
||||
//Do what you want, when you want, and you will be rewarded
|
||||
//Let your fantasies unwind...
|
||||
//The cooler you think you are the dumber you look
|
||||
//Expect great things and great things will come
|
||||
//The Wheel of Good Fortune is finally turning in your direction!
|
||||
//Don't lead if you won't lead.
|
||||
//You will always be successful in your professional career
|
||||
//Share your hapiness with others today.
|
||||
//It's up to you to clearify.
|
||||
//Your future will be happy and productive.
|
||||
//Seize every second of your life and savor it.
|
||||
//Those who walk in other's tracks leave no footprints.
|
||||
//Failure is the mother of all success.
|
||||
//Difficulty at the beginning useually means ease at the end.
|
||||
//Do not seek so much to find the answer as much as to understand the question
|
||||
better.
|
||||
//Your way of doing what other people do their way is what makes you special.
|
||||
//A beautiful, smart, and loving person will be coming into your life.
|
||||
//Friendship is an ocean that you cannot see bottom.
|
||||
//Your life does not get better by chance, it gets better by change.
|
||||
//Our duty,as men and women,is to proceed as if limits to our ability did not
|
||||
exist.
|
||||
//A pleasant expeience is ahead:don't pass it by.
|
||||
//Our perception and attitude toward any situation will determine the outcome
|
||||
//They say you are stubborn; you call it persistence.
|
||||
//Two small jumps are sometimes better than one big leap.
|
||||
//A new wardrobe brings great joy and change to your life.
|
||||
//The cure for grief is motion.
|
||||
//It's a good thing that life is not as serious as it seems to the waiter
|
||||
//I hear and I forget. I see and I remember. I do and I understand.
|
||||
//I have a dream....Time to go to bed.
|
||||
//Ideas you believe are absurd ultimately lead to success!
|
||||
//A human being is a deciding being.
|
||||
//Today is an ideal time to water your parsonal garden.
|
||||
//Some men dream of fortunes, others dream of cookies.
|
||||
//Things are never quite the way they seem.
|
||||
//the project on your mind will soon gain momentum
|
||||
//YOUR FAILURES WILL LEAD YOU TO YOUR SUCCESS.
|
||||
//IN ORDER TO GET THE RAINBOW, YOU MUST ENDURE THE RAIN.
|
||||
//Beauty is simply beauty. originality is magical.
|
||||
//Your dream will come true when you least expect it.
|
||||
//Let not your hand be stretched out to receive and shut when you should repay.
|
||||
//Don't worry, half the people you know are below average.
|
||||
//Vision is the art of seeing what is invisible to others.
|
||||
//You don't need talent to gain experience.
|
||||
//A focused mind is one of the most powerful forces in the universe.
|
||||
//Today you shed your last tear. Tomorrow fortune knocks at your door.
|
||||
//Be patient! The Great Wall didn't got build in one day.
|
||||
//Think you can. Think you can't. Either way, you'll be right.
|
||||
//Wisdom is on her way to you.
|
||||
//Digital circuits are made from analog parts.
|
||||
//If you eat a box of fortune cookies, anything is possible.
|
||||
//The best is yet to come.
|
||||
//I'm with you.
|
||||
//Be direct,usually one can accomplish more that way.
|
||||
//A single kind work will keep one warm for years.
|
||||
//Ask a friend to join you on your next voyage.
|
||||
//In God we trust.
|
||||
//Love is free. Lust will cost you everything you have.
|
||||
//Stop searching forever, happiness is just next to you.
|
||||
//You don't need the answers to all of life's questions. Just ask your father
|
||||
what to do.
|
||||
//Jealousy is a useless emotion.
|
||||
//You are not a ghost.
|
||||
//There is someone rather annoying in your life that you need to listen to.
|
||||
//You will plant the smallest seed and it will become the greatest and most
|
||||
mighty tree in the world.
|
||||
//The dream you've been dreaming all your life isn't worth it. Find a new dream,
|
||||
and once you're sure you've found it, fight for it.
|
||||
//See if you can learn anything from the children.
|
||||
//It's Never Too Late For Good Things To Happen!
|
||||
//A clear conscience is usually the sign of a bad memory.
|
||||
//Aim high, time flies.
|
||||
//One is not sleeping, does not mean they are awake.
|
||||
//A great pleasure in life is doing what others say you can't.
|
||||
//Isn't there something else you should be working on right now?
|
||||
//Your father still loves and is in always with you. Remember that.
|
||||
//Before you can be reborn you must die.
|
||||
//It better to be the hammer than the nail.
|
||||
//You are admired by everyone for your talent and ability.
|
||||
//Save the whales. Collect the whole set.
|
||||
//You will soon discover a major truth about the one you love most.
|
||||
//Your life will prosper only if you acknowledge your faults and work to reduce
|
||||
them.
|
||||
//Pray to God, but row towards shore.
|
||||
//You will soon witness a miracle.
|
||||
//The early bird gets the worm, but the second mouse gets the cheese
|
||||
//Help, I'm being held prisoner in a Chinese cookie factory.
|
||||
//Alas! The onion you are eating is someone else’s water lily.
|
||||
//You are a persoon with a good sense of justice, now it's time to act like it.
|
||||
//You create enthusiasm around you.
|
||||
//There are big changes ahead for you. They will be good ones!
|
||||
//You will have many happy days soon.
|
||||
//Out of confusion comes new patterns.
|
||||
//If you love someone enough and they break your heart, you can't stop yourself
|
||||
from still loving them again even after all that pain.
|
||||
//Look right...Now look left...Now look forward (do this really fast) do you
|
||||
feel any different? good you should feel dizzy.
|
||||
//Live like you are on the bottom, even if you are on the top.
|
||||
//You will soon emerge victorious from the maze you've been traveling in.
|
||||
//Do not judge a book by it's color.
|
||||
//Everything will come your way.
|
||||
//There is a time to be practical now.
|
||||
//Bend the rod while it is still hot.
|
||||
//Darkness is only succesful when there is no light. Don't forget about light!
|
||||
//Acting is not lying. It is findind someone hiding inside you and letting that
|
||||
person run free.
|
||||
//You will be forced to face fear, but if you do not run, fear will be afraid of
|
||||
you.
|
||||
//You are thinking about doing something. Don't do it, it won't help anything.
|
||||
//Your worst enemy has a crush on you!
|
||||
//Love Conquers all.
|
||||
//The phrase is follow your dreams. Not dream period.
|
||||
//stop nagging to your partner and take it day by day.
|
||||
//Do not think that me or my brothers have supreme control over what will happen
|
||||
to you.
|
||||
//Bad luck and misfortune will follow you all your days.
|
||||
//Remember the fate of the early Worm.
|
||||
//Begin your life anew with strength, grace and wonder.
|
||||
//Be a good friend and a fair enemy.
|
||||
//What goes around comes around.
|
||||
//Bad luck and misfortune will infest your pathetic soul for all eternity.
|
||||
//The best prophet of the future is the past
|
||||
//Movies have pause buttons, friends do not
|
||||
//Use the force.
|
||||
//Trust your intuition.
|
||||
//Encourage your peers.
|
||||
//Let your imagination wander.
|
||||
//Your pain is the breaking of the shell that encloses your understanding.
|
||||
//Patience is key, a wait short or long will have its reward.
|
||||
//Tell them before it's too late...
|
||||
//A bird in the hand is worth three in the bush!!
|
||||
//Be assertive when decisive action is needed.
|
||||
//To determine whether someone is beautiful is not by looking at his/her
|
||||
appearance, but his/her heart.
|
||||
//Hope brings about a better future
|
||||
//While you have this day, fill it with life. While you're in this moment, give
|
||||
it your own special meaning and purpose and joy.
|
||||
//Even though it will often be difficult and complicated, you know you have what
|
||||
it takes to get it done.
|
||||
//You can choose, right now and in every moment, to put your powerful and
|
||||
effective abilities to purposeful use. There is always something you can do, no
|
||||
matter what the situation may be, that will move your life forward.
|
||||
//IT IS NOT GOOD TO BE A USER BLESSINGS COME FROM BEING A GIVER NOT A TAKER.
|
||||
//Cookie says, You crack me up
|
||||
//You will prosper in the field of wacky inventions.
|
||||
//Your tongue is your ambassador.
|
||||
//The cure for grief is movement.
|
||||
//Love Is At Your Hands Be Glad And Hold On To It.
|
||||
//You are often asked if it is in yet.
|
||||
//Life to you is a bold and dashing responsibility.
|
||||
//Patience is a key to joy.
|
||||
//A bargain is something you don't need at a price you can't resist.
|
||||
//Today is going to be a disasterous day, be prepared!
|
||||
//Stay to your inner-self, you will benefit in many ways.
|
||||
//Rarely do great beauty and great virtue dwell together as they do in you.
|
||||
//You are talented in many ways.
|
||||
//You are the master of every situation.
|
||||
//Your problem just got bigger. Think, what have you done.
|
||||
//If your cookie still in one piece, buy lotto.
|
||||
//Go with the flow will make your transition ever so much easier.
|
||||
//Tomorrow Morning,Take a Left Turn As Soon As You Leave Home
|
||||
//A metaphor could save your life.
|
||||
//Don't wait for your ship to come in, swim out to it
|
||||
//There are lessons to be learned by listening to others.
|
||||
//If you want the rainbow, you have to tolerate the rain.
|
||||
//Volition, Strength, Languages, Freedom and Power rests in you.
|
||||
//TOO MANY PEOPLE VOLUNTEER TO CARRY THE STOOL WHEN ITS TIME TO MOVE THE PIANO
|
||||
//It takes more than a good memory to have good memories.
|
||||
//You are what you are; understand yourself before you react
|
||||
//Word to the wise: Don't play leapfrog with a unicorn.........
|
||||
//Forgive your enemies, but never forget them.
|
||||
//Everything will now come your way
|
||||
//Don't worry about the stock market. Invest in family.
|
||||
//Your fortune is as sweet as a cookie.
|
||||
//It is much easier to look for the bad, than it is to find the good
|
||||
//If a person who has caused you pain and suffering has brought you, reconsider
|
||||
that person's value in your life
|
||||
//You are worth loving, you are also worth the effort it takes to love you
|
||||
//Never trouble trouble till trouble troubles you.
|
||||
//Get off to a new start - come out of your shell.
|
||||
//Life is a dancefloor,you are the DJ!
|
||||
//Cooperate with those who have both know how and integrith.
|
||||
//Minor aches today are likely to pay off handsomely tomorrow.
|
||||
//You are about to become $8.95 poorer. ($6.95 if you had the buffet)
|
||||
//Your mouth may be moving, but nobody is listening.
|
||||
//Focus in on the color yellow tomorrow for good luck!
|
||||
//The problem with resisting temptation is that it may never come again.
|
||||
//All your sorrows will vanish.
|
||||
//About time I got out of that cookie.
|
||||
//Love will lead the way.
|
||||
//The ads revenge is massive success
|
||||
//It is best to act with confidence, no matter how little right you have to it.
|
||||
//Soon, a visitor shall delight you.
|
||||
//What breaks in a moment may take years to mend.
|
||||
//Someone stole your fortune and replaced it with this one. Your luck sucks.
|
||||
Have a good day!
|
||||
//Take control of your life rather than letting things happen just like that!
|
||||
//You will be rewarded for your patience and understanding.
|
||||
//You will achieve all your desires and pleasures.
|
||||
//Never miss a chance to keep your mouth shut.
|
||||
//Nothing Shows A Man's Character More Than What He Laughs At.
|
||||
//Never regret anything that made you smile.
|
||||
//Love Takes Pratice.
|
||||
//Don't take yourself so seriously, no one else does.
|
||||
//You've got what it takes, but it will take everything you've got!
|
||||
//At this very moment you can change the rest of your life.
|
||||
//Become who you are.
|
||||
//All comes at the proper time to him who knows how to wait.
|
||||
//The energy is within you. Money is Coming!
|
||||
//The quotes that you do not understand, are not meant for you.
|
||||
//You have an important new business development shaping up.
|
||||
//if love someone a lot tell it before it's too late
|
||||
//Birds are entangled by their feet and men by their tongues.
|
||||
//Benefit by doing things that others give up on.
|
||||
//Rest has a peaceful effect on your physical and emotional health.
|
||||
//One of the best ways to persuade others is with your ears--by listening to
|
||||
them.
|
||||
//Plan your work and work your plan.
|
||||
//Over self-confidence is equal to being blind.
|
||||
//Those who bring sunshine to the lives of others cannot keep it from themselves.
|
||||
//Love or money, or neither?
|
||||
//Before the beginning of great brilliance, there must be chaos.
|
||||
//Old friends make best friends.
|
||||
//Stop searching forever. Happiness is just next to you.
|
||||
//Accept something that you cannot change, and you will feel better.
|
||||
//Kiss is not a kiss without the heart.
|
||||
//Enhance your karma by engaging in various charitable activities.
|
||||
//You will have good luck and overcome many hardships.
|
||||
//You never hesitate to tackle the most difficult problems.
|
||||
//Hope is like food. You will starve without it.
|
||||
//WHEN FIRE AND WATER GO TO WAR WATER ALWAYS WINS.
|
||||
//An angry man opens his mouth and shuts up his eyes.
|
||||
//Make the system work for you, not the other way around.
|
||||
//You will be hungry soon, order takeout now.
|
||||
//Be prepared for extra energy.
|
||||
//An unexpected relationship will become permanent.
|
||||
//The love of your life is sitting across from you.
|
||||
//Better be the head of a chicken than the tail of an ox.
|
||||
//To forgive others one more time is to create one more blessing for yourself.
|
||||
//Enjoy yourself while you can.
|
||||
//The ultimate test of a relationship is to disagree but to hold hands.
|
||||
//Excellence is the difference between what I do and what I am capable of.
|
||||
//Do not let what you do not have prevent you from using what you do have.
|
||||
//What ends on hope does not end at all.
|
||||
//People enjoy having you around. Appreciate this.
|
||||
//You are admired for your adventuous ways.
|
||||
//It's never crowded along the extra mile
|
||||
//You are blessed, today is the day to bless others.
|
||||
//The Greatest War Sometimes Isn't On The Battlefield But Against Oneself.
|
||||
//People in your background will be more co-operative than usual.
|
||||
//A good way to stay healthy is to eat more Chinese food.
|
||||
//Anyone who dares to be, can never be weak.
|
||||
//Affirm it, visualize it, believe it, and it`will actualize itself.
|
||||
//The measure of time to your next goal is the measure of your discipline.
|
||||
//Help, I'm prisoner in a Chinese bakery!!!
|
||||
//Take a minute and let it ride, then take a minute to let it breeze.
|
||||
//We are here to love each other, serve each other and uplift each other.
|
||||
//If everybody is a worm you should be a glow worm
|
||||
//To affirm is to make firm.
|
||||
//Remember this: duct tape can fix anything, so don't worry about messing things
|
||||
up.
|
||||
//You broke my cookie!
|
||||
//Failure is not defeat until you stop trying.
|
||||
//The days that make us happy make us wise.
|
||||
//Men do not fail... they give up trying.
|
||||
//Time may fly by. But Memories don't.
|
||||
//You will win success in whatever you adopt.
|
||||
//You will outdistance all your competitors.
|
||||
//You have a great capability to break cookies - use it wisely!
|
||||
//AT TIMES IT IS BETTER TO KNOW WHEN EXIT THAN ENTER
|
||||
//Money will come to you when you are doing the right thing.
|
||||
//When you get something for nothing, you just haven't been billed for it yet.
|
||||
//You will discover your hidden talents.
|
||||
//You'll advance for with your abilities.
|
||||
//When you can't naturally feel upbeat it can sometimes help you to act as if
|
||||
you did.
|
||||
//You will overcome difficult times.
|
||||
//Your problem just became your stepping stone. Catch the moment.
|
||||
//I am a fortune. You just broke my little house. Where will i live now?
|
||||
//The majority of the word can't is can.
|
||||
//The secret of getting ahead is getting started.
|
||||
//Be most affectionate today.
|
||||
//Change your thoughts and you change the world.
|
||||
//Sing and rejoice, fortune is smiling on you.
|
||||
//All the preparation you've done will finally be paying off!
|
||||
//A truly great person never puts away the simplicity of a child.
|
||||
//Customer service is like taking a bath you have to keep doing it.
|
||||
//The expanse of your intelligence is a void no universe could ever fill.
|
||||
//Those grapes you cannot taste are always sour.
|
||||
//An unexpected aquaintance will resurface.
|
||||
//If you want the rainbow, then you have to tolerate the rain.
|
||||
//You don't get harmony when everyone sings the same note.
|
||||
//The race is not always to the swift, but to those who keep on running.
|
||||
//The early bird gets the worm, but the second mouse gets the cheese.
|
||||
//The best things in life aren't things.
|
||||
//Don't bother looking for fault. The reward for finding it is low.
|
||||
//Everything has beauty but not everyone sees it.
|
||||
//Nothing is as good or bad as it appears.
|
||||
//Never cut what you can untie.
|
||||
//Meet your opponent half way. You need the exercise.
|
||||
//Laughter is the shortest distance between two people.
|
||||
//We cannot change the direction of the wind, but we can adjust our sails.
|
||||
//We could learn a lot from crayons: Some of are sharp, some are pretty, some
|
||||
have weird names, and all are different colors. But they all have to learn to
|
||||
live in the same box.
|
||||
//Use your instincts now.
|
||||
//If you take a single step to your journey, you'll succeed; it's not best to
|
||||
fail.
|
||||
//In the eyes of lovers, everything is beautiful.
|
||||
//Warning, do not eat your fortune.
|
||||
//Demonstrate refinement in everything you do.
|
||||
//Impossible standards just make life difficult.
|
||||
//A different world cannot be build by indifferent people.
|
||||
//Q. What is H2O? A. Caring, 2 parts Hug and 1 part Open-mind.
|
||||
//All troubles you have can pass away very quickly.
|
||||
//Integrity is the essense of everything successful.
|
||||
//For true love? Send real roses preserved in 24kt gold!
|
||||
//Sometimes the object of the journey is not the end, but the journey itself.
|
||||
//Fear is just excitement in need of an attitude adjustment.
|
||||
//The food here taste so good, even a cave man likes it.
|
||||
//Perhaps you've been focusing too much on spending.
|
||||
//Happiness isn't something you remember, it's something you experience.
|
||||
//Oops... Wrong cookie.
|
||||
//The dream is within you.
|
||||
//Love is on its way.
|
||||
//Be direct, usually one can accomplish more that way.
|
||||
//Use your talents. That's what they are intended for.
|
||||
//The troubles you have now will pass away quickly.
|
||||
//See the light at the end of the tunnel.
|
||||
//Your dream will come true when you least expect it.
|
||||
//Don't 'face' reality, let it be the place from which you leap.
|
||||
//Fortune smiles upon you today.
|
||||
//Believing is doing.
|
||||
//Your dynamic eyes have attracted a secret admirer.
|
||||
//You know where you are going and how to get there.
|
||||
//Go confidently in the direction of your dreams.
|
||||
//Your ability to pick a winner will bring you success.
|
||||
//Humor usually works at the moment of awkwardness.
|
||||
//A good time to finish up old tasks.
|
||||
//Stop procrastinating - starting tomorrow
|
||||
//Enthusiastic leadership gets you a promotion when you least expect it.
|
||||
//You love Chinese food.
|
||||
//You are far more influential than you think.
|
||||
//Adjust finances, make budgets, to improve your standing.
|
||||
//Happiness is not the absence of conflict, but the ability to cope with it.
|
||||
//An understanding heart warms all that are graced with it's presense.
|
||||
//Your co-workers take pleasure in your great sense of creativity.
|
||||
//You are one of the people who goes places in life.
|
||||
//Others enjoy your company.
|
||||
//When in doubt, let your instincts guide you.
|
||||
//A cheerful message is on its way to you.
|
||||
//A pleasant surprise is in store for you tonight.
|
||||
//you cant go down the right path with out first discovering the path to go down
|
||||
//To courageously shoulder the responsibility of one's mistake is character.
|
||||
//The joyful energy of the day will have a positive affect on you.
|
||||
//You have a strong desire for a home and your family interests come first.
|
||||
//Dogs have owners, cats have staff.
|
||||
//Be patient: in time, even an egg will walk.
|
||||
//You are not a person who can be ignored.
|
||||
//You always know the right times to be assertive or to simply wait.
|
||||
//Reading to the mind is what exercise is to the body.
|
||||
//Eat something you never tried before.
|
||||
//Your life becomes more and more of an adventure!
|
||||
//You need to live authentically, and you can't ignore that.
|
||||
//Make all you can, save all you can, give all you can.
|
||||
//A well-aimed spear is worth three.
|
||||
//To build a better world, start in your community.
|
||||
//When you can't naturally feel upbeat, it can sometimes help to act a if you
|
||||
did.
|
||||
//May you have great luck.
|
||||
//A kind word will keep someone warm for years.
|
||||
//Nothing in the world is accomplished without passion.
|
||||
//Human invented language to satisfy the need to complain.
|
||||
//Accept what comes to you each day.
|
||||
//A small lucky package is on its way to you soon.
|
||||
//In human endeavor, chance favors the prepared mind.
|
||||
//Do not upset the penguin today.
|
||||
//Don't cry.
|
||||
//The best way to give credit is to give it away.
|
||||
//Anything you do, do it well. The last thing you want is to be sorry for what
|
||||
you didn't do.
|
||||
//It takes more then good memory to have good memories.
|
||||
//Grant yourself a wish this year only you can do it.
|
||||
//love thy neighbour, just don't get caught
|
||||
//You will be selected for a promotion because of your accomplishments.
|
||||
//There are many new opportunities that are being presented to you.
|
||||
//You will inherit a large sum of money.
|
||||
//You will recieve a gift from someone that cares about you.
|
||||
//You are not illiterate.
|
||||
//Love because it is the only true adventure.
|
||||
//You are contemplating some action which will bring credit upon you
|
||||
//Keep true to the dreams of your youth.
|
||||
//Treasure what you have.
|
||||
//The greatest precept is continual awareness.
|
||||
//A new friend helps you break out of an old routine.
|
||||
//I have a dream.... Time to go to bed.
|
||||
//Your skill will accomplish what the force of many cannot.
|
||||
//You will soon be surrounded by good friends and laughter.
|
||||
//The best is yet to come.
|
||||
//It is better to be the hammer then the anvil.
|
||||
//He who climbs a ladder must begin at the first step.
|
||||
//Action speaks nothing, without the Motive.
|
||||
//Give yourself some peace and quiet for at least a few hours.
|
||||
//Live each day well and wisely
|
||||
//Old dreams never die they just get filed away.
|
||||
//You can fix it with a little extra energy and a positive attitude.
|
||||
//Life is a verb
|
||||
//A man without aim is like a clock without hands, as useless if it turns as if
|
||||
it stands.
|
||||
//Many folks are about as happy as they make up their minds to be.
|
||||
//It's kind of fun to do the impossible
|
||||
//Wow! A secret message from you teeth!
|
||||
//You should be able to make money and hold on to it.
|
||||
//The human spirit is stronger than anything that can happen to it.
|
||||
//Your succeess will astonish everyone.
|
||||
//It is better to have a hen tomorrow than an egg today.
|
||||
//Judge each day not by the harvest you reap but by the seeds you plant.
|
||||
//You like Chinese food.
|
||||
//Your hard work will get payoff today.
|
||||
//Today is the tomorrow we worried about yesterday
|
||||
//There are no shortcuts to any place worth going
|
||||
//No matter what your past has been, you have a spotless future.
|
||||
//Your secret desire to completely change your life will manifest.
|
||||
//Soon you will be sitting on top of the world.
|
||||
//You are never selfish with your advice or your help.
|
||||
//A thrilling time is in store for you.
|
||||
//It's tough to be fascinating.
|
||||
//Soon life will become more interesting
|
||||
//Luck sometimes visits a fool, but it never sits down with him.
|
||||
//Keep your plans secret for now.
|
||||
//Aren't you glad you just had a great meal?
|
||||
//Traveling this year will bring your life into greater perspective.
|
||||
//Only talent people get help from others.
|
||||
//Constant grinding can turn an iron nod into a needle.
|
||||
//You will be successful in your work
|
||||
//you will spend old age in confort and material wealth
|
||||
//When you're about to turn your heart into a stone remember: you do not walk
|
||||
alone.
|
||||
//I am a bad luck person since I was born
|
||||
//You are vigorous in words and action.
|
||||
//The one who snores will always fall asleep first.
|
||||
//An alien of some sort will be appearing to you shortly!
|
||||
//Rest is a good thing, but boredom is its brother.
|
||||
//Do not be overly judgemental of your loved one's intentions or actions.
|
||||
//Think of how you can assist on a problem, not who to blame.
|
||||
//The life of every woman or man - the heart of it - is pure and holy joy.
|
||||
//Take it easy
|
||||
//Trust your intuition. The universe is guiding your life.
|
||||
//Use your head, but live in your heart.
|
||||
//Don't find fault, find a remedy
|
||||
//It may be those who do most, dream most
|
||||
//Your passions sweep you away.
|
||||
//Listen to yourself more often
|
||||
//Think of mother's exhortations more.
|
||||
//The gambler is like the fisherman both have beginners luck.
|
||||
//You are given the chance to take part in an exciting adventure.
|
||||
//The simplest answer is to act.
|
||||
//You will always be surrounded by true friends.
|
||||
//Keep your feet on the ground even though friends flatter you.
|
||||
//You are the man of righteousness and integrity.
|
||||
//He who seeks will find.
|
||||
//The smart thing to do is to begin trusting your intuitions.
|
||||
//Your many hidden talents will become obvious to those around you.
|
||||
//Pick a path with heart.
|
||||
//The human spirit is stronger then anything that can happen to it.
|
||||
//It takes more than good memory to have good memories.
|
||||
//Face facts with dignity.
|
||||
//Be calm when confronting an emergency crisis.
|
||||
//Do you believe? Endurance and persistence will be rewarded.
|
||||
//A new wardrobe brings great joy and change in your life.
|
||||
//Everyone agrees you are the best.
|
||||
//A new outlook brightens your image and brings new friends.
|
||||
//Everything will now come your way.
|
||||
//You will be called to fill a position of high honor and responsibility.
|
||||
//The eyes believe themselves; the ears believe other people.
|
||||
//Good beginning is half done.
|
||||
//Some pursue happiness; you create it.
|
||||
//It's the worst of times, you need to summon your optimism.
|
||||
//You are cautious in showing your true self to others.
|
||||
//Your ability to accomplish tasks will follow with success.
|
||||
//We all have extraordinary coded within us, waiting to be released.
|
||||
//You will have a bright future.
|
||||
//Compassion is a way of being.
|
||||
//You will always have good luck in your personal affairs.
|
||||
//The pleasure of what we enjoy is lost by wanting more
|
||||
//Did you remember to order your take out also?
|
||||
//Perhaps you've been focusing too much on that one thing..
|
||||
//Right now there's an energy pushing you in a new direction.
|
||||
//Everybody feels lucky for having you as a friend.
|
||||
//When the moment comes, take the top one.
|
||||
//Sometimes travel to new places leads to great transformation.
|
||||
//There is always a way - if you are committed.
|
||||
//Life is too short to waste time hating anyone.
|
||||
//All the world may not love a lover but they will be watching him.
|
||||
//Don't just spend time, invest it.
|
||||
//Life always gets harder near the summit.
|
||||
//Take the chance while you still have the choice.
|
||||
//It is much easier to be cirtical than to be correct.
|
||||
//Enjoy life! It is better to be happy than wise.
|
||||
//To make the cart go, you must grease the wheels.
|
||||
//You are contemplating some action which will bring credit upon you.
|
||||
//Before you wonder Am I doing things right, ask Am I doing the right things?
|
||||
//You may be disappointed if you fail, but you are doomed if you don't try.
|
||||
//You will always get what you want through your charm and personality.
|
||||
//The big issues are work, career, or status right now.
|
||||
//Your emotional currents are flowing powerfully now.
|
||||
//Any decision you have to make tomorrow is a good decsion.
|
||||
//Consume less. Share more. Enjoy life.
|
||||
//The secret of staying young is good health and lying about your age.
|
||||
//Spring has sprung. Life is blooming.
|
||||
//Go ask your mom.
|
||||
//The possibility of a career change is near.
|
||||
//The important thing is to never stop questioning.
|
||||
//Compassion will cure more then condemnation.
|
||||
//Excuses are easy to manufacture, and hard to sell.
|
||||
//Put your mind into planning today. Look into the future.
|
||||
//Listen to life, and you will hear the voice of life crying, Be!
|
||||
//Broke is only temporaryl poor is a state of mind.
|
||||
//Here we go. Moo Shu Cereal for breakfast with duck sauce.
|
||||
//Teamwork: the fuel that allows common people attain uncommon results.
|
||||
//Hard words break no bones, fine words butter no parsnips.
|
||||
//We cannot direct the wind but we can adjust the sails.
|
||||
//You are offered the dream of a lifetime. Say yes!
|
||||
//Working out the kinks today will make for a better tomorrow.
|
||||
//You have a curious smile and a mysterious nature.
|
||||
//Questions provide the key to unlocking our unlimited potential.
|
||||
//You will enjoy razon-sharp spiritual vision today.
|
||||
//The wise are aware of their treasure, while fools follow their vanity
|
||||
//Well-arranged time is the surest sign of a well-arranged mind.
|
||||
//Never bring unhappy feelings into your home.
|
||||
//This is really a lovely day. Congratulations!
|
||||
//Bad luck and ill misfortune will infest your pathetic soul for all eternity.
|
||||
//A golden egg of opportunity falls into your lap this month.
|
||||
//You are very grateful for the small pleasures of life.
|
||||
//today you should be a passenger. Stay close to a driver for a day.
|
||||
//For hate is never conquered by hate. Hate is conquered by love.
|
||||
//Service is the rent we pay for the privilege of living on this planet.
|
||||
//Good clothes open many doors. Go shopping.
|
||||
//The leader seeks to communicate his vision to his followers.
|
||||
//Great works are performed not by strength, but by perseverance.
|
||||
//People who are late are often happier than those who have to wait for them
|
||||
//Present your best ideas today to an eager and welcoming audience.
|
||||
//Friends long absent are coming back to you.
|
||||
//The time is right to make new friends.
|
||||
//Life to you is a dashing and bold adventure
|
||||
//You may be hungry soon: order a takeout now.
|
||||
//Do not hesitate to look for help, an extra hand should always be welcomed.
|
||||
//How can you have a beautiful ending without making beautiful mistakes?
|
||||
//Humor is an affirmation of dignity
|
||||
//He who climbs a ladder must begin at the first step
|
||||
//What's vice today may be virtue tomorow.
|
||||
//You have an unusually magnetic personality.
|
||||
//You will travel to many places.
|
||||
//Accept yourself
|
||||
//Be a generous friend and a fair enemy
|
||||
//Never quit!
|
||||
//Old friends, old wines and old gold are best
|
||||
//If your desires are not extravagant, they will be granted
|
||||
//Every Friend Joys in your Success
|
||||
//You should be able to undertake and complete anything
|
||||
//You will enjoy good health, you will be surrounded by luxury
|
||||
//You are a person of strong sense of duty
|
||||
//Dream lofty dreams, and as you dream, so shall you become.
|
||||
//You have a quiet and unobtrusive nature.
|
||||
//Great thoughts come from the heart.
|
||||
//You love peace
|
||||
//Judge not according to the appearance.
|
||||
//One who admires you greatly is hidden before your eyes.
|
||||
//Traveling more often is important for your health and happiness.
|
||||
//You will be sharing great news with all people you love
|
||||
//You have a reputation for being straightforward and honest.
|
||||
//You are always welcome in any gathering.
|
||||
//You will be traveling and coming into a fortune.
|
||||
//Open up your heart - it can always be closed again.
|
||||
//Being happy is not always being perfect.
|
||||
//Next time you have the opportunity, go on a rollercoaster.
|
||||
//Try everything once, even the things you don't think you will like.
|
||||
//Life is too short to hold grudges.
|
||||
//Dream your dream and your dream will dream of you.
|
||||
//Being alone and being lonely are two different things.
|
||||
//Don't worry about things in the past, there is nothing you can do about them
|
||||
now. Don't worry about things that are happening now, make the best of a bad
|
||||
situation. Don't worry about things in the future, they may never happen.
|
||||
//Tomorrow, take a moment to do something just for yourself.
|
||||
//Someone close to you is waiting for you to call.
|
||||
//A virtual fortune cookie will not satisfy your hunger like that of a home made
|
||||
one.
|
||||
//Smile. Tomorrow is another day.
|
||||
//You can never been certain of success, but you can be certain of failure if
|
||||
you never try.
|
||||
//It takes ten times as many muscles to frown as it does to smile.
|
||||
//Shoot for the moon! If you miss you will still be amongst the stars.
|
||||
//Keep your eyes open. You never know what you might see.
|
||||
//Tell them what you really think. Otherwise, nothing will change.
|
||||
//Let your heart make your decisions - it does not get as confused as your head.
|
||||
//Working hard will make you live a happy life.
|
||||
//A pleasant surprise is waiting for you.
|
||||
QUOTES
|
||||
);
|
||||
|
||||
$i = round(fmod(hexdec(hash('crc32', $seed)), count($quotes)), 0);
|
||||
return trim(str_replace(array("\r\n", "\n", "\r"), ' ', $quotes[$i]));
|
||||
}
|
||||
}
|
@@ -11,7 +11,6 @@ class OpenClassroomsBridge extends BridgeAbstract {
|
||||
'u' => array(
|
||||
'name' => 'Catégorie',
|
||||
'type' => 'list',
|
||||
'required' => true,
|
||||
'values' => array(
|
||||
'Arts & Culture' => 'arts',
|
||||
'Code' => 'code',
|
||||
|
64
bridges/OsmAndBlogBridge.php
Normal file
64
bridges/OsmAndBlogBridge.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
class OsmAndBlogBridge extends BridgeAbstract {
|
||||
const NAME = 'OsmAnd Blog';
|
||||
const URI = 'https://osmand.net/';
|
||||
const DESCRIPTION = 'Get the latest news from OsmAnd.net';
|
||||
const MAINTAINER = 'fulmeek';
|
||||
|
||||
public function collectData() {
|
||||
$html = getSimpleHTMLDOM(self::URI . 'blog')
|
||||
or returnServerError('Could not load content');
|
||||
|
||||
foreach($html->find('div.article') as $element) {
|
||||
$item = array();
|
||||
|
||||
$objTitle = $element->find('h1', 0);
|
||||
if (!$objTitle)
|
||||
$objTitle = $element->find('h2', 0);
|
||||
if (!$objTitle)
|
||||
$objTitle = $element->find('h3', 0);
|
||||
if ($objTitle)
|
||||
$item['title'] = $objTitle->plaintext;
|
||||
|
||||
$objDate = $element->find('meta[pubdate]', 0);
|
||||
if ($objDate) {
|
||||
$item['timestamp'] = strtotime($objDate->pubdate);
|
||||
} else {
|
||||
$objDate = $element->find('.date', 0);
|
||||
if ($objDate)
|
||||
$item['timestamp'] = strtotime($objDate->plaintext);
|
||||
}
|
||||
|
||||
$this->cleanupContent($element, $objTitle, $objDate, $element->find('.date', 0));
|
||||
$item['content'] = $element->innertext;
|
||||
|
||||
$objLink = $html->find('.articlelinklist a', 0);
|
||||
if ($objLink) {
|
||||
$item['uri'] = $this->filterURL($objLink->href);
|
||||
} else {
|
||||
$item['uri'] = 'urn:sha1:' . hash('sha1', $item['content']);
|
||||
}
|
||||
|
||||
$this->items[] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
private function filterURL($url) {
|
||||
if (strpos($url, '://') === false)
|
||||
return self::URI . ltrim($url, '/');
|
||||
return $url;
|
||||
}
|
||||
|
||||
private function cleanupContent($content, ...$removeItems) {
|
||||
foreach ($removeItems as $obj) {
|
||||
if ($obj) $obj->outertext = '';
|
||||
}
|
||||
foreach ($content->find('img') as $obj) {
|
||||
$obj->src = $this->filterURL($obj->src);
|
||||
}
|
||||
foreach ($content->find('a') as $obj) {
|
||||
$obj->href = $this->filterURL($obj->href);
|
||||
$obj->target = '_blank';
|
||||
}
|
||||
}
|
||||
}
|
@@ -6,6 +6,16 @@ class PikabuBridge extends BridgeAbstract {
|
||||
const DESCRIPTION = 'Выводит посты по тегу';
|
||||
const MAINTAINER = 'em92';
|
||||
|
||||
const PARAMETERS_FILTER = array(
|
||||
'name' => 'Фильтр',
|
||||
'type' => 'list',
|
||||
'values' => array(
|
||||
'Горячее' => 'hot',
|
||||
'Свежее' => 'new',
|
||||
),
|
||||
'defaultValue' => 'hot'
|
||||
);
|
||||
|
||||
const PARAMETERS = array(
|
||||
'По тегу' => array(
|
||||
'tag' => array(
|
||||
@@ -13,21 +23,29 @@ class PikabuBridge extends BridgeAbstract {
|
||||
'exampleValue' => 'it',
|
||||
'required' => true
|
||||
),
|
||||
'filter' => array(
|
||||
'name' => 'Фильтр',
|
||||
'type' => 'list',
|
||||
'values' => array(
|
||||
'Горячее' => 'hot',
|
||||
'Свежее' => 'new',
|
||||
),
|
||||
'defaultValue' => 'hot'
|
||||
)
|
||||
'filter' => self::PARAMETERS_FILTER
|
||||
),
|
||||
'По сообществу' => array(
|
||||
'community' => array(
|
||||
'name' => 'Сообщество',
|
||||
'exampleValue' => 'linux',
|
||||
'required' => true
|
||||
),
|
||||
'filter' => self::PARAMETERS_FILTER
|
||||
)
|
||||
);
|
||||
|
||||
protected $title = null;
|
||||
|
||||
public function getURI() {
|
||||
if ($this->getInput('tag')) {
|
||||
return self::URI . '/tag/' . rawurlencode($this->getInput('tag')) . '/' . rawurlencode($this->getInput('filter'));
|
||||
} else if ($this->getInput('community')) {
|
||||
$uri = self::URI . '/community/' . rawurlencode($this->getInput('community'));
|
||||
if ($this->getInput('filter') != 'hot') {
|
||||
$uri .= '/' . rawurlencode($this->getInput('filter'));
|
||||
}
|
||||
return $uri;
|
||||
} else {
|
||||
return parent::getURI();
|
||||
}
|
||||
@@ -38,10 +56,10 @@ class PikabuBridge extends BridgeAbstract {
|
||||
}
|
||||
|
||||
public function getName() {
|
||||
if (is_string($this->getInput('tag'))) {
|
||||
return $this->getInput('tag') . ' - ' . parent::getName();
|
||||
} else {
|
||||
if (is_null($this->title)) {
|
||||
return parent::getName();
|
||||
} else {
|
||||
return $this->title . ' - ' . parent::getName();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,6 +70,8 @@ class PikabuBridge extends BridgeAbstract {
|
||||
$text_html = iconv('windows-1251', 'utf-8', $text_html);
|
||||
$html = str_get_html($text_html);
|
||||
|
||||
$this->title = $html->find('title', 0)->innertext;
|
||||
|
||||
foreach($html->find('article.story') as $post) {
|
||||
$time = $post->find('time.story__datetime', 0);
|
||||
if (is_null($time)) continue;
|
||||
@@ -67,6 +87,11 @@ class PikabuBridge extends BridgeAbstract {
|
||||
}
|
||||
}
|
||||
|
||||
foreach($post->find('[data-type=gifx]') as $el) {
|
||||
$src = $el->getAttribute('data-source');
|
||||
$el->outertext = '<img src="' . $src . '">';
|
||||
}
|
||||
|
||||
foreach($post->find('img') as $img) {
|
||||
$src = $img->getAttribute('src');
|
||||
if (!$src) {
|
||||
|
@@ -15,7 +15,6 @@ class PixivBridge extends BridgeAbstract {
|
||||
),
|
||||
));
|
||||
|
||||
|
||||
public function collectData(){
|
||||
|
||||
$html = getContents(static::URI . 'search.php?word=' . urlencode($this->getInput('tag')))
|
||||
@@ -53,7 +52,7 @@ class PixivBridge extends BridgeAbstract {
|
||||
|
||||
$url = str_replace('_master1200', '', $url);
|
||||
$url = str_replace('c/240x240/img-master/', 'img-original/', $url);
|
||||
$path = PATH_CACHE . '/pixiv_img';
|
||||
$path = PATH_CACHE . 'pixiv_img/';
|
||||
|
||||
if(!is_dir($path))
|
||||
mkdir($path, 0755, true);
|
||||
@@ -70,5 +69,4 @@ class PixivBridge extends BridgeAbstract {
|
||||
return 'cache/pixiv_img/' . $illustId . '.jpeg';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
132
bridges/QPlayBridge.php
Normal file
132
bridges/QPlayBridge.php
Normal file
@@ -0,0 +1,132 @@
|
||||
<?php
|
||||
class QPlayBridge extends BridgeAbstract {
|
||||
const NAME = 'Q Play';
|
||||
const URI = 'https://www.qplay.pt';
|
||||
const DESCRIPTION = 'Entretenimento e humor em Português';
|
||||
const MAINTAINER = 'somini';
|
||||
const PARAMETERS = array(
|
||||
'Program' => array(
|
||||
'program' => array(
|
||||
'name' => 'Program Name',
|
||||
'type' => 'text',
|
||||
'required' => true,
|
||||
),
|
||||
),
|
||||
'Catalog' => array(
|
||||
'all_pages' => array(
|
||||
'name' => 'All Pages',
|
||||
'type' => 'checkbox',
|
||||
'defaultValue' => false,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
public function getIcon() {
|
||||
# This should be the favicon served on `self::URI`
|
||||
return 'https://s3.amazonaws.com/unode1/assets/4957/r3T9Lm9LTLmpAEX6FlSA_apple-touch-icon.png';
|
||||
}
|
||||
|
||||
public function getURI() {
|
||||
switch ($this->queriedContext) {
|
||||
case 'Program':
|
||||
return self::URI . '/programs/' . $this->getInput('program');
|
||||
case 'Catalog':
|
||||
return self::URI . '/catalog';
|
||||
}
|
||||
return parent::getURI();
|
||||
}
|
||||
|
||||
public function getName() {
|
||||
switch ($this->queriedContext) {
|
||||
case 'Program':
|
||||
$html = getSimpleHTMLDOMCached($this->getURI())
|
||||
or returnServerError('Could not load content');
|
||||
|
||||
return $html->find('h1.program--title', 0)->innertext;
|
||||
case 'Catalog':
|
||||
return self::NAME . ' | Programas';
|
||||
}
|
||||
|
||||
return parent::getName();
|
||||
}
|
||||
|
||||
/* This uses the uscreen platform, other sites can adapt this. https://www.uscreen.tv/ */
|
||||
public function collectData() {
|
||||
switch ($this->queriedContext) {
|
||||
case 'Program':
|
||||
$program = $this->getInput('program');
|
||||
$html = getSimpleHTMLDOMCached($this->getURI())
|
||||
or returnServerError('Could not load content');
|
||||
|
||||
foreach($html->find('.cce--thumbnails-video-chapter') as $element) {
|
||||
$cid = $element->getAttribute('data-id');
|
||||
$item['title'] = $element->find('.cce--chapter-title', 0)->innertext;
|
||||
$item['content'] = $element->find('.cce--thumbnails-image-block', 0)
|
||||
. $element->find('.cce--chapter-body', 0)->innertext;
|
||||
$item['uri'] = $this->getURI() . '?cid=' . $cid;
|
||||
|
||||
/* TODO: Suport login credentials? */
|
||||
/* # Get direct video URL */
|
||||
/* $json_source = getContents(self::URI . '/chapters/' . $cid, array('Cookie: _uscreen2_session=???;')) */
|
||||
/* or returnServerError('Could not request chapter JSON'); */
|
||||
/* $json = json_decode($json_source); */
|
||||
|
||||
/* $item['enclosures'] = [$json->fallback]; */
|
||||
|
||||
$this->items[] = $item;
|
||||
}
|
||||
|
||||
break;
|
||||
case 'Catalog':
|
||||
$json_raw = getContents($this->getCatalogURI(1))
|
||||
or returnServerError('Could not load catalog content');
|
||||
|
||||
$json = json_decode($json_raw);
|
||||
$total_pages = $json->total_pages;
|
||||
|
||||
foreach($this->parseCatalogPage($json) as $item) {
|
||||
$this->items[] = $item;
|
||||
}
|
||||
|
||||
if ($this->getInput('all_pages') === true) {
|
||||
foreach(range(2, $total_pages) as $page) {
|
||||
$json_raw = getContents($this->getCatalogURI($page))
|
||||
or returnServerError('Could not load catalog content (all pages)');
|
||||
|
||||
$json = json_decode($json_raw);
|
||||
|
||||
foreach($this->parseCatalogPage($json) as $item) {
|
||||
$this->items[] = $item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private function getCatalogURI($page) {
|
||||
return self::URI . '/catalog.json?page=' . $page;
|
||||
}
|
||||
|
||||
private function parseCatalogPage($json) {
|
||||
$items = array();
|
||||
|
||||
foreach($json->records as $record) {
|
||||
$item = array();
|
||||
|
||||
$item['title'] = $record->title;
|
||||
$item['content'] = $record->description
|
||||
. '<div>Duration: ' . $record->duration . '</div>';
|
||||
$item['timestamp'] = strtotime($record->release_date);
|
||||
$item['uri'] = self::URI . $record->url;
|
||||
$item['enclosures'] = array(
|
||||
$record->main_poster,
|
||||
);
|
||||
|
||||
$items[] = $item;
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
}
|
@@ -1,34 +1,87 @@
|
||||
<?php
|
||||
class RadioMelodieBridge extends BridgeAbstract {
|
||||
const NAME = 'Radio Melodie Actu';
|
||||
const URI = 'https://www.radiomelodie.com/';
|
||||
const URI = 'https://www.radiomelodie.com';
|
||||
const DESCRIPTION = 'Retourne les actualités publiées par Radio Melodie';
|
||||
const MAINTAINER = 'sysadminstory';
|
||||
|
||||
public function getIcon() {
|
||||
return self::URI . 'img/favicon.png';
|
||||
return self::URI . '/img/favicon.png';
|
||||
}
|
||||
|
||||
public function collectData(){
|
||||
$html = getSimpleHTMLDOM(self::URI . 'actu')
|
||||
$html = getSimpleHTMLDOM(self::URI . '/actu/')
|
||||
or returnServerError('Could not request Radio Melodie.');
|
||||
$list = $html->find('div[class=actuitem]');
|
||||
$list = $html->find('div[class=displayList]', 0)->children();
|
||||
foreach($list as $element) {
|
||||
$item = array();
|
||||
if($element->tag == 'a') {
|
||||
$articleURL = self::URI . $element->href;
|
||||
$article = getSimpleHTMLDOM($articleURL);
|
||||
$textDOM = $article->find('article', 0);
|
||||
|
||||
// Get picture URL
|
||||
$pictureHTML = $element->find('div[class=picture]');
|
||||
preg_match(
|
||||
'/background-image:url\((.*)\);/',
|
||||
$pictureHTML[0]->getAttribute('style'),
|
||||
$pictures);
|
||||
$pictureURL = $pictures[1];
|
||||
// Initialise arrays
|
||||
$item = array();
|
||||
$audio = array();
|
||||
$picture = array();
|
||||
|
||||
$item['enclosures'] = array($pictureURL);
|
||||
$item['uri'] = self::URI . $element->parent()->href;
|
||||
$item['title'] = $element->find('h3', 0)->plaintext;
|
||||
$item['content'] = $element->find('p', 0)->plaintext . '<br/><img src="' . $pictureURL . '"/>';
|
||||
$this->items[] = $item;
|
||||
// Get the Main picture URL
|
||||
$picture[] = $this->rewriteImage($article->find('div[id=pictureTitleSupport]', 0)->find('img', 0)->src);
|
||||
$audioHTML = $article->find('audio');
|
||||
|
||||
// Add the audio element to the enclosure
|
||||
foreach($audioHTML as $audioElement) {
|
||||
$audioURL = $audioElement->src;
|
||||
$audio[] = $audioURL;
|
||||
}
|
||||
|
||||
// Rewrite pictures URL
|
||||
$imgs = $textDOM->find('img[src^="http://www.radiomelodie.com/image.php]');
|
||||
foreach($imgs as $img) {
|
||||
$img->src = $this->rewriteImage($img->src);
|
||||
$article->save();
|
||||
}
|
||||
|
||||
// Remove Google Ads
|
||||
$ads = $article->find('div[class=adInline]');
|
||||
foreach($ads as $ad) {
|
||||
$ad->outertext = '';
|
||||
$article->save();
|
||||
}
|
||||
|
||||
// Remove Radio Melodie Logo
|
||||
$logoHTML = $article->find('div[id=logoArticleRM]', 0);
|
||||
$logoHTML->outertext = '';
|
||||
$article->save();
|
||||
|
||||
$author = $article->find('p[class=AuthorName]', 0)->plaintext;
|
||||
|
||||
$item['enclosures'] = array_merge($picture, $audio);
|
||||
$item['author'] = $author;
|
||||
$item['uri'] = $articleURL;
|
||||
$item['title'] = $article->find('meta[property=og:title]', 0)->content;
|
||||
$date = $article->find('p[class*=date]', 0)->plaintext;
|
||||
|
||||
// Header Image
|
||||
$header = '<img src="' . $picture[0] . '"/>';
|
||||
|
||||
// Remove the Date and Author part
|
||||
$textDOM->find('div[class=AuthorDate]', 0)->outertext = '';
|
||||
$article->save();
|
||||
$text = $textDOM->innertext;
|
||||
$item['content'] = '<h1>' . $item['title'] . '</h1>' . $date . '<br/>' . $header . $text;
|
||||
$this->items[] = $item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Function to rewrite image URL to use the real Image URL and not the resized one (which is very slow)
|
||||
*/
|
||||
private function rewriteImage($url)
|
||||
{
|
||||
$parts = explode('?', $url);
|
||||
parse_str(html_entity_decode($parts[1]), $params);
|
||||
return self::URI . '/' . $params['image'];
|
||||
|
||||
}
|
||||
}
|
||||
|
68
bridges/RoadAndTrackBridge.php
Normal file
68
bridges/RoadAndTrackBridge.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
class RoadAndTrackBridge extends BridgeAbstract {
|
||||
const MAINTAINER = 'teromene';
|
||||
const NAME = 'Road And Track Bridge';
|
||||
const URI = 'https://www.roadandtrack.com/';
|
||||
const CACHE_TIMEOUT = 86400; // 24h
|
||||
const DESCRIPTION = 'Returns the latest news from Road & Track.';
|
||||
|
||||
public function collectData() {
|
||||
|
||||
$page = getSimpleHTMLDOM(self::URI);
|
||||
|
||||
//Process the first element
|
||||
$firstArticleLink = $page->find('.custom-promo-title', 0)->href;
|
||||
$this->items[] = $this->fetchArticle($firstArticleLink);
|
||||
|
||||
$limit = 19;
|
||||
foreach($page->find('.full-item-title') as $article) {
|
||||
$this->items[] = $this->fetchArticle($article->href);
|
||||
$limit -= 1;
|
||||
if($limit == 0) break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function fixImages($content) {
|
||||
|
||||
$enclosures = [];
|
||||
foreach($content->find('img') as $image) {
|
||||
$image->src = explode('?', $image->getAttribute('data-src'))[0];
|
||||
$enclosures[] = $image->src;
|
||||
}
|
||||
|
||||
foreach($content->find('.embed-image-wrap, .content-lede-image-wrap') as $imgContainer) {
|
||||
$imgContainer->style = '';
|
||||
}
|
||||
|
||||
return $enclosures;
|
||||
|
||||
}
|
||||
|
||||
private function fetchArticle($articleLink) {
|
||||
|
||||
$articleLink = self::URI . $articleLink;
|
||||
$article = getSimpleHTMLDOM($articleLink);
|
||||
$item = array();
|
||||
|
||||
$item['title'] = $article->find('.content-hed', 0)->innertext;
|
||||
$item['author'] = $article->find('.byline-name', 0)->innertext;
|
||||
$item['timestamp'] = strtotime($article->find('.content-info-date', 0)->getAttribute('datetime'));
|
||||
|
||||
$content = $article->find('.content-container', 0);
|
||||
if($content->find('.content-rail', 0) !== null)
|
||||
$content->find('.content-rail', 0)->innertext = '';
|
||||
$enclosures = $this->fixImages($content);
|
||||
|
||||
$item['enclosures'] = $enclosures;
|
||||
$item['content'] = $content;
|
||||
return $item;
|
||||
|
||||
}
|
||||
|
||||
private function getArticleContent($article) {
|
||||
|
||||
return getContents($article->contentUrl);
|
||||
|
||||
}
|
||||
}
|
@@ -6,11 +6,10 @@ class Rue89Bridge extends BridgeAbstract {
|
||||
const URI = 'https://www.nouvelobs.com/rue89/';
|
||||
const DESCRIPTION = 'Returns the newest posts from Rue89';
|
||||
|
||||
|
||||
public function collectData() {
|
||||
|
||||
$jsonArticles = getContents('https://appdata.nouvelobs.com/rue89/feed.json')
|
||||
or die('Unable to query Rue89 !');
|
||||
or returnServerError('Unable to query Rue89 !');
|
||||
$articles = json_decode($jsonArticles)->items;
|
||||
foreach($articles as $article) {
|
||||
$this->items[] = $this->getArticle($article);
|
||||
@@ -20,7 +19,8 @@ class Rue89Bridge extends BridgeAbstract {
|
||||
|
||||
private function getArticle($articleInfo) {
|
||||
|
||||
$articleJson = getContents($articleInfo->json_url) or die('Unable to get article !');
|
||||
$articleJson = getContents($articleInfo->json_url)
|
||||
or returnServerError('Unable to get article !');
|
||||
$article = json_decode($articleJson);
|
||||
$item = array();
|
||||
$item['title'] = $article->title;
|
||||
@@ -46,5 +46,4 @@ class Rue89Bridge extends BridgeAbstract {
|
||||
return $item;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
63
bridges/SIMARBridge.php
Normal file
63
bridges/SIMARBridge.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
class SIMARBridge extends BridgeAbstract {
|
||||
const NAME = 'SIMAR';
|
||||
const URI = 'http://www.simar-louresodivelas.pt/';
|
||||
const DESCRIPTION = 'Verificar estado da rede SIMAR';
|
||||
const MAINTAINER = 'somini';
|
||||
const PARAMETERS = array(
|
||||
'Público' => array(
|
||||
'interventions' => array(
|
||||
'type' => 'checkbox',
|
||||
'name' => 'Incluir Intervenções?',
|
||||
'defaultValue' => 'checked',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
public function collectData() {
|
||||
$html = getSimpleHTMLDOM(self::getURI())
|
||||
or returnServerError('Could not load content');
|
||||
$e_home = $html->find('#home', 0)
|
||||
or returnServerError('Invalid site structure');
|
||||
|
||||
foreach($e_home->find('span') as $element) {
|
||||
$item = array();
|
||||
|
||||
$item['title'] = 'Rotura: ' . $element->plaintext;
|
||||
$item['content'] = $element->innertext;
|
||||
$item['uid'] = 'urn:sha1:' . hash('sha1', $item['content']);
|
||||
|
||||
$this->items[] = $item;
|
||||
}
|
||||
|
||||
if ($this->getInput('interventions')) {
|
||||
$e_main1 = $html->find('#menu1', 0)
|
||||
or returnServerError('Invalid site structure');
|
||||
|
||||
foreach ($e_main1->find('a') as $element) {
|
||||
$item = array();
|
||||
|
||||
$item['title'] = 'Intervenção: ' . $element->plaintext;
|
||||
$item['uri'] = self::getURI() . $element->href;
|
||||
$item['content'] = $element->innertext;
|
||||
|
||||
/* Try to get the actual contents for this kind of item */
|
||||
$item_html = getSimpleHTMLDOMCached($item['uri']);
|
||||
if ($item_html) {
|
||||
$e_item = $item_html->find('.auto-style59', 0);
|
||||
foreach($e_item->find('p') as $paragraph) {
|
||||
/* Remove empty paragraphs */
|
||||
if (preg_match('/^(\W| )+$/', $paragraph->innertext) == 1) {
|
||||
$paragraph->outertext = '';
|
||||
}
|
||||
}
|
||||
if ($e_item) {
|
||||
$item['content'] = $e_item->innertext;
|
||||
}
|
||||
}
|
||||
|
||||
$this->items[] = $item;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -35,5 +35,4 @@ class Shimmie2Bridge extends DanbooruBridge {
|
||||
|
||||
return $item;
|
||||
}
|
||||
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user