generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: how can I get Updated from catalog json

Previous Thread :: Next Thread 
025110 is not online. 025110
Joined: 23 Nov 2012
Total Posts: 57661
22 Mar 2015 10:53 AM
rbx.lua btw
using rproxy


local http = game:GetService("HttpService");

test = http:GetAsync(url, true);

print(test)
>prints the whole page

print(test[0].Updated)
>nil
print(test[0])
>nil

the link (put a space to avoid ;amp error) (yes I used rproxy in script)
http://roblox.com /catalog/json?CatalogContext=1&Subcategory=1&CreatorID=1&CurrencyType=0&pxMin=0&pxMax=0&SortType=3&SortAggregation=3&SortCurrency=0&IncludeNotForSale=true&LegendExpanded=false&Category=1
Report Abuse
Photographist is not online. Photographist
Joined: 28 Apr 2013
Total Posts: 9858
22 Mar 2015 10:57 AM
ur mum
Report Abuse
AbstractMadness is not online. AbstractMadness
Joined: 22 Dec 2014
Total Posts: 20425
22 Mar 2015 10:58 AM
get on steam again
Report Abuse
chimmihc is not online. chimmihc
Joined: 01 Sep 2014
Total Posts: 17143
22 Mar 2015 10:59 AM
test = http:JSONDecode(http:GetAsync(url,true));


I script -~ chimmihc
Report Abuse
WebGL3D is online. WebGL3D
Joined: 04 Sep 2013
Total Posts: 28311
22 Mar 2015 11:00 AM
/catalog/json/?CatalogContext=1&Subcategory=17&CurrencyType=0&pxMin=0&pxMax=0&SortType=3&SortAggregation=3&SortCurrency=0&IncludeNotForSale=true&Category=1&ResultsPerPage=42&PageNumber=1


~ 1Topcop ~ WebGL3D ~ Java3D ~ Data3D ~ Purple Squid >
Report Abuse
WebGL3D is online. WebGL3D
Joined: 04 Sep 2013
Total Posts: 28311
22 Mar 2015 11:01 AM
actually that can be shortened, currency sorting isn't needed
/catalog/json/?CatalogContext=1&Subcategory=17&SortType=3&SortAggregation=3&IncludeNotForSale=true&Category=1&ResultsPerPage=42&PageNumber=1




~ 1Topcop ~ WebGL3D ~ Java3D ~ Data3D ~ Purple Squid >
Report Abuse
025110 is not online. 025110
Joined: 23 Nov 2012
Total Posts: 57661
22 Mar 2015 11:02 AM
@web how do I get parts of the info though
Report Abuse
WebGL3D is online. WebGL3D
Joined: 04 Sep 2013
Total Posts: 28311
22 Mar 2015 11:03 AM
What do you mean?


~ 1Topcop ~ WebGL3D ~ Java3D ~ Data3D ~ Purple Squid >
Report Abuse
025110 is not online. 025110
Joined: 23 Nov 2012
Total Posts: 57661
22 Mar 2015 11:03 AM
-
Report Abuse
AbstractMadness is not online. AbstractMadness
Joined: 22 Dec 2014
Total Posts: 20425
22 Mar 2015 11:03 AM
You can actually do this.

/catalog/json?&SortType=3&Category=0
Report Abuse
025110 is not online. 025110
Joined: 23 Nov 2012
Total Posts: 57661
22 Mar 2015 11:04 AM
like how do I get the hours it was updated without string.sub / gsub
Report Abuse
WebGL3D is online. WebGL3D
Joined: 04 Sep 2013
Total Posts: 28311
22 Mar 2015 11:04 AM
Ohhh I see, you need to decode the JSON first of all, secondly Lua tables start at the index of 1, not 0

so in this case


local http = game:GetService("HttpService")
test = http:DecodeJSON(http:GetAsync(url, true))
-- don't need semi-colons in Lua

print(test[1].UpdatedDate) -- field is UpdatedDate, not Updated


~ 1Topcop ~ WebGL3D ~ Java3D ~ Data3D ~ Purple Squid >
Report Abuse
WebGL3D is online. WebGL3D
Joined: 04 Sep 2013
Total Posts: 28311
22 Mar 2015 11:05 AM
@Abs that won't work for offsales, Subcategory 17 is most accurate


~ 1Topcop ~ WebGL3D ~ Java3D ~ Data3D ~ Purple Squid >
Report Abuse
025110 is not online. 025110
Joined: 23 Nov 2012
Total Posts: 57661
22 Mar 2015 11:07 AM
12:06:50.404 - DecodeJSON is not a valid member of HttpService
Report Abuse
WebGL3D is online. WebGL3D
Joined: 04 Sep 2013
Total Posts: 28311
22 Mar 2015 11:07 AM
oops, sorry I'm a little rusty
http://wiki.roblox.com/index.php?title=API:Class/HttpService/JSONDecode
method is JSONDecode


