Skip to content

Instantly share code, notes, and snippets.

View noahbroyles's full-sized avatar

Noah Broyles noahbroyles

View GitHub Profile
@noahbroyles
noahbroyles / html-js-view-source.md
Last active September 24, 2021 15:03
How to get HTML of page rendered with JavaScript

Get full HTML of page rendered in JavaScript

If you want to validate the HTML of a page that is being partially generated in JavaScript, a browser's View Page Source function does not cut it.

To get the page's full HTML content, go into the inspector, right-click on the beginning <html> tag at the top, and select Copy-> Outer HTML.

Then you can paste this into an HTML file and validate or view it. Just remember to put the `` tag at the top.

@noahbroyles
noahbroyles / fedex-tracking-python.md
Last active December 8, 2021 18:39
Track FedEx Package with Python - No Account Required!

This uses the same API as FedEx's website does to track packages by tracking number. There is no account number, password, or API key required to use this API.

Here is an example of how to track a package:

from fedex import track_package

track_package(523664444388)
@noahbroyles
noahbroyles / youtube_suggestions.py
Last active October 25, 2021 16:48
Get autocomplete search suggestions from YouTube
"""
YOUTUBE SEARCH SUGGESTIONS
Author: Noah Broyles
This program shows how to get search autocomplete suggestions from YouTube with Python. This is the same API that YouTube uses at youtube.com.
If you look at the Network log while searching something on YouTube, you will see that a request is made for EACH keypress in
the search box. This API is super fast, built by Google to stand up to high demand.
Because this is just a reverse engineered web API, YouTube could change their method of getting search suggestions at any time and this could
stop working. I'm betting they will keep this for a while, however.
@noahbroyles
noahbroyles / botCriteria.json
Last active September 28, 2021 13:38
Some criteria for determining if your site visitor is a bot or not
{
"blackListed": {
"IP": [],
"userAgent": [
"Mozilla/5.0+(X11;+Linux+x86_64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/56.0.2924.87+Safari/537.36+Google+(+https://developers.google.com/+/web/snippet/)"
],
"regexRules": {
"IP": [
"(66.249.\\d{1,3}.\\d{1,3})"
],
@noahbroyles
noahbroyles / youtube_music_video_search.py
Last active April 10, 2023 04:34
Search YouTube Music for videos from any search phrase
# AUTHOR: Noah Broyles
# DESCRIPTION: Uses the YouTube Music search API to find videoURLs, titles, artists, and thumbnail images for any songs searched for.
#
# Last Working: Oct 29, 2021
import re
import json
import requests
from addict import Dict
@noahbroyles
noahbroyles / youtube_music_suggestions.py
Created October 25, 2021 18:10
Gets search suggestions from YouTube Music
# AUTHOR: Noah Broyles
# DESCRIPTION: Uses the YouTube Music search suggestions API to get search suggestions from a query. API key already provided, scraped cleanly right off
# youtube's own site. ;)
#
# Last Working: Oct 25, 2021
import re
import json
import requests
@noahbroyles
noahbroyles / get-bitbucket-deployment-variables.md
Last active May 24, 2024 17:31
How to get the BitBucket Deployment Variables

How to get BitBucket Deployment Variables

Disclaimer: This is not an encouragement to use BitBucket. This is only here to help the poor people who are stuck with it.

The following JavaScript functions can be used to extract the environment variables for a BitBucket deployment into a shell script which sets the environment variables locally.
This is helpful for when you want to test something locally without manually having to copy and paste 50 environment variables.

/**
 * Get the deployment variables for a given BitBucket deployment, and return them in a dictionary.
 *