Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from bs4 import BeautifulSoup | |
Z_LIB = "https://b-ok.africa" | |
def scrape_zlib(query): | |
response = [] | |
url = f"{Z_LIB}/s/{query}" | |
page = requests.get(url) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
const HOST = "/path/to/url/"; | |
addEventListener("trix-attachment-add", function (event) { | |
if (event.attachment.file) { | |
event.attachment.file | |
uploadFileAttachment(event.attachment) | |
} | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_time_to_read(text: str): | |
striped_text = strip_tags(text) | |
word_cleaned = re.sub(r" /[^\w ]/g", "", striped_text) | |
word_count = len(word_cleaned.split(" ")) | |
reading_time = math.floor(word_count / 200) | |
if reading_time <= 1: | |
return f"{str(reading_time)} min" | |
else: | |
return f"{str(reading_time)} mins" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ParseHTML(HTMLParser): | |
def __init__(self): | |
super().__init__() | |
self.reset() | |
self.strict = False | |
self.convert_charrefs = True | |
self.text = StringIO() | |
def handle_data(self, d): | |
self.text.write(d) |
NewerOlder