From ce91c175943f73684423627c098ae3d7f4fa94ab Mon Sep 17 00:00:00 2001 From: Armaan Bhojwani <3fb650a9-b47e-4604-a282-1dd91953b2ee@anonaddy.me> Date: Mon, 30 Nov 2020 19:07:37 -0500 Subject: [PATCH] first push --- .gitignore | 1 + LICENSE | 21 +++++++++++++++++++++ Makefile | 20 ++++++++++++++++++++ README.md | 11 +++++++++++ extract.py | 23 +++++++++++++++++++++++ phrases | 1 + 6 files changed, 77 insertions(+) create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 Makefile create mode 100644 README.md create mode 100755 extract.py create mode 100755 phrases diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2d19fc7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.html diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..ac3b702 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +Phrases - latin famous phrases in the terminal +Copyright © 2020 Armaan Bhojwani + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE +OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..e987763 --- /dev/null +++ b/Makefile @@ -0,0 +1,20 @@ +.DEFAULT_GOAL := install + +install: + mkdir -p /usr/local/bin + mkdir -p /usr/share/phrases/ + cp phrases /usr/local/bin + cp sources /usr/share/phrases/sources + +uninstall: + rm /usr/local/bin/phrases + rm -r /usr/share/phrases/ + +reinstall: + rm /usr/local/bin/phrases + rm -r /usr/share/phrases/ + mkdir -p /usr/local/bin + mkdir -p /usr/share/phrases/ + cp phrases /usr/local/bin + cp sources /usr/share/phrases/sources + diff --git a/README.md b/README.md new file mode 100644 index 0000000..9e3f645 --- /dev/null +++ b/README.md @@ -0,0 +1,11 @@ +# phrases +Get latin famous phrases in your terminal! + +## Source +The Wikipedia page "[List of Latin phrases (full)](https://en.wikipedia.org/wiki/List_of_Latin_phrases_(full))". See the references [here](https://en.wikipedia.org/wiki/List_of_Latin_phrases_(full)#References) for more information + +## Installation +`sudo make` + +## License +Phrases is MIT Licensed by [Armaan Bhojwani](https://armaanb.net), 2020 diff --git a/extract.py b/extract.py new file mode 100755 index 0000000..a454569 --- /dev/null +++ b/extract.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python3 +# Tool to extract famous phrases from wikipedia +from bs4 import BeautifulSoup +import requests + +url = 'https://en.wikipedia.org/wiki/List_of_Latin_phrases_(full)' +response = requests.get(url) +html = response.content + +soup = BeautifulSoup(html, "html.parser") +list_table = soup.find_all("table", attrs={"class":"wikitable"}) + +output = [] + +for table in list_table: + for row in table.find_all("tr")[1:]: + cell = row.find_all("td") + for content in cell: + text = content.get_text() + output.append(text) + +print(output) + diff --git a/phrases b/phrases new file mode 100755 index 0000000..f1f641a --- /dev/null +++ b/phrases @@ -0,0 +1 @@ +#!/usr/bin/env bash -- 2.39.2