miyako | A multipurpose Discord Bot | Bot library
kandi X-RAY | miyako Summary
kandi X-RAY | miyako Summary
Here is a (kinda long) story of my bot development on Discord and how this started out. I made a bunch of bots before but not many was successful, most successful one was me in a team but that died out soon. I had experience with discord.js and discord.py, Python was my first and the team used it, however I was in love with discord.js at the time too, but at the same time was bored and couldn't decide so after that I made a bot named Ladybug with Python and discord.py (In fact I did prototype a command handler in JavaScript with discord.js but I just never released it). I had made the bot account before for testing purposes before I actually worked on releasing it. Ladybug was doing great, probably around 100 servers at this point (or likely less) when I found about Klasa and it looked cool which motivated me to get back to discord.js. I immediately jumped to rewriting it to Klasa (The python version is archived here). The klasa rewrite was a success, it was going great I had fun, I made about 149 commands and by the end it had about 300 servers. Slowly I got bored of Klasa felt nothing interesting was going on and lot of my code was messed up, felt like I'm doing everything wrong and it had high memory usage which annoyed me. The ram usage could do as far as 500 MB, I felt that was too much, lot of people were clearing cache to free up memory but my code depended a lot on the cache in many places so it wasn't an option but I did avoid those mistakes in the current version. I found about Golang, I loved the simplicity and it had pretty low memory use so I thought I should rewrite to Golang now that everything is messed up. I had hard time figuring out a good code structure, reading the existed bots had very messed up structure and mainly manually registering commands, I came with a simple structure that I felt comfortable and wrote some commands but then I got an idea and built up a Klasa-like framework for Go (which is archived here) so I rewrote my code to use my new framework which was public this time and not just for my bot. Rewriting it took so long. My bot was all offline at this point I was afraid of it taking too long and losing servers while it's offline so I pushed to production immediately with lots of functionality still missing I then found out after production release I started to work on it less and less and eventually decided to stop working on it. Go is simple but that simplicity is a con for Discord Bot development we need high level functionality and such to focus on the bot, it took me a long time to build a command as I was too lazy to port the logic and unwrap bunch of readable code into what will look like a mess in Go and finding equivalent libraries. I was losing confidence in my framework too, felt the design is terrible and could get a rewrite, tried hard to stay motivated and I found out about arikawa decided discordgo is horrible for me and wanted to rewrite to arikawa instead, however again code structure and structure, their command handler looked like it would make a horrible file structure that's gonna give me OCD every second so I decided to rewrite my Sapphire framework to use arikawa and fix a lot of the design regrets I had so I began writing code but then I decided "screw it" writing this framework will take me ages and I lost all the motivation in discord bots like this. I was trying to get away from JavaScript but I said screw it I'm gonna admit JavaScript is good, I really felt like I needed it when i was suffering with Go, the times I chained promises and used async/await good days, I missed the syntax and I decided that I don't care about memory usage and such anymore I just want to get work done quickly so I did a yet another rewrite to JavaScript which is this one. (The Go version is archived here). This time I didn't want to use Klasa. I took a look at Akairo and Commando but didn't feel like it. I was always inspired by Misaki which had its own command handler, it felt fun to have my own that I can have full control over it so I made a manual command handler partially based on Misaki's and this time I don't plan on any more rewrites or killing it. I have a decent motivation for now to continue developing this. Porting commands were much easier this way, I managed to copy-paste some of my commands from my Klasa version and slightly editing it and on the way I cleaned up some more code on those commands, so I'm currently very satisfied with the results. I just would like to have some more core devs/maintainers/supporters and more friends on the way to be with me as this project gets developed. So if you are interested in meeting me join the Discord Server :). Currently the community is very small and inactive which is the part I'm trying to fix at the moment. It's been a long time since I had any solid Discord friends and most of my current friends kind of don't care much so I am kinda lonely at this point with this project.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of miyako
miyako Key Features
miyako Examples and Code Snippets
Community Discussions
Trending Discussions on miyako
QUESTION
I was trying to parse this JSON file to my Python code from this URL: https://shopee.co.id/api/v1/item_detail/?item_id=293667885&shop_id=24413460 that i took from this page https***shopee.co.id/PHILIPS-RICE-COOKER-2L-HD3128-33_sby-Area-Surabaya-i.24413460.293667885 (sorry i cannot post more than two links yet)
When I use Developer Tools to analyze the data, it was showing the attributes of the JSON file with normal-readable-strings, but when I opened the file by double-clicking it some contents appear to be hidden?
This is my code to parse that JSON file:
...ANSWER
Answered 2017-Sep-28 at 20:42Since it loads in the browser but not with a plain curl
request to that URL, something about the request is triggering a different response from the server.
Chrome can give a curl
command line for any resource loaded on the page:
This copies a request that includes all the HTTP headers:
curl 'https://shopee.co.id/api/v1/item_detail/?item_id=293667885&shop_id=24413460' -H 'cookie: _ga=GA1.3.2146560403.1506630766; _gid=GA1.3.1501700749.1506630766; _gat=1; csrftoken=yGTme9JnjopdDWv5axfOSoheC4opBno4' -H 'accept-encoding: gzip, deflate, br' -H 'accept-language: en-US,en;q=0.9' -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3226.0 Safari/537.36' -H 'x-api-source: pc' -H 'accept: */*' -H 'referer: https://shopee.co.id/PHILIPS-RICE-COOKER-2L-HD3128-33_sby-Area-Surabaya-i.24413460.293667885' -H 'authority: shopee.co.id' -H 'x-requested-with: XMLHttpRequest' -H 'if-none-match-: 55b03-89dcbb5568d6e9410be036d2f935045d' --compressed
Run this without changing anything to verify that it still produces the same response from the server. It does.
Remove the extra headers one by one to see if the response changes.
Be careful with -H 'accept-encoding: gzip, deflate, br'
and --compressed
since they work together, you don't want to look at raw gzip
bytes in your terminal.
Eventually discover that if-none-match-: 55b03-89dcbb5568d6e9410be036d2f935045d
is the header that triggers the different response from the server. Conclude that it might be some sort of caching bug in the API server.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install miyako
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page