Browse Source

skip parsing xkcd home page

pull/39/head
Aaron Parecki 4 years ago
parent
commit
ee7fa97654
No known key found for this signature in database GPG Key ID: 276C2817346D6056
2 changed files with 5 additions and 1 deletions
  1. +1
    -1
      controllers/Parse.php
  2. +4
    -0
      lib/Formats/XKCD.php

+ 1
- 1
controllers/Parse.php View File

@ -179,7 +179,7 @@ class Parse {
return $this->respond($response, 200, $data);
}
if($host == 'xkcd.com') {
if($host == 'xkcd.com' && parse_url($url, PHP_URL_PATH) != '/') {
$data = Formats\XKCD::parse($result['body'], $url);
$data['url'] = $result['url'];
$data['code'] = $result['code'];

+ 4
- 0
lib/Formats/XKCD.php View File

@ -25,6 +25,10 @@ class XKCD {
];
$name = $doc->getElementById('ctitle');
if(!$name)
return self::_unknown();
$entry['name'] = $name->nodeValue;
$photo = $xpath->query("//div[@id='comic']/img");

Loading…
Cancel
Save