Created
January 1, 2022 07:01
-
-
Save freyta/7a6d2f2938bf03330784fffb5dbe0876 to your computer and use it in GitHub Desktop.
This file contains 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 | |
import subprocess | |
import datetime | |
# These are all of the WWF PPVs | |
show = "8518,8473,8561,1733,912,1731,4846,5123,8569,1736,94434,1868,8474,8470,5120,1734,4839,4840,8543,5124,8485,5117,8554,8551,8520, \ | |
8562,8516,8550,8493,8556,8565,8511,8523,8487,8459,8478,8476,8482,8505,8499,8535,8527,8531,8495,8560,8563,8566,8568,8540,8526, \ | |
8530,8517,8572,8480,8514,8545,8555" | |
# Change this to a year that you want to download | |
year = 1995 | |
# Used for episode end points | |
episode_list = [] | |
title = [] | |
new_title = [] | |
# Make our URL from the show and year needed | |
URL = "https://cdn.watch.wwe.com/api/filter/episodes?device=web_browser&showIds={}&year={}&page_size=53".format(show, year) | |
print(URL) | |
# Get our potential episodes from the URL above | |
year_url = requests.get(URL).json() | |
# Get each episode from the above URL | |
for episode in year_url.get("items"): | |
# The date of the broadcast converted into a readable to. | |
# From 1995-12-17T00:00:00Z to 17-12-1995 | |
date = episode.get("firstBroadcastDate")[:10] | |
date = datetime.datetime.strptime(date, "%Y-%m-%d").strftime("%d-%m-%Y") | |
# Get the actual URL for our episode | |
episode_list.append(episode.get("watchPath")) | |
# Get the title, and then convert it into a readable format | |
title.append("{} {} ({})".format(episode.get("episodeName"), str(episode.get("episodeNumber")), date)) | |
new_title.append("{} - {} {} - {}.720p".format(episode['customFields']['EpisodeShort'], episode['customFields']['EpisodeShort'], str(episode.get("episodeNumber")), date)) | |
# Create a list that we want to download | |
my_list = list(zip(episode_list, title, new_title)) | |
# Download each item from the list | |
for url, title, new_title in list(set(my_list)): | |
print(f"{url=} {title=} {new_title=}") | |
subprocess.call(f"python3 main.py -q 1 -f -t {url} -of \"{title}\"", shell=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment