Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
api
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Clickbait

a Django-powered JSON-returning API that generates Apple clickbait articles to use as lorem ipsum

Finding source articles

The first helper script uses the Azure Cognitive Services Bing News search API to find new articles that include "Apple" and keywords common to clickbait articles such as "shiny." It stores the new article URLs in a SQLite database.

Scraping for gold

A second helper script pulls new URLs from the database, requests the article itself, and uses Beautiful Soup to extract paragraphs. Paragraphs are checked for relevance and, if they pass, are inserted into a paragraphs table.

Putting it all together

The Django app is fairly simple and simply queries the database for ten random paragraphs. One view returns it as a pre-generated HTML file, along with some basic statistics about the database, while another view returns a JSON list. This can be iterated through with some vanilla JavaScript as provided for on this reference implementation page.

About

a Django-powered JSON-returning API that generates Apple clickbait articles to use as lorem ipsum

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published