<commit_before><commit_msg>Add: Youtube Bridge<commit_after><?php
/**
* RssBridgeYoutube 
* Returns the newest videos
*
* @name Youtube Bridge
* @description Returns the newest videos
* @use1(u="username")
*/
class YoutubeBridge extends BridgeAbstract{

    public function collectData(array $param){
        $html = file_get_html('https://www.youtube.com/user/'.urlencode($param['u']).'/videos') or $this->returnError('Could not request Youtube.', 404);
    
        foreach($html->find('li.channels-content-item') as $element) {
            $item = new \Item();
            $item->uri = 'https://www.youtube.com'.$element->find('a',0)->href;
            $item->thumbnailUri = 'https:'.$element->find('img',0)->src;
            $item->title = trim($element->find('h3',0)->plaintext);
            $item->content = '<a href="' . $item->uri . '"><img src="' . $item->thumbnailUri . '" /></a><br><a href="' . $item->uri . '">' . $item->title . '</a>';
            $this->items[] = $item;
        }
    }

    public function getName(){
        return 'Youtube Bridge';
    }

    public function getURI(){
        return 'https://www.youtube.com/';
    }

    public function getCacheDuration(){
        return 21600; // 6 hours
    }
}

{'fraction_non_alphanumeric': 0.19773095623987033, 'fraction_numerical': 0.011345218800648298, 'mean_word_length': 2.742424242424242, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 26, 'https://': 3, 'lorem ipsum': 0, 'www.': 3, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5077025', 'n_tokens_mistral': 401, 'n_tokens_neox': 373, 'n_words': 77}