Permalink
Browse files

Track episode dates

  • Loading branch information...
josh committed Oct 31, 2017
1 parent 15c3b8f commit 3d2e093343cc8cfcdbd1f4aa3d0bd3ddc5853da5
Showing with 7 additions and 1 deletion.
  1. +7 −1 overcast.php
@@ -43,6 +43,7 @@ class Episode {
public $podcastTitle;
public $title;
public $description;
public $date;
public $imageURL;
public $duration;
public $mimeType;
@@ -174,7 +175,7 @@ function fetchPodcast($id) {
function fetchEpisode($id) {
global $memcache;
$key = "overcast:fetchEpisode:v4:$id";
$key = "overcast:fetchEpisode:v5:$id";
$data = $memcache->get($key);
if ($data) {
return unserialize($data);
@@ -214,6 +215,11 @@ function fetchEpisode($id) {
$episode->title = $xpath->query('//div[@class="title"]')[0]->textContent;
$episode->description = $xpath->query('//meta[@name="og:description"]')[0]->getAttribute('content');
$dateEl = $xpath->query('//div[@class="margintop1"]');
if (isset($dateEl[0])) {
$episode->date = strftime('%Y-%m-%d', strtotime($dateEl[0]->textContent));
}
preg_match('/^#?(\d+)\s*(:|-|–|—)?\s+/', $episode->title, $matches);
if (isset($matches[0])) {
$episode->title = substr($episode->title, strlen($matches[0]));

0 comments on commit 3d2e093

Please sign in to comment.