ArtisTechMedia / ccMixterHost

ccMixter's implementation of ccHost - may become more javascripty over time and become an all out fork.
GNU General Public License v2.0
18 stars 8 forks source link

API returns broken JSON #1

Open starfrosch opened 9 years ago

starfrosch commented 9 years ago

I request the following data from the API

http://ccmixter.org/api/query?f=json&tags=remix&limit=400&sinced=1%20month%20ago

http://ccmixter.org/api/query?f=json&tags=remix&limit=100&sinced=1%20week%20ago

When I try to decode it with $array = json_decode($result, true); The $array is NULL and json_last_error() returns JSON_ERROR_SYNTAX

I could track it down to record number 9, that breaks json_decode http://ccmixter.org/api/query?f=json&tags=remix&limit=9&sinced=1%20week%20ago

Limited to 8, json_decode is successful. http://ccmixter.org/api/query?f=json&tags=remix&limit=8&sinced=1%20week%20ago

Here is record number 9

{"upload_id" : 48327, "upload_name" : "two turntables [JD mix]", "upload_extra" : {"usertags" : "hip_hop,beats,j_dilla", "ccud" : "media,remix,bpm_090_095", "systags" : "non_commercial,audio,mp3,44k,stereo,VBR,audio,mp3,44k,stereo,VBR", "featuring" : "", "bpm" : 092, "relative_dir" : "content/naotko", "nsfw" : false, "last_op" : "add", "num_reviews" : 1}, "user_name" : "naotko", "upload_tags" : ",media,remix,bpm_090_095,sample,ccplus,non_commercial,audio,mp3,44k,stereo,VBR,hip_hop,beats,j_dilla,", "file_page_url" : "http://ccmixter.org/files/naotko/48327", "user_real_name" : "naotko", "artist_page_url" : "http://ccmixter.org/people/naotko", "license_logo_url" : "http://ccmixter.org/ccskins/shared/images/lics/small-by-nc-3.png", "license_url" : "http://creativecommons.org/licenses/by-nc/3.0/", "license_name" : "Attribution Noncommercial (3.0)", "upload_date_format" : "Thu, Nov 27, 2014 @ 4:07 PM", "files" : [{"file_id" : 72657, "file_upload" : 48327, "filename" : "naotko-_two_turntables_JDmix.mp3", "file_nicname" : "mp3", "file_format_info" : {"media-type" : "audio", "format-name" : "audio-mp3-mp3", "default-ext" : "mp3", "mime_type" : "audio/mpeg", "sr" : "44k", "ch" : "stereo", "ps" : "3:18", "br" : "VBR"}, "file_extra" : {"sha1" : "WCAEHMS42CZLPHVEALUJXK5FVECUKSEY"}, "file_filesize" : " (5.83MB)", "file_order" : 0, "file_is_remote" : 0, "file_num_download" : 0, "downloadurl" : "http://ccmixter.org/content/naotko/naotko-_two_turntables_JDmix.mp3", "localpath" : "/var/www/ccmixter/content/naotko/naotko-_two_turntables_JDmix.mp3", "file_rawsize" : 6111292}, {"file_id" : 72658, "file_upload" : 48327, "filename" : "naotko-_two_turntables_JD_mix_1.mp3", "file_nicname" : "Samples - ccPlus", "file_format_info" : {"media-type" : "audio", "format-name" : "audio-mp3-mp3", "default-ext" : "mp3", "mime_type" : "audio/mpeg", "sr" : "44k", "ch" : "stereo", "ps" : "3:18", "br" : "VBR"}, "file_extra" : {"ccud" : "sample,media,ccplus", "type" : "bigsummermusicfestsamplesccplus", "sha1" : "FVMWX5ZIZRCBAWD32W2OEJARVQK4OXYI"}, "file_filesize" : " (4.65MB)", "file_order" : 1, "file_is_remote" : 0, "file_num_download" : 0, "downloadurl" : "http://ccmixter.org/content/naotko/naotko-_two_turntables_JD_mix_1.mp3", "localpath" : "/var/www/ccmixter/content/naotko/naotko-_two_turntables_JD_mix_1.mp3", "file_rawsize" : 4875346}], "upload_description_plain" : "simple classic loop style dedicated to J dilla"}

starfrosch commented 9 years ago

As workaround I added the &sort=num_scores parameter, like this it works.

mwic commented 7 years ago

This issue should be closed I think? Invalid json came from the construction "bpm" : 092, (092 should be in quotes ) and requests seem to handle this correctly now, e.g. http://ccmixter.org/api/query?f=json&tags=remix&limit=400&sinced=1%20month%20ago has "bpm" : "95,75" Who's in charge of monitoring/closing issues? Need help?

starfrosch commented 7 years ago

Call: http://ccmixter.org/api/query?f=json&sort=num_scores&tags=remix&limit=400&sinced=1%20month%20ago

json_decode($result, true)

json_last_error() still returns JSON_ERROR_SYNTAX

starfrosch commented 6 years ago

This issue is now open more than a year. Anybody out there?

emilysnowflake commented 6 years ago

We are getting ready to make a focused effort on bugs, UI and other needs. Thank you for your patience.

Not sure you saw this previously —

http://ccmixter.org/api/query?f=js&sort=num_scores&tags=remix&limit=400&sinced=1%20month%20ago

Basically returns the same thing as JSON.....

Best,

Emily

On Mar 16, 2018, at 6:20 AM, Markus notifications@github.com wrote:

This issue is now open more than a year. Anybody out there?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

