+ 4

Back-end

Can POST and GET request be made with Solo Learn code editor? And routing

13th Jun 2019, 7:54 PM
UDOFIA
UDOFIA - avatar
5 Answers
+ 7
Yes. I'm sure it works for JavaScript because I did it already. Those requests can be made from your JavaScript like they can from any website. Since your code runs in the code.sololearn.com domain, it is blocked by www.sololearn.com's Cross-Origin Resource Sharing policy which prevents you from reading the trending codes, the user profile... That means the requests actually get processed by Sololearn's servers but the web browser stops the responses from getting to our JavaScript because the browser sees that the HTTP response indicates a violation. That shouldn't stop JavaScript from code.sololearn.com hitting a server of your control because the CORS policy would then be under your control. If you're using other languages such as Python, you'll have more problems such as the requests package not existing and likely finding that Sololearn will run your code in a highly restricted environment with all the networking ports blocked. Opening network access for code that runs on Sololearn's servers probably risks too much abuse from its users.
14th Jun 2019, 4:27 PM
Josh Greig
Josh Greig - avatar
+ 6
Hello, Just so you know... 'You represent, warrant, and agree that you will not contribute any Content or User Submission (each of those terms is defined below) or otherwise use the Services or interact with the Services in a manner that: [...] "crawls,” “scrapes,” or “spiders” any page, data, or portion of or relating to the Services or Content (through use of manual or automated means)' https://www.sololearn.com/Terms-of-Use/ So *if* I were scraping SoloLearn, I would hesitate to advertise it openly. My 2c.
15th Jun 2019, 12:58 PM
Janning⭐
Janning⭐ - avatar
+ 5
Thanks, Josh Greig , I can empathise with some of your thoughts. There are a lot of things we can learn about securing our websites better through pen testing and understanding how malicious actors think without intending to be malicious ourselves, but I think it can be difficult for them to find a finer line when others take the information we shared and use it for disruptive deeds. It's sad when we find useful codes that teach something simple like how to let other users upload links to your Code Playground project with the intention of creating a library or collection of educational PDFs or something, just to find that users have anonymously uploaded inappropriate words and websites to it. If you really want to, you can email SoloLearn staff directly at info@sololearn.com to see if they are willing to make a special exception for your code, but I suppose that may also come with a little risk. đŸ€·đŸ»â€â™‚ïž Fortunately, there are plenty of other things to learn and teach, so try not to get too discouraged. đŸ€“
15th Jun 2019, 8:48 PM
Janning⭐
Janning⭐ - avatar
+ 4
Janning, thanks. I made that code private to be safe. I was intending it to educate people and not to be malicious. That rule is unfortunate. There are lots of creative, fun, exciting things that can be made with scraping that become too risky when a rule like that exists. I even made my answer less informative because of that rule. I get that they don't want some DDOS attack or some competing site to copy everyone's public code but I thought Sololearn would welcome the kind of AJAX example I published.
15th Jun 2019, 4:25 PM
Josh Greig
Josh Greig - avatar
+ 4
Thanks guys
16th Jun 2019, 7:19 PM
UDOFIA
UDOFIA - avatar