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
| from pathlib import Path | |
| import httpx | |
| from parsel import Selector | |
| root_url = "http://alandals.net" | |
| response = httpx.get(f"{root_url}/Sections.php") | |
| selector = Selector(response.text) | |
| sections_links = selector.css("tr a::attr(href)").getall() |
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
| // ==UserScript== | |
| // @name Islamweb extract audio with names | |
| // @namespace http://tampermonkey.net/ | |
| // @version 0.1 | |
| // @description Copy audio files URL and names from Islamweb. | |
| // @author yshalsager | |
| // @match *://audio.islamweb.net/audio/* | |
| // @match *://audio.islamweb.com/audio/* | |
| // @icon https://www.google.com/s2/favicons?sz=64&domain=islamweb.net | |
| // @run-at document-idle |
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
| // ==UserScript== | |
| // @name Binaa Manhaji Download Questions as CSV | |
| // @namespace http://tampermonkey.net/ | |
| // @version 0.1 | |
| // @description Adds a download button to binaamanhaji quiz pages to get all questions as CSV file, so they can be imported to Anki. | |
| // @author yshalsager | |
| // @match *://*.binaamanhaji.com/usercontrol/excercise?lesson_id=* | |
| // @match *://*.binaamanhaji.com/usercontrol/exam* | |
| // @icon https://www.google.com/s2/favicons?sz=64&domain=binaamanhaji.com | |
| // @grant none |
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
| #!/bin/bash | |
| # Scrapes mp3 files links from audio.islamweb.com links into csv data: url, filename | |
| function islamweb_get_mp3() { | |
| URL=$1 | |
| PAGES="${2:-1}" | |
| for page in $(seq 1 $PAGES); do | |
| case $URL in | |
| *pageno=*) | |
| URL=$(echo $URL | sed "s|pageno=[0-9]\+|pageno=$page|g");; | |
| *) |
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
| # sed -r -e 's/\r$//;/^[0-9]+$/{N;/\n[0-9]/d;}' -> remove lines with timestamps | |
| # sed -e '/^$/d' -> remove empty lines | |
| # perl -p -e 's|(.*[^\.]$)\n|\1 |g' -> remove new line between paragragh lines. | |
| # ${1%.*} -> input filename without extension | |
| function srt2txt() { | |
| cat $1 | sed -r -e 's/\r$//;/^[0-9]+$/{N;/\n[0-9]/d;}' | sed -e '/^$/d' | perl -p -e 's|(.*[^\.]$)\n|\1 |g' > "${1%.*}".txt | |
| } |
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
| #!/usr/bin/env python3 | |
| from urllib.parse import urlparse | |
| from requests import get | |
| from bs4 import BeautifulSoup | |
| from requests.api import head | |
| def get_url_hostname(url): | |
| parsed_uri = urlparse(url) | |
| return f'{parsed_uri.scheme}://{parsed_uri.netloc}' |
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
| #!/usr/bin/env python3 | |
| from humanize import naturalsize | |
| from requests import get | |
| org = "" | |
| org_size = [] | |
| repo_count = 0 | |
| response = get(f"https://api.github.com/orgs/{org}/repos") |
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
| from requests import get | |
| from bs4 import BeautifulSoup | |
| site = "https://www.princeofwales.gov.uk" | |
| url = f"{site}/biographies/hrh-prince-wales/speeches?title=&mrfs=All&date_from=&date_to=&page=" | |
| for page in range(0, 77): # hardcoded page number | |
| print(page) | |
| speeches = BeautifulSoup(get(f"{url}{page}").content, "html.parser").select("div.views-row > div:nth-child(1) > h2:nth-child(1) > a:nth-child(1)") |
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
| #!/usr/bin/env python3 | |
| from requests import get | |
| from bs4 import BeautifulSoup | |
| chapter = input("Enter Sura number\n") | |
| url = f"http://corpus.quran.com/translation.jsp?chapter={chapter}" | |
| page = BeautifulSoup(get(f'{url}&verse=1').content, "html.parser") | |
| verses = int(page.select_one("#verseList > option:last-of-type")['value']) |
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
| #!/usr/bin/env python3.7 | |
| """ | |
| A script that calcuate sum of github organization's repositories stargazers | |
| """ | |
| from requests import get | |
| ORG = "XiaomiFirmwareUpdater" | |
| START_PAGE = 1 | |
| END_PAGE = 2 |