OP
Ameglian cow
Joined: Sep 2003
Posts: 42 |
Nice. Now you need to either use a json parser, or parse in a crude way manually with either $mid/$gettok stuff or with regex You can find a json parser for mIRC here https://github.com/SReject/JSON-For-Mirc but you need to be familiar with the json format to use it, this will guarantee correct data all the time. As far as making assumptions, regex can be terribly good when you know them: //var %string {"id":215,"url":"https://www.tvmaze.com/shows/215/american-dad","name":"American Dad!","type":"Animation","language":"English","genres":["Comedy","Family"],"status":"Running","runtime":30,"averageRuntime":30,"premiered":"2005-02-06","ended":null,"officialSite":"http://www.tbs.com/shows/american-dad.html","schedule":{"time":"22:00","days":["Monday"]},"rating":{"average":7.4},"weight":98,"network":{"id":32,"name":"TBS","country":{"name":"United States","code":"US","timezone":"America/New_York"},"officialSite":"https://www.tbs.com/"},"webChannel":null,"dvdCountry":{"name":"United States","code":"US","timezone":"America/New_York"},"externals":{"tvrage":2594,"thetvdb":73141,"imdb":"tt0397306"},"image":{"medium":"https://static.tvmaze.com/uploads/images/medium_portrait/476/1191222.jpg","original":"https://static.tvmaze.com/uploads/images/original_untouched/476/1191222.jpg"},"summary":"<p>In <b>American Dad!</b>, Stan Smith leads the all-American family in this animated sitcom filled with wild and crazy extremes. Everyday life is taken to the limit as Stan applies the same drastic measures used in his job at the CIA to his home life. Driven by machismo and the American dream, he often is blind to how horribly he fails at his attempts. This father might not know best, but he never stops trying.</p>","updated":1705592851,"_links":{"self":{"href":"https://api.tvmaze.com/shows/215"},"previousepisode":{"href":"https://api.tvmaze.com/episodes/2674312"}}},%p {"id":(\d+),"url":"([^"]+)","name":"([^"]+)","type":"([^"]+)","language":"([^"]+)","genres":\[([^\]]+)\],"status":"([^"]+)","runtime":(\d+),"averageRuntime":(\d+),"premiered":"([^"]+)","ended"([^,]+),"officialSite":"([^"]+)","schedule":{([^}]+)},"rating":{([^}]+)},"weight":(\d+),"network":{"id":(\d+),"name":"([^"]+)","country":{"name":"([^"]+)","code":"([^"]+)" | noop $regex(%string,%p) | echo -sg Name: $regml(3) $(|) Type: $regml(4) $(|) Language: $regml(5) $(|) Genres: $regml(6) $(|) Status: $regml(7) $(|) Url: $regml(2) | echo -sg Network: $regml(17) $(|) Country: $regml(18) $regml(19) You can execute that in mIRC's status window But note that if the json changes, the regex could fail as it matches quite precisely. Thanks! That looks good.  However there is a small problem with the given regex and that one is that it wont work for example for shows where network is NULL and webChannel is used instead. It wont show any data in such a case. Is there an easy way to bypass this problem please? Example: {"id":52341,"url":"https://www.tvmaze.com/shows/52341/star-wars-andor","name":"Star Wars: Andor","type":"Scripted","language":"English","genres":["Science-Fiction","Thriller","Espionage"],"status":"Running","runtime":null,"averageRuntime":46,"premiered":"2022-09-21","ended":null,"officialSite":"https://www.disneyplus.com/series/andor/3xsQKWG00GL5","schedule":{"time":"","days":["Wednesday"]},"rating":{"average":7.8},"weight":99,"network":null,"webChannel":{"id":287,"name":"Disney+","country":null,"officialSite":"https://www.disneyplus.com/"},"dvdCountry":null,"externals":{"tvrage":null,"thetvdb":393189,"imdb":"tt9253284"},"image":{"medium":"https://static.tvmaze.com/uploads/images/medium_portrait/487/1217811.jpg","original":"https://static.tvmaze.com/uploads/images/original_untouched/487/1217811.jpg"},"summary":"<p><b>Star Wars: Andor</b> explores a new perspective from the Star Wars galaxy, focusing on Cassian Andor's journey to discover the difference he can make. The series brings forward the tale of the burgeoning rebellion against the Empire and how people and planets became involved. It's an era filled with danger, deception and intrigue where Cassian will embark on the path that is destined to turn him into a rebel hero.</p>","updated":1700163464,"_links":{"self":{"href":"https://api.tvmaze.com/shows/52341"},"previousepisode":{"href":"https://api.tvmaze.com/episodes/2369091"}}}
|