Skip to content

Commit

Permalink
[SongkickBridge] fix formatting and event title
Browse files Browse the repository at this point in the history
  • Loading branch information
joaomqc authored Nov 15, 2023
1 parent bb8f2e7 commit a0790f5
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions bridges/SongkickBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class SongkickBridge extends BridgeAbstract

const ARTIST_URI = 'https://www.songkick.com/artists/%s/';
const CALENDAR_URI = self::ARTIST_URI . 'calendar';

private $name = '';

public function getURI()
Expand All @@ -42,7 +42,7 @@ public function getIcon()
public function collectData()
{
$url = sprintf(self::CALENDAR_URI, $this->getInput('artistid'));

$dom = getSimpleHTMLDOM($url);

$jsonscript = $dom->find('div.microformat > script', 0);
Expand All @@ -60,15 +60,16 @@ public function collectData()

foreach ($dom->find('div[@id="calendar-summary"] > ol > li') as $article) {
$detailsobj = json_decode($article->find('div.microformat > script', 0)->innertext)[0];

$a = $article->find('a', 0);

$details = $a->find('div.event-details', 0);
$title = $details->find('.secondary-detail', 0)->plaintext;
$city = $details->find('.primary-detail', 0)->plaintext;
$event = $detailsobj->location->name;

$content = 'City: ' . $city . '<br>Event: ' . $event . '<br>Date: ' . $article->title;

$categories = [];
if ($details->hasClass('concert')) {
$categories[] = 'concert';
Expand All @@ -79,9 +80,9 @@ public function collectData()
if (!is_null($details->find('.outdoor', 0))) {
$categories[] = 'outdoor';
}

$this->items[] = [
'title' => $detailsobj->location->name,
'title' => $title,
'uri' => $a->href,
'content' => $content,
'categories' => $categories,
Expand Down

0 comments on commit a0790f5

Please sign in to comment.