2,225
edits
(add Python script to find dead YouTube videos) |
|||
Line 1: | Line 1: | ||
flacs on freenode | flacs on freenode | ||
= Find Dead YouTube Videos = | |||
# Go to [[Special:Export]] | |||
# add game categories: | |||
#* Category:GameCube_games | |||
#* Category:Triforce_games | |||
#* Category:Wii_games | |||
#* Category:Virtual_Console_games | |||
#* Category:Wii_Channels | |||
#* Category:WiiWare_games | |||
# click Export | |||
# create a Google API key (https://console.cloud.google.com/apis/credentials) | |||
# run ./the_following_script.py Dolphin+Emulator+Wiki-*.xml | |||
<pre> | |||
#!/usr/bin/env python3 | |||
import re | |||
import requests | |||
import sys | |||
API_KEY = 'PUT YOUR API KEY HERE' | |||
for path in sys.argv[1:]: | |||
text = open(path).read() | |||
ids = re.findall(r'(?<=vid.=)[^|]{11}(?=\|)', text) | |||
print(f'found {len(ids)} YouTube videos') | |||
for i in range(0, len(ids), 50): | |||
chunk = ids[i:i+50] | |||
response = requests.get( | |||
'https://youtube.googleapis.com/youtube/v3/videos', | |||
params={'part': 'id', 'key': API_KEY, 'id': ','.join(chunk)}, | |||
headers={'Accept': 'application/json'}, | |||
) | |||
valid_ids = [item['id'] for item in response.json()['items']] | |||
for id in chunk: | |||
if id not in valid_ids: | |||
print(id) | |||
</pre> | |||
= Articles without videos by platform = | = Articles without videos by platform = |
edits