Commit graph

65 commits

Author SHA1 Message Date
Eugene Molotov f76a23f0a5 [YoutubeBridge] Add playlist caching (#1162) 2019-06-10 15:31:35 +02:00
sysadminstory b764204c3a [YoutubeBridge] Playlist bug fix (#1117)
This commit allow the bridge to parse an infinite number of items of a
Youtube playlist.

It should fix #647 !
2019-05-08 22:17:48 +02:00
Eugene Molotov 87d218296e [YoutubeBridge] Fix playlist mode (#876)
* Corrected duration text selector
* Request YouTube page with English localization
* Filter video items in the beginning of the loop
2018-10-20 12:43:48 +02:00
logmanoriginal 6bd76af326 [YoutubeBridge] Add duration limits for all modes
Adds duration limits (minimum duration, maximum duration) for all
modes (user/id/playlist/search). Duration limits are optional, so
existing subscriptions don't break.

The limits are specified by two separate parameters, each of which
is optional:

- `&duration_min=` (minimum duration in minutes, default: -1)
- `&duration_max=` (maximum duration in minutes, default: INF)

If duration limits are specified in either user, id or playlist mode,
the bridge defaults to fetching data from HTML intead of XML feeds,
which requires more bandwidth and takes longer, because each video is
loaded individually!

References #670
2018-07-21 14:33:07 +02:00
LogMANOriginal 193ca87afa [phpcs] enforce single quotes (#732)
* [phpcs] Add rule to enforce single quoted strings
2018-06-29 22:55:33 +01:00
logmanoriginal 01a2746715 [YoutubeBridge] Fix sniff violation
This is a fix for a sniff violation not detected by newer versions
of phpcs (not sure why though, it's detected in version 2.7.1).
2018-06-23 21:28:30 +02:00
Eugene Molotov 644d13686c [YoutubeBridge] Removed duration in titles on search mode 2018-04-19 09:03:29 +05:00
logmanoriginal 4b3efed7ec [YoutubeBridge] Fix too many parameters when using HTML mode 2018-04-06 20:42:19 +02:00
logmanoriginal 6caca4946b bridges: Fix bridges with custom headers and options
This commit fixes bridges which called getContents, getSimpleHTMLDOM
or getSimpleHTMLDOMCached with custom settings.
2018-04-06 20:42:19 +02:00
Eugene Molotov 41b7984a4e [YoutubeBridge] Playlist mode: faster feed generating if item count is less or equal to 15 (#648)
* [YoutubeBridge] Playlist mode: faster feed generating if item count is less or equal to 15
2018-03-19 12:41:52 +00:00
Eugene Molotov cacbe90102 [YoutubeBridge] Sort playlist items by publication date (#643) 2018-03-13 11:24:40 +00:00
logmanoriginal 4805b52d42 [YoutubeBridge] Fix typo 2018-02-16 22:35:00 +01:00
logmanoriginal 962617086e [YoutubeBridge] Remove superfluous div selectors 2018-02-16 22:31:47 +01:00
logmanoriginal 4f6277b6b5 [YoutubeBridge] Fix parsing author name breaks the bridge
The author name is parsed by searching a string within the entire
HTML document:

$author = $html->innertext;
$author = substr($author, strpos($author, '"author=') + 8);
$author = substr($author, 0, strpos($author, '\u0026'));

This solution will return big portions of the HTML document if
the strpos function returns zero (not found).

This commit replaces the previous implementation by searching for
a specific script tag and making use of the JSON data inside it.

References #580
2018-02-16 22:31:29 +01:00
logmanoriginal 5aaab9eb8c [YoutubeBridge] Skip unavailable videos 2018-02-16 22:11:03 +01:00
Matt DeMoss c14b2c6905 address phpcs style errors 2017-12-28 20:20:24 -05:00
Matt DeMoss 0871376922 store feed name in new variable, switch getName on queriedContext, remove 'bridge' from name for feeds, fixes #609 2017-12-28 20:20:24 -05:00
Matt DeMoss c5fe9a6dc0 mark places where a new variable is needed 2017-12-28 20:20:24 -05:00
logmanoriginal 3059b1ea80 [YoutubeBridge] Skip Ads
The search might return unrelated videos (Ads) that are inserted
between regular search results. This adds a check to skip Ads.

Closes #571
2017-09-24 17:25:47 +02:00
logmanoriginal 9a9ce30b16 [YoutubeBridge] Fix issues loading playlists
Videos that are part of a playlist have the playlist ID encoded in
the URI. When loading the video info the page contents change unex-
pectedly due to the playlist being part of the page.

This removes any trailing parameters from the video ID in order to
ensure only pure videos are loaded at all times.
2017-08-19 18:51:30 +02:00
logmanoriginal 0e2b80d5d7 [YoutubeBridge] Fix error on certain keywords
References #569
2017-08-17 19:26:04 +02:00
logmanoriginal a4b9611e66 [phpcs] Add missing rules
- Do not add spaces after opening or before closing parenthesis

  // Wrong
  if( !is_null($var) ) {
    ...
  }

  // Right
  if(!is_null($var)) {
    ...
  }

- Add space after closing parenthesis

  // Wrong
  if(true){
    ...
  }

  // Right
  if(true) {
    ...
  }

- Add body into new line
- Close body in new line

  // Wrong
  if(true) { ... }

  // Right
  if(true) {
    ...
  }

Notice: Spaces after keywords are not detected:

  // Wrong (not detected)
  // -> space after 'if' and missing space after 'else'
  if (true) {
    ...
  } else{
    ...
  }

  // Right
  if(true) {
    ...
  } else {
    ...
  }
2017-07-29 19:55:12 +02:00
logmanoriginal 627038e2fa [YoutubeBridge] Improve URL handling in video descriptions
This improves the translation of regular text to anchors by adding
support for additional characters '?&=-_' to fix common URLs.

Notice: The regex pattern is by no means complete. That means it is
likely to break in the future. More sophistiated solutions however
are insanely complex. See: http://stackoverflow.com/a/190405

References #520
2017-05-02 22:03:44 +02:00
logmanoriginal 120e74c1b4 [YoutubeBridge] Improve readability of feed contents
Previously feed contents were rendered as one block of text with
no structure. This brings back the structure of original video
descriptions and makes links in the description work again.

References #520
2017-04-27 21:44:26 +02:00
logmanoriginal 6f24858124 bridges: Fix coding styles
This commit is a squash of all commits that fix coding styles
for the new coding style policy.

[ABCTabsBridge] Fix coding style
[AcrimedBridge] Fix coding style
[AllocineFRBridge] Fix coding style
[AnimeUltimeBridge] Fix coding style
[Arte7Bridge] Fix coding style
[AskfmBridge] Fix coding style
[BandcampBridge] Fix coding style
[BastaBridge] Fix coding style
[BlaguesDeMerdeBridge] Fix coding style
[BooruprojectBridge] Fix coding style
[CADBridge] Fix coding style
[CNETBridge] Fix coding style
[CastorusBridge] Fix coding style
[CollegeDeFranceBridge] Fix coding style
[CommonDreamsBridge] Fix coding style
[CopieDoubleBridge] Fix coding style
[CourrierInternationalBridge] Fix coding style
[CpasbienBridge] Fix coding style
[CryptomeBridge] Fix coding style
[DailymotionBridge] Fix coding style
[DanbooruBridge] Fix coding style
[DansTonChatBridge] Fix coding style
[DauphineLibereBridge] Fix coding style
[DeveloppezDotComBridge] Fix coding style
[DemoBridge] Fix coding style
[DilbertBridge] Fix coding style
[DuckDuckGoBridge] Fix coding style
[DollbooruBridge] Fix coding style
[EliteDangerousGalnetBridge] Fix coding style
[ElsevierBridge] Fix coding style
[EstCeQuonMetEnProdBridge] Fix coding style
[EZTVBridge] Fix coding style
[FacebookBridge] Fix coding style
[FeedExpanderExampleBridge] Fix coding style
[FB2Bridge] Fix coding style
[FierPandaBridge] Fix coding style
[FlickrBridge] Fix coding style
[FootitoBridge] Fix coding style
[FourchanBridge] Fix coding style
[FuturaSciencesBridge] Fix coding style
[GBAtempBridge] Fix coding style
[GelbooruBridge] Fix coding style
[GiphyBridge] Fix coding style
[GithubIssueBridge] Fix coding style
[GizmodoBridge] Fix coding style
[GoComicsBridge] Fix coding style
[GooglePlusPostBridge] Fix coding style
[GoogleSearchBridge] Fix coding style
[HDWallpapersBridge] Fix coding style
[HentaiHavenBridge] Fix coding style
[IdenticaBridge] Fix coding style
[InstagramBridge] Fix coding style
[IsoHuntBridge] Fix coding style
[JapanExpoBridge] Fix coding style
[KonachanBridge] Fix coding style
[KoreusBridge] Fix coding style
[KununuBridge] Fix coding style
[LeBonCoinBridge] Fix coding style
[LegifranceJOBBridge] Fix coding style
[LeMondeInformatiqueBridge] Fix coding style
[LesJoiesDuCodeBridge] Fix coding style
[LichessBridge] Fix coding style
[LinkedInCompanyBridge] Fix coding style
[LolibooruBridge] Fix coding style
[LWNprevBridge] Fix coding style
[MangareaderBridge] Fix coding style
[MilbooruBridge] Fix coding style
[MixCloudBridge] Fix coding style
[MoebooruBridge] Fix coding style
[MondeDiploBridge] Fix coding style
[MsnMondeBridge] Fix coding style
[MspabooruBridge] Fix coding style
[NasaApodBridge] Fix coding style
[NeuviemeArtBridge] Fix coding style
[NextgovBridge] Fix coding style
[NextInpactBridge] Fix coding style
[NiceMatinBridge] Fix coding style
[NovelUpdatesBridge] Fix coding style
[OpenClassroomsBridge] Fix coding style
[ParuVenduImmoBridge] Fix coding style
[PickyWallpapersBridge] Fix coding style
[PinterestBridge] Fix coding style
[PlanetLibreBridge] Fix coding style
[ReadComicsBridge] Fix coding style
[Releases3DSBridge] Fix coding style
[ReporterreBridge] Fix coding style
[RTBFBridge] Fix coding style
[Rue89Bridge] Fix coding style
[Rule34Bridge] Fix coding style
[Rule34pahealBridge] Fix coding style
[SafebooruBridge] Fix coding style
[SakugabooruBridge] Fix coding style
[ScmbBridge] Fix coding style
[ScoopItBridge] Fix coding style
[SensCritiqueBridge] Fix coding style
[SexactuBridge] Fix coding style
[ShanaprojectBridge] Fix coding style
[Shimmie2Bridge] Fix coding style
[SoundcloudBridge] Fix coding style
[StripeAPIChangeLogBridge] Fix coding style
[SuperbWallpapersBridge] Fix coding style
[T411Bridge] Fix coding style
[TagBoardBridge] Fix coding style
[TbibBridge] Fix coding style
[TheCodingLoveBridge] Fix coding style
[TheHackerNewsBridge] Fix coding style
[ThePirateBayBridge] Fix coding style
[TheTVDBBridge] Fix coding style
[Torrent9Bridge] Fix coding style
[TwitterBridge] Fix coding style
[UnsplashBridge] Fix coding style
[ViadeoCompanyBridge] Fix coding style
[VineBridge] Fix coding style
[VkBridge] Fix coding style
[WallpaperStopBridge] Fix coding style
[WebfailBridge] Fix coding style
[WeLiveSecurityBridge] Fix coding style
[WhydBridge] Fix coding style
[WikipediaBridge] Fix coding style
[WordPressBridge] Fix coding style
[WorldOfTanksBridge] Fix coding style
[XbooruBridge] Fix coding style
[YandereBridge] Fix coding style
[YoutubeBridge] Fix coding style
[ZDNetBridge] Fix coding style
2017-02-12 15:34:08 +01:00
logmanoriginal 970e216c1f Merge branch 'methods2functions' of https://framagit.org/peetah/rss-bridge 2016-10-02 16:05:58 +02:00
Pierre Mazière f1fb95b257 [core] extract BridgeAbstract methods to make them functions
- returnError, returnServerError, returnClientError ,debugMessage are
  moved to lib/error.php

- getContents, getSimpleHTMLDOM, getSimpleHTMLDOMCached are moved to
  lib/contents.php

Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
2016-09-25 23:22:33 +02:00
Pierre Mazière 235c985901 [BridgeAbstract] replace getCacheDuration method by CACHE_TIMEOUT class constant
Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
2016-09-25 17:04:28 +02:00
Pierre Mazière 9a0da733ef [bridges] use constants instead of variable members
Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
2016-09-01 23:15:51 +02:00
logmanoriginal 4f7fbae861 [bridges] Fix conditional checks on getInput
isset($this->getInput('')) does not work
2016-08-28 20:38:08 +02:00
Pierre Mazière 1b3c8a8aeb [core + bridges] add BridgeAbstract::$inputs and BridgeAbstract::getInput()
Inputs are not stored in BridgeAbstract::$parameters anymore to separate
static data from dynamic data.
The getInput method allows for more readable code.

Also fix an "undefined index 'global'" notice

Probability of breaking bridges: high !

Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
2016-08-28 13:05:03 +02:00
Pierre Mazière de1b39c8e5 [core + bridges] get rid of loadMetadata
if a bridge needs to modify some of the data that were initialized
there, ::__construct() should be used instead.

Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
2016-08-28 13:05:03 +02:00
Pierre Mazière 117031bf0f [core] store parameters values in BridgeAbstract::parameters
This way, any BridgeAbstract method can now have access to these values,
no only collectData

Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
2016-08-25 01:24:53 +02:00
logmanoriginal bf0a9d754e [bridges] Change all occurrences of the Item object to array 2016-08-22 18:55:59 +02:00
Pierre Mazière f0e502ce37 [bridges] migrate all bridges to an array based definition of parameters
see github issue 356

Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
2016-08-22 01:25:56 +02:00
Pierre Mazière bba216073c [bridges] remove useless 'update' property from all bridges
That's the source code manager job to keep this information
consistent

Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
2016-08-21 00:21:41 +02:00
Pierre Mazière 3c0d13c1bb bridges: use BridgeAbstract::getSimpleHTMLDOM
instead of BridgeAbstract::file_get_html

Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
2016-08-19 10:20:27 +02:00
logmanoriginal 74f0572d91 bridges: Replace returnError function with more specific
Replacements depend on original error code:
400: returnClientError
404: returnServerError
500: returnServerError
501: returnServerError
2016-08-17 14:45:08 +02:00
logmanoriginal fa59a25229 bridges: Update bridges with 'required' attributes 2016-08-15 01:19:16 +02:00
logmanoriginal eeb6c9681d [YoutubeBridge] Fix typo 2016-08-11 21:42:49 +02:00
logmanoriginal 63bb7ef24d bridges: Remove unnecessary functions getName() and getURI() 2016-08-09 20:08:46 +02:00
logmanoriginal 42b6c82753 bridges: Cleanup occurrences of $item->thumbnailUri
This is a subsequent change to f3eefab
2016-08-09 15:50:55 +02:00
Mitsu 66c79e4b67 Merge pull request #283 from teromene/pmaziere-YoutubeBridgeFix
Pull request from pmaziere - Fix encoding in YoutubeBridge.
2016-06-26 16:31:06 +02:00
Pierre Mazière 06f8b61f62 fix encoding issues
Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
2016-06-25 23:19:22 +02:00
Pierre Mazière 955eecc299 use BridgeAbstract::file_get_html in all bridges
instead of simple_html_dom function file_get_html

Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
2016-06-25 23:17:42 +02:00
Frans de Jonge 24a312a158 YoutubeBridge: fix playlist mode and titles 2016-05-21 11:45:09 +02:00
ORelio ca04246eb0 [YouTube] Code refactoring, add XML API support
- Factorize common code into functions
 - Add support for XML API for user an channel
 - HTML parser is kept as fallback when XML does not work
 - XML API works even if IP is blocked, partially fixes #193
2016-05-03 23:45:32 +02:00
Teromene cd5d8b8953 Another HTTPS in double removed. 2016-05-01 17:26:43 +01:00
Teromene 382ef28abe Fix the doubled HTTPS. 2016-05-01 17:24:24 +01:00
Alexis Degrugillier d0defc6283 Update youtube bridge
Before, the channel id was supposed to be a number. But Youtube changed how they store a
channel id. It's no longer a number, it's a string.
Now, user can enter a text string instead of a number.

See the example with this channel id: UC9fGq2-6FaftcegcIadLf6A
2016-02-27 08:36:14 +01:00