~ 1Topcop ~ WebGL3D ~ Java3D ~ Data3D ~ Purple Squid >
Report Abuse
025110 is not online. 025110
Joined: 23 Nov 2012
Total Posts: 57661
22 Mar 2015 11:07 AM
ok, switched it to JSONDecode

it prints "
/Date(1426956092333)/"
Report Abuse
WebGL3D is online. WebGL3D
Joined: 04 Sep 2013
Total Posts: 28311
22 Mar 2015 11:08 AM
that is correct


~ 1Topcop ~ WebGL3D ~ Java3D ~ Data3D ~ Purple Squid >
Report Abuse
025110 is not online. 025110
Joined: 23 Nov 2012
Total Posts: 57661
22 Mar 2015 11:09 AM
wot do I do with that
Report Abuse
AbstractMadness is not online. AbstractMadness
Joined: 22 Dec 2014
Total Posts: 20425
22 Mar 2015 11:10 AM
just get the AssetId and use MPS to get the updated time, but somehow we have to figure out how to decode it

web you know how?
Report Abuse
025110 is not online. 025110
Joined: 23 Nov 2012
Total Posts: 57661
22 Mar 2015 11:11 AM
@ab

updateddate is in MS or something I think

WAAYY easier than MPS updated [gives the date, not a time]
Report Abuse
025110 is not online. 025110
Joined: 23 Nov 2012
Total Posts: 57661
22 Mar 2015 11:12 AM
here's what I have so far

local url = "offsite ";

local http = game:GetService("HttpService")
local mps = game:GetService("MarketplaceService")


test = http:JSONDecode(http:GetAsync(url, true))


print(test[1].UpdatedDate)

assetid = tonumber(string.sub(test,13,21))

_G.asset123 = tonumber(assetid)

local properties = {
name = mps:GetProductInfo(assetid).Name,
desc = mps:GetProductInfo(assetid).Description,
robux = mps:GetProductInfo(assetid).PriceInRobux,
tix = mps:GetProductInfo(assetid).PriceInTix,
updated = mps:GetProductInfo(assetid).Updated,
sales = mps:GetProductInfo(assetid).Sales,
isLimited = mps:GetProductInfo(assetid).IsLimited
}



properties.updated = string.gsub(properties.updated, "[%a%p]+", "")

properties.updated = string.sub(properties.updated, 5) --[[returns the DMY as 03/21 H16 M41 S32/33/3 ]]
print(properties.updated)


local GUI = game.ServerStorage.Notification

function sendNotification(asset)
script.Sound:Play()
for _,v in pairs(game.Players:GetChildren()) do
GUI:Clone().Parent = v.PlayerGui
end
end


Report Abuse
WebGL3D is online. WebGL3D
Joined: 04 Sep 2013
Total Posts: 28311
22 Mar 2015 11:13 AM
well that's the epoch time it was uploaded in milliseconds, similar to what os.time() or tick() return
tick, and os.time return a second, but include a decimal
basically what you have to do is pull the number from the string, and divide by 1,000 so it becomes the time tick() would have returned, and do math to turn it into a date

e.g.
x = tonumber(test[1].UpdatedDate:match("%d+"))
-- do math with x to get date, month, and year


~ 1Topcop ~ WebGL3D ~ Java3D ~ Data3D ~ Purple Squid >
Report Abuse
WebGL3D is online. WebGL3D
Joined: 04 Sep 2013
Total Posts: 28311
22 Mar 2015 11:15 AM
or that, you can use MarketplaceService to get the time in a different format, and pull the information from that ;p
remember though test is a table now, so you need to do something along the lines of

info = mps:GetProductInfo(test[1].AssetId)


~ 1Topcop ~ WebGL3D ~ Java3D ~ Data3D ~ Purple Squid >
Report Abuse
025110 is not online. 025110
Joined: 23 Nov 2012
Total Posts: 57661
22 Mar 2015 11:17 AM
yeah but the mps formatting is weird


date of creation
>1 4 2 6 9 5 6 0 9 2 3 3 3

current time
>1 4 2 7 0 4 0 9 4 9

[had to space cause blocked]

wat
Report Abuse
WebGL3D is online. WebGL3D
Joined: 04 Sep 2013
Total Posts: 28311
22 Mar 2015 11:19 AM
pretty sure MPS is the way you want to go, it should return in this format
2015-03-21T02:52:55.713Z
then you can use either string sub, or match to get the information you need


~ 1Topcop ~ WebGL3D ~ Java3D ~ Data3D ~ Purple Squid >
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image