admiralbob77 commented 6 years ago

As noted at the time, if you use the js return type, you'll get something that with very little trouble can be used as a JSON return.

On Fri, Mar 16, 2018 at 8:20 AM, Markus notifications@github.com wrote:

This issue is now open more than a year. Anybody out there?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ArtisTechMedia/ccMixterHost/issues/1#issuecomment-373696908, or mute the thread https://github.com/notifications/unsubscribe-auth/AFzgBdzcM2M9301cVnn5Kssn7UO25qoVks5te64SgaJpZM4DB9Dd .

starfrosch commented 6 years ago

Your JSON doesn't seem to be valid. http://ccmixter.org/api/query?f=js&sort=num_scores&tags=remix&limit=400&sinced=1%20month%20ago

var_dump(json_decode($result, true));

returns NULL

michaelGregoire commented 6 years ago

@starfrosch Check again. The return value of that URL validates as JSON using every validator I've tried.

However when I looked at record 9 that you mentioned above, that is broken, due to 092 likely being treated as octal rather than decimal. Without the leading zero, that record is valid json.

Currently getting up to speed with the codebase, but will address this when I do, if it's still an issue.

starfrosch commented 6 years ago

@michaelGregoire thanks.

json_decode still returns NULL for fetched data starting from 20 days ago.

When I modify the sinced parameter to "1 weeks ago" "2 weeks ago" "1 days ago" ... "19 days ago" it works.

Starting from day 20 days it breaks. "20 days ago" "3 weeks ago" "4 weeks ago" "1 month ago" still returns NULL

http://ccmixter.org/api/query?f=js&sort=num_scores&tags=remix&limit=400&sinced=2%20weeks%20ago

Limited to 11 records it works. Number 12 breaks it.

starfrosch commented 4 years ago

I noticed that the json_decode works again. Did you fix it or is it just a lucky punch?

emilysnowflake commented 4 years ago

We migrated servers and then the new configuration seems to have fixed it. Yay!

Emily Richards Nogawski CEO, ArtisTech Media artistechmedia.com iPhone speelingg errorts likely

On Dec 22, 2019, at 11:51 PM, Markus notifications@github.com wrote:

 I noticed that the json_decode works again. Did you fix it or is it just a lucky punch?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

starfrosch commented 4 years ago

FYI: It's broken again

admiralbob77 commented 4 years ago

Not a thing has changed anywhere in the system.

On Thursday, April 2, 2020, Markus notifications@github.com wrote:

FYI: It's broken again

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ArtisTechMedia/ccMixterHost/issues/1#issuecomment-607646470, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABOOABMEY7OM7OJ7MNGZ5OTRKQVSZANCNFSM4AYH2DOQ .

starfrosch commented 4 years ago

The data always changes, mate.

mwic commented 4 years ago

Yeah, the json from the above URL ( http://ccmixter.org/api/query?f=js&sort=num_scores&tags=remix&limit=400&sinced=2%20weeks%20ago ) has this error from JsLint:

"Unsafe character 'U+9d'."

mwic commented 4 years ago

The offending character ( a paragraph break, I'm pretty sure ) is appearing in the upload_description_plain and upload_description_html fields, e.g. reiswork's node below. The U+9d is the 4 numbers in a little box a few characters before the word "Personnel" and inside the "span class=red"

Likely an artifact of pasting this from god-knows-what fancy word processor. Server-side code will need to clean these up before storing this data.

{"sha1" : "5EINTUXVUFR5ENQDX4R7FORETMMO64PQ", "ccud" : "", "type" : ""}, "file_filesize" : " (12.07MB)", "file_order" : 1, "file_is_remote" : 0, "file_num_download" : 0, "downloadurl" : "http://ccmixter.org/content/Apoxode/Apoxode-_Find_the_Light.flac", "localpath" : "/var/www/ccmixter/content/Apoxode/Apoxode-_Find_the_Light.flac", "file_rawsize" : 12652307}], "upload_description_plain" : "☮ ❤ ☯\r\n\r\nPersonnel:\r\nreiswerk - drums, bass, kalimba, ska guitar, lapsteel guitar\r\nAdmiral Bob - bass, acoustic guitar\r\nSackJo22 - vocals\r\nmykleanthony - vocals\r\n\r\nVSTs used: KeroVee by g200kg, The CS Feeling by The Colorspace", "upload_description_html" : "<span class=\"big\"><span class=\"b\"><span class=\"blue\">☮ <span class=\"red\">❤ <span class=\"green\">☯
\r\n
\r\n<span class=\"u\">Personnel:
\r\nreiswerk - drums, bass, kalimba, ska guitar, lapsteel guitar
\r\nAdmiral Bob - bass, acoustic guitar
\r\nSackJo22 - vocals
\r\nmykleanthony - vocals
\r\n
\r\nVSTs used: KeroVee by g200kg, The CS Feeling by The Colorspace"},

AriesTriputranto commented 3 years ago

usability standard function Uploading markdown-cheatsheet-online

AriesTriputranto commented 3 years ago

just recycle with any page to follow Thank you

Pada tanggal Kam, 7 Okt 2021 16.58, AriesTriputranto < @.***> menulis:

usability standard function https://niagahoster.co.id/blog/api-adalah/?amp

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ArtisTechMedia/ccMixterHost/issues/1#issuecomment-937639637, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKZ2Q3CDCE4OFTYUGVQHZDDUFVVLTANCNFSM4AYH2DOQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

https://en.m.wikipedia.org/wiki/remah_roti