项目作者: aditeyabaral

项目描述 :
Converting the SpongeBob Mocking Meme into a Service to redefine the meaning of SaaS
高级语言: Python
项目地址: git://github.com/aditeyabaral/spongebob-as-a-service.git
创建时间: 2021-02-05T12:34:48Z
项目社区:https://github.com/aditeyabaral/spongebob-as-a-service

开源协议:

下载


SpongeBob-as-a-Service

Converting the SpongeBob Mocking Meme into a Service to redefine the meaning of SaaS.



How to use SaaS

SaaS is pretty simple to use, and aims to be the simplest (and only) SpongeBob service that exists. The base URL is https://spongebob-service.herokuapp.com/. Captions can be passed in two ways.

SaaS using Routes

SaaS memes can be generated using the following URL route formats:

  • Bottom caption: This will insert a caption at the bottom of the image.

    • Format: https://spongebob-service.herokuapp.com/<bottom caption>
  • Top and Bottom captions: This will insert a caption at the top and bottom of the image.

    • Format: https://spongebob-service.herokuapp.com/<top caption>/<bottom caption>

SaaS using Parameters

SaaS memes can also be generated using parameters passed in the URL. This method although slower, provides greater flexibility in setting the image positions.

You can choose to have both captions, or either one caption.

  • Both captions: https://spongebob-service.herokuapp.com/q?top=<top caption>&bottom=<bottom caption>

  • Top or Bottom caption:

    • Top caption: https://spongebob-service.herokuapp.com/q?top=<top caption>
    • Bottom caption: https://spongebob-service.herokuapp.com/q?bottom=<bottom caption>

SaaS in a Script

You can even use SaaS in a script. Here is a simple example using Python.

  1. >>> import requests
  2. >>> from bs4 import BeautifulSoup
  3. >>>
  4. >>> base_url = "https://spongebob-service.herokuapp.com/"
  5. >>> meme_url = "https://spongebob-service.herokuapp.com/yOu CaNnOt/CoDe MeMes"
  6. >>>
  7. >>> response = requests.get(meme_url)
  8. >>>
  9. >>> soup = BeautifulSoup(response.text, 'html.parser')
  10. >>> img_tags = soup.find_all('img')
  11. >>>
  12. >>> img_url = img_tags[0]["src"]
  13. >>> img_url = base_url + img_url
  14. >>>
  15. >>> response = requests.get(img_url)
  16. >>> with open("meme.jpg", 'wb') as outfile:
  17. >>> outfile.write(response.content)

Inspiration to convert the SpongeBob Mocking Meme into a Service

My dear friend Ryan (name changed) scoffed and said that I cannot make a service out of everything I see. After hearing such a preposterous claim (and the critically acclaimed success of my AaaS), I just had to prove him wrong. Guess who is laughing now, Ryan.

Contributing to SaaS

Contributions are welcome to include more SpongeBob memes and cleaner code.