Last active
October 3, 2022 11:00
-
-
Save jgraup/7627862 to your computer and use it in GitHub Desktop.
PHP - Unity3D Asset Store Publisher Feed. You must supply your own secret key to use this, a key is generated per publisher at https://publisher.assetstore.unity3d.com/info.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include_once ( 'unity3d-assetstore.php' ); | |
// Doesn't matter what is used for the publisher name, | |
// the key still points to only one publisher. | |
$authArray = array ( | |
'publisher' => '{PUBLISHER_NAME}' | |
'key' => '{PUBLISHER_KEY}', | |
); | |
$data = Unity3DAssetStore::getPublisherFeed($authArray['key'], $authArray['publisher']); | |
/** | |
* @var $node SimpleXMLElement | |
* @var $feed SimpleXMLElement | |
* @var $channel SimpleXMLElement | |
*/ | |
@$feed = new SimpleXMLElement($data); | |
@$channel = $feed->xpath('channel')[0]; | |
// var_dump($feed); | |
echo "Channel\n\t"; | |
echo "title: ", $channel->xpath("title")[0], "\n\t"; | |
echo "link: ", $channel->link, "\n\t"; | |
echo "description: ", $channel->description, "\n\t"; | |
echo "language: ", $channel->language, "\n\t"; | |
echo "copyright: ", $channel->copyright, "\n\t"; | |
echo "pubDate: ", $channel->pubDate, "\n\t"; | |
echo "ttl: ", $channel->ttl, "\n\t"; | |
echo "image: ", $channel->xpath("image/url")[0], "\n\t"; | |
echo "\n"; | |
$items = $feed->xpath('channel/item'); | |
while(list( , $node) = each($items)) { | |
echo 'title: ', $node->title, "\n\t"; | |
echo 'link: ', $node->link, "\n\t"; | |
echo 'description: ', $node->description, "\n\t"; | |
echo 'guid: ', $node->guid, "\n\t"; | |
echo 'pubDate: ', $node->pubDate, "\n"; | |
echo "\n"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Unity3DAssetStore Class | |
*/ | |
class Unity3DAssetStore | |
{ | |
/** | |
* static @var $PUBLISHER_API_FEED_URL string Base url for publisher feeds | |
* static @var $PUBLISHER_API_FEED_ACTIVITY string | |
* static @var $XSL_BEFORE string | |
* static @var $XSL_AFTER string | |
*/ | |
public static $PUBLISHER_API_FEED_URL = 'https://publisher.assetstore.unity3d.com/feed/'; | |
public static $PUBLISHER_API_FEED_ACTIVITY = '/activity.rss'; | |
public static $XSL_BEFORE = '"/resources/xsl/rss/activity.xsl"'; | |
public static $XSL_AFTER = '"https://publisher.assetstore.unity3d.com/resources/xsl/rss/activity.xsl"'; | |
/** | |
* @param $key | |
* @param string $publisher (Optional) | |
* @return string Feed Data | |
*/ | |
public static function getPublisherFeed($key, $publisher = "") | |
{ | |
if ( $publisher === "" || strlen($publisher) < 1 ) $publisher = "publisher"; | |
$apiUrl = Unity3DAssetStore::$PUBLISHER_API_FEED_URL . $publisher . "/" . $key . Unity3DAssetStore::$PUBLISHER_API_FEED_ACTIVITY; | |
$data = @file_get_contents($apiUrl); | |
return ($data) | |
? str_replace (Unity3DAssetStore::$XSL_BEFORE, Unity3DAssetStore::$XSL_AFTER, $data) | |
: $data; | |
} | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<?xml-stylesheet type="text/xsl" href="/resources/xsl/rss/activity.xsl"?> | |
<rss version="2.0" | |
xmlns:blogChannel="http://backend.userland.com/blogChannelModule" | |
> | |
<channel> | |
<title>Unity Asset Store - Latest activity for Just Good Design</title> | |
<link>http://u3d.as/3sY</link> | |
<description>The latest activity for Just Good Design in the Unity Asset Store.</description> | |
<language>en-us</language> | |
<copyright>Unity Technologies</copyright> | |
<pubDate>Sun, 24 Nov 2013 14:20:09 -0000</pubDate> | |
<ttl>10</ttl> | |
<image> | |
<title>Unity</title> | |
<url>http://download.unity3d.com/images/news/unity-logo.png</url> | |
<link>http://www.unity3d.com/</link> | |
</image> | |
<item> | |
<title>Review of package "Good Drop" by Just Good Design</title> | |
<link>http://u3d.as/520</link> | |
<description><h1>test</h1><p>test</p></description> | |
<guid isPermaLink="false">1145</guid> | |
<pubDate>Tue, 29 Oct 2013 23:01:55 -0000</pubDate> | |
</item> | |
<item> | |
<title>Reply to review of package "Good SVN" by Just Good Design</title> | |
<link>http://u3d.as/4ea</link> | |
<description><h1>Reply from publisher</h1><p>testing</p></description> | |
<guid isPermaLink="false">1124</guid> | |
<pubDate>Tue, 29 Oct 2013 14:04:17 -0000</pubDate> | |
</item> | |
</channel> | |
</rss> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Now the link is gone. In short for what it's doing (in case someone doesn't have access to PHP):
https://publisher.assetstore.unity3d.com/feed/<publisher-name>/<api-key>/activity.rss