flatgreen/rfrance 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

flatgreen/rfrance

最新稳定版本:v2.6

Composer 安装命令:

composer require flatgreen/rfrance

包简介

Scrape R A D I O F R A N C E

README 文档

README

PHP library for french radio. RFrance a class to scrape and parse r a d i o f r a n c e

Prerequisites

  • php >= 8.1

Installation

  • Use the package manager composer to install RFrance.
composer require flatgreen/rfrance
  • Optional: Create a 'cache' directory (with read|write permissions), by default the cache directory is inside the system temporary directory.

Usage

require_once 'vendor/autoload.php';
use Flatgreen\RFrance\RFrance;

Instantiate the class, extract with an URL page

$rf = new RFrance(); // optional in constructor, add cache directory and cache duration for page, 1 day by default.

try {
    $rf->extract(URL); // optional: set a (approx.) limit $max_items (default: -1, all items)
} catch (\Throwable $th) {
    // ...
}

Read the informations

if (empty($rf->error)){
    $title = $rf->page->title;
    $all_items = $rf->page->all_items; // array of Item
    ...
}

All properties for Item, in Item.php.

Three output helpers :

// to array
echo $FC->toArray();

// RSS 2.0, always return informations (even with no item)
// Be carefull, max_items is not present in the feed
header("Content-Type: text/xml; charset=UTF-8");
echo $FC->toRss();

// or

// youtube-dl|yt-dlp info.json like, maybe empty if no item
header('Content-Type: application/json; charset=utf-8');
echo $FC->toInfoJson();

Remarks

Does not take into account some pages that are not broadcasts.

Changelog

changelog

License

RFrance is licensed under the MIT License (MIT). Please see the license file for more information.

统计信息

  • 总下载量: 65
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-06-30