1
0

rss.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. include("../api.php");
  3. include("../include/lib.php");
  4. if (!isset($_GET["id"])) die("不正なID。");
  5. $id = (int)$_GET["id"];
  6. $res = get("user/".$id."/profile/top");
  7. if (!isset($res->body) || $res->error) {
  8. header("Location: " . SITEURL . "/404.php");
  9. die();
  10. }
  11. $res = $res->body;
  12. $cont = [];
  13. foreach ($res->illusts as $k => $v) $cont[$k] = $v;
  14. foreach ($res->manga as $k => $v) $cont[$k] = $v;
  15. usort($cont, function ($a, $b) {
  16. return strtotime($b->createDate) - strtotime($a->createDate);
  17. });
  18. header("Content-type: application/atom+xml");
  19. ?>
  20. <?xml version="1.0" encoding="utf-8"?>
  21. <feed xmlns="http://www.w3.org/2005/Atom" xmlns:thr="http://purl.org/syndication/thread/1.0" xml:lang="ja-JP">
  22. <link rel="self" href="<?= SITEURL ?>/users/?id=<?= $id ?>" />
  23. <id><?= $id ?></id>
  24. <title><?= $res->extraData->meta->ogp->title ?></title>
  25. <updated>2023-04-19T00:00:00Z</updated>
  26. <author><?= $res->extraData->meta->ogp->title ?></author>
  27. <image>
  28. <url><?= SITEURL ?>/userhead.php?id=<?= $id ?></url>
  29. <title><?= $res->extraData->meta->ogp->title ?></title>
  30. <link rel="self" href="<?= SITEURL ?>/users/?id=<?= $id ?>" />
  31. </image>
  32. <?php
  33. foreach ($cont as $c) {
  34. $img = get("illust/".$c->id);
  35. ?>
  36. <entry>
  37. <id><?= $c->id ?></id>
  38. <author>
  39. <name><?= $c->userName ?></name>
  40. <uri><?= SITEURL."/users/?id=".$c->userId ?></url>
  41. </author>
  42. <published><?= $img->body->createDate ?></published>
  43. <title type="html"><?= $img->body->illustTitle ?></title>
  44. <link rel="alternate" href="<?= SITEURL."/artworks/?id=".$c->id ?>" />
  45. <content type="html">
  46. <?= $img->body->illustComment ?><br />
  47. <?php for ($i = 0; $i < $img->body->pageCount; $i++) { ?>
  48. <?= imgprx(str_replace("_p0", "_p".$i, $img->body->urls->original)) ?><br />
  49. <?php } ?>
  50. </content>
  51. </entry>
  52. <?php } ?>
  53. </feed>