Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add time and channel to broadcast info #2

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const addDataToTable = (data) => {
const cellLink = row.insertCell(1);
const cellBtn = row.insertCell(2);

cellName.innerHTML = item.name;
cellName.innerHTML = `${item.time}, ${item.name}, ${item.channel}`;

if (item.acestream) {
const btnCopy = document.createElement('button');
Expand Down
28 changes: 28 additions & 0 deletions pimple.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,32 @@ public function getLinkForAceStreamBroadcast()
}
return null;
}

/**
* @return string
*/
public function getBroadcastTime()
{
$pattern = '#<p itemprop="startDate".*, (.*)</b>#';
preg_match($pattern, $this->html, $matches);
if (isset($matches[1])) {
return $matches[1];
}
return null;
}

/**
* @return string
*/
public function getBroadcastChannel()
{
$pattern = '#<dt>Телеканал:</dt>\n<dd>(.*)</dd>#';
preg_match($pattern, $this->html, $matches);
if (isset($matches[1])) {
return $matches[1];
}
return null;
}
}

class App
Expand All @@ -162,6 +188,8 @@ public function init()
$linksForBroadcasts[] = [
'name' => $item['name'],
'acestream' => $matchPageParser->getLinkForAceStreamBroadcast(),
'time' => $matchPageParser->getBroadcastTime(),
'channel' => $matchPageParser->getBroadcastChannel(),
];
}

Expand Down