mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-05 02:24:35 +02:00
[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>
This commit is contained in:
parent
dea37c8e34
commit
117031bf0f
131 changed files with 548 additions and 411 deletions
|
@ -105,19 +105,20 @@ class YoutubeBridge extends BridgeAbstract {
|
|||
return html_entity_decode($title,ENT_QUOTES,'UTF-8');
|
||||
}
|
||||
|
||||
public function collectData(array $param) {
|
||||
public function collectData(){
|
||||
$param=$this->parameters[$this->queriedContext];
|
||||
|
||||
$xml = '';
|
||||
$html = '';
|
||||
$url_feed = '';
|
||||
$url_listing = '';
|
||||
|
||||
if (isset($param['u'])) { /* User and Channel modes */
|
||||
$this->request = $param['u'];
|
||||
if (isset($param['u']['value'])) { /* User and Channel modes */
|
||||
$this->request = $param['u']['value'];
|
||||
$url_feed = $this->uri.'feeds/videos.xml?user='.urlencode($this->request);
|
||||
$url_listing = $this->uri.'user/'.urlencode($this->request).'/videos';
|
||||
} else if (isset($param['c'])) {
|
||||
$this->request = $param['c'];
|
||||
} else if (isset($param['c']['value'])) {
|
||||
$this->request = $param['c']['value'];
|
||||
$url_feed = $this->uri.'feeds/videos.xml?channel_id='.urlencode($this->request);
|
||||
$url_listing = $this->uri.'channel/'.urlencode($this->request).'/videos';
|
||||
}
|
||||
|
@ -129,16 +130,16 @@ class YoutubeBridge extends BridgeAbstract {
|
|||
} else $this->returnServerError("Could not request YouTube. Tried:\n - $url_feed\n - $url_listing");
|
||||
}
|
||||
|
||||
else if (isset($param['p'])) { /* playlist mode */
|
||||
$this->request = $param['p'];
|
||||
else if (isset($param['p']['value'])) { /* playlist mode */
|
||||
$this->request = $param['p']['value'];
|
||||
$url_listing = $this->uri.'playlist?list='.urlencode($this->request);
|
||||
$html = $this->getSimpleHTMLDOM($url_listing) or $this->returnServerError("Could not request YouTube. Tried:\n - $url_listing");
|
||||
$this->ytBridgeParseHtmlListing($html, 'tr.pl-video', '.pl-video-title a');
|
||||
$this->request = 'Playlist: '.str_replace(' - YouTube', '', $html->find('title', 0)->plaintext);
|
||||
}
|
||||
|
||||
else if (isset($param['s'])) { /* search mode */
|
||||
$this->request = $param['s']; $page = 1; if (isset($param['pa'])) $page = (int)preg_replace("/[^0-9]/",'', $param['pa']);
|
||||
else if (isset($param['s']['value'])) { /* search mode */
|
||||
$this->request = $param['s']['value']; $page = 1; if (isset($param['pa']['value'])) $page = (int)preg_replace("/[^0-9]/",'', $param['pa']['value']);
|
||||
$url_listing = $this->uri.'results?search_query='.urlencode($this->request).'&page='.$page.'&filters=video&search_sort=video_date_uploaded';
|
||||
$html = $this->getSimpleHTMLDOM($url_listing) or $this->returnServerError("Could not request YouTube. Tried:\n - $url_listing");
|
||||
$this->ytBridgeParseHtmlListing($html, 'div.yt-lockup', 'h3');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue