<commit_before><?php

class MixCloudBridge extends BridgeAbstract {

	const MAINTAINER = '<NAME>';
	const NAME = 'MixCloud';
	const URI = 'https://mixcloud.com/';
	const CACHE_TIMEOUT = 3600; // 1h
	const DESCRIPTION = 'Returns latest musics on user stream';

	const PARAMETERS = array(array(
		'u' => array(
			'name' => 'username',
			'required' => true,
		)
	));

	public function getName(){
		if(!is_null($this->getInput('u'))){
			return 'MixCloud - ' . $this->getInput('u');
		}

		return parent::getName();
	}

	public function collectData(){

		$html = getSimpleHTMLDOM(self::URI . '/' . $this->getInput('u'))
			or returnServerError('Could not request MixCloud.');

		foreach($html->find('div.card-elements-container') as $element){

			$item = array();

			$item['uri'] = self::URI . $element->find('h3.card-cloudcast-title a', 0)->getAttribute('href');
			$item['title'] = html_entity_decode(
				$element->find('h3.card-cloudcast-title a span', 0)->getAttribute('title'),
				ENT_QUOTES
			);

			$image = $element->find('img.image-for-cloudcast', 0);

			if($image){
				$item['content'] = '<img src="' . $image->getAttribute('src') . '" />';
			}

			$item['author'] = trim($element->find('h4.card-cloudcast-user a', 0)->innertext);

			$this->items[] = $item;
		}
	}
}<commit_msg>[MixCloudBridge] Fix bridge broken after DOM changed<commit_after><?php

class MixCloudBridge extends BridgeAbstract {

	const MAINTAINER = '<NAME>';
	const NAME = 'MixCloud';
	const URI = 'https://mixcloud.com/';
	const CACHE_TIMEOUT = 3600; // 1h
	const DESCRIPTION = 'Returns latest musics on user stream';

	const PARAMETERS = array(array(
		'u' => array(
			'name' => 'username',
			'required' => true,
		)
	));

	public function getName(){
		if(!is_null($this->getInput('u'))){
			return 'MixCloud - ' . $this->getInput('u');
		}

		return parent::getName();
	}

	public function collectData(){

		$html = getSimpleHTMLDOM(self::URI . $this->getInput('u'))
			or returnServerError('Could not request MixCloud.');

		foreach($html->find('section.card') as $element){

			$item = array();

			$item['uri'] = self::URI . $element->find('hgroup.card-title h1 a', 0)->getAttribute('href');
			$item['title'] = html_entity_decode(
				$element->find('hgroup.card-title h1 a span', 0)->getAttribute('title'),
				ENT_QUOTES
			);

			$image = $element->find('a.album-art img', 0);

			if($image){
				$item['content'] = '<img src="' . $image->getAttribute('src') . '" />';
			}

			$item['author'] = trim($element->find('hgroup.card-title h2 a', 0)->innertext);

			$this->items[] = $item;
		}
	}
}
{'fraction_non_alphanumeric': 0.2052469135802469, 'fraction_numerical': 0.009259259259259259, 'mean_word_length': 3.9769673704414585, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 39, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, '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': '1278247', 'n_tokens_mistral': 1008, 'n_tokens_neox': 880, 'n_words': 